Skip to content

Template

llms.txt lists every page for an agent

A Template declares the image a steward’s sandbox is made from. A profile’s template names it by its name. Without one the steward starts from E2B’s base template, so a project declares its own when its Ops need tools that base lacks, or to pin the Node the steward runs.

import { Template } from "@intentius/chant-lexicon-e2b";
const steward = new Template({
name: "chant-steward",
fromImage: "node:22-bookworm",
run: ["apt-get update && apt-get install -y --no-install-recommends jq gh && rm -rf /var/lib/apt/lists/*"],
cpuCount: 2,
memoryMB: 2048,
});
export { steward };
PropertyTypeMeaning
namestring, requiredThe template’s name on E2B: lowercase letters, digits, dashes and underscores. A profile’s template names it.
fromImagestring, requiredThe image the template starts from. Pin a tag.
runstring[]Shell commands run in order while the template builds, one RUN line each.
envRecord<string, string>Environment variables set in every sandbox made from the template.
workdirstringThe working directory for the run steps and the start command.
startCmdstringThe start command, passed as --cmd. E2B runs it when the template is snapshotted, so a sandbox starts with it running.
readyCmdstringThe ready command, passed as --ready-cmd. E2B polls it until it exits 0 before it snapshots the template.
cpuCountnumbervCPUs per sandbox. E2B’s default is 2.
memoryMBnumberMemory per sandbox in MiB, an even number. E2B’s default is 1024.

chant build writes each template as e2b.<name>.Dockerfile beside its output. The JSON index it writes as the main output gives each template a build field, the e2b template create command line that builds it from that Dockerfile. chant does not run it. Run it in the output directory once, and again when the declaration changes:

Terminal window
chant build src --lexicon e2b -o dist/e2b.json
cd dist && e2b template create chant-steward --dockerfile e2b.chant-steward.Dockerfile --cpu-count 2 --memory-mb 2048

A steward that already exists keeps the sandbox it was made with. To move it onto a rebuilt template, delete its sandbox; the next run makes a new one and clones the repository again.

IdSeverityWhenWhat it catches
E2B001errorlintA cpuCount that is not a whole number of at least 1, or a memoryMB that is not a positive even number. e2b template create refuses an odd memory size.
E2B002warninglintA fromImage with no tag, or on latest. Two builds of the same declaration could then carry different Node or git versions.
E2B011errorbuildA name E2B refuses, or two templates with the same name, whose files would overwrite each other.
E2B012warningbuildNo sign of git or Node: the image is not a full node image (not -slim or -alpine) and no run step installs them. The runtime stops a run at once on a sandbox without either.

E2B012 only sees the declaration. A template from an image that already has both tools can say so with a step such as git --version && node --version.

chant