The runtime caldera.pyz
The program that sets an agent up on a machine and then runs and reports for it: commands, directory layout, the systemd unit, how it supervises the agent, the status file, settings, logs, health checks, updates and rollback of blueprints, the signed update of the runtime itself, behaviour without Caldera, environment variables, Python support and security properties.
What it is
caldera.pyz is one Python 3 file with no dependencies (standard library
only; it carries its own small YAML reader). It is both the command line tool
(caldera init <code>) and the long-running process (caldera run) that
- starts, watches and stops the agent's process,
- reports to Caldera in the agent protocol and applies the commands (pause, resume, run now, settings, log),
- fetches, health-checks and applies new versions of the blueprint, and rolls back,
- on a wish, replaces itself with a signed new runtime (below),
- or, for an agent that keeps its own processes, owns none and passes everything on to an adapter (adapter mode).
It never decides what the agent does. It launches the agent, reads the status file the agent writes, and passes it on.
The same bytes are served at https://app.calderaapp.io/cli/caldera.pyz with
the checksum at /cli/caldera.pyz.sha256 and the signature at
/cli/caldera.pyz.sig. The archive is reproducible: the same sources give the
same bytes.
Getting it
The install dialog shows the command with the checksum embedded:
curl -fsSL https://app.calderaapp.io/cli/caldera.pyz -o caldera.pyz && echo "<sha256> caldera.pyz" | sha256sum -c -
On macOS use shasum -a 256 -c - instead of sha256sum -c - (the dialog offers
that variant). The checksum in the dialog is computed from the very bytes the
server serves, so it needs no second request to the same origin.
Requirements
- Python 3.10 or newer. No minimum is declared in the program; 3.10 is the lowest version it was tested on. It was also tested on 3.13 and 3.14.
- Linux or macOS. It uses
fcntland/procorps, and a systemd user unit for the service. Windows is not supported. - systemd for the service.
initalso works without systemd (--no-service, or nosystemctl); the agent is then started withcaldera run --dir <dir>. - Outbound HTTPS to Caldera. Nothing listens on the machine.
ssh-keygen(OpenSSH) for the signed update of the runtime itself. It is on practically every machine an agent runs on. Without it the runtime keeps working and reports, but does not update itself.
Commands
All commands are python3 caldera.pyz <command>. Errors print
caldera: <message> on stderr and exit 1.
| Command | Does | Needs Caldera? |
|---|---|---|
init <code> [--dir DIR] [--url URL] [--no-service] |
Sets an agent up from a one-time install code. | Yes, the only command that does. |
run [--dir DIR] [--once] |
The long-running process: supervise and report. --once sends one report and exits (a test). |
Reports go out; nothing waits for them. |
status [--dir DIR] |
Shows the agent's state. | No |
pause [--dir DIR] |
Writes the paused file and stops the agent. In adapter mode: calls adapter pause. |
No |
resume [--dir DIR] |
Removes the file; starts the agent if the runtime is not running. In adapter mode: calls adapter resume. |
No |
stack |
The container image's entrypoint: sets the agent up from CALDERA_INSTALL_CODE once, keeps a copy of the runtime, installs Claude Code if it is missing, then becomes run. See Container stack. |
Yes, at the first start only. |
setup [login|trust|remote-control] [--trust-dir DIR] [--dir DIR] |
In a container stack, at the container's console: signs in to Claude, switches Remote Control on, asks for the workspace trust. Interactive; the person answers. Also caldera-agent setup. See Container stack. |
No |
rollback [--dir DIR] |
Returns to the previous blueprint version. | No |
rollback-runtime [--dir DIR] |
Puts the previous runtime file back and tells a running runtime to restart from it. | No |
pin-runtime <version|off> [--dir DIR] |
Holds the runtime at one version: it updates to no other. | No |
burn on|off [--dir DIR] |
Burn through until the weekly reset, or stop; see below. | No |
session [on|off] [--dir DIR] [--minutes N] [--message TEXT] [--resume ID] |
Opens a Claude Code session on this machine, in the agent's working directory (on, the default), or closes it. Needs session in the manifest's controls to open. See Talk to the agent. |
No |
publish <bundle.zip> --workspace ID [--url URL] [--blueprint NAME] [--deploy AGENT] [--token-file FILE] |
Uploads a bundle as a new blueprint version, publishes it, and optionally asks one agent to move to it. Runs on the developer's machine, in no agent's directory. See Publishing a version. | Yes, with an admin's API token, not an agent's. |
dev [--dir REPO] --config FILE [--timeout S] [--example] |
Runs the blueprint in a repository once on this machine, with this runtime and standard library, and prints what it says. See Try a blueprint locally. | No |
log [name] [--dir DIR] |
Lists the agent's logs, or prints the tail of one. | No |
action [name] [--dir DIR] |
Without a name: lists the agent's repairs with the runs left. With a name: runs that action under the same limit as Caldera's button. See Findings and actions. | No |
--version |
Prints caldera 1 (runtime <version>). 1 is the CLI's constant; the runtime's own version is baked in at build time (dev from source). |
No |
--dirdefaults to$CALDERA_AGENT_DIR(set in a container stack), else the current directory, for all butinit. Pass it, orcdinto the agent's directory.init --dirdefaults to~/caldera-agents/<agent name>;--urldefaults to the environment variableCALDERA_URL, elsehttps://app.calderaapp.io. The URL must behttps;httpis accepted only forlocalhost,127.0.0.1and::1.statusprints: agent name, blueprint and version (with the previous one), process (running,pausedornot running), runtime (runningornot running), the last report (okorfailed, and how many seconds ago), the last update (outcome and message), a hold if there is one, and every setting's value.
What init does
- Preview. Reads what the code would install, without spending it. It names the agent, the directory and the secrets. Everything a person can still abort at (a directory that is taken, a secret they do not have) comes before the code is spent.
- Directory check. If the target directory already holds an agent
(
.caldera/config.jsonexists),initstops. - Secrets. For each declared secret: the environment variable
CALDERA_SECRET_<NAME>if set; otherwise asked for on the terminal (hidden input) when stdin is a terminal; otherwise an error, unless the secret isoptional(then it is skipped). An empty answer to an optional secret skips it. Secrets never go to Caldera. - Redeem. Spends the code. The answer carries the agent's token, one set of binding variables per binding, and the bundle. The runtime refuses an answer that installs a different agent than it previewed, and a value with a line break.
- Unpack. Verifies the bundle's SHA-256, unpacks it into
versions/<version>/, validates the manifest and checks that every file the manifest names exists. A bundle that fails any check leaves nothing behind. - Write.
agent.env,secrets.env(both mode 600),config.json, the settings file, and thecurrentlink. - Service. Writes and starts a systemd user unit (unless
--no-service). Ifsystemctlis not found, it prints how to start the agent by hand:caldera run --dir <dir>.
If something fails after step 4, the code is spent and the agent exists in Caldera without a machine. The runtime prints that, and a person deletes the agent in Caldera and issues a new code.
The directory
<dir>/ e.g. ~/caldera-agents/my-agent
versions/<semver>/ one unpacked bundle per version kept (never edited)
current -> versions/X the version that runs; swapped atomically
state/ what survives an update (the manifest's `state` paths)
.caldera/ the runtime's own files; a bundle can never write here (mode 700)
config.json (600) url, agent name, blueprint, previous, settings, held, window, last update
agent.env (600) CALDERA_URL, CALDERA_TOKEN, binding variables
secrets.env (600) what `init` asked for
settings.json (600) the settings as they are now, for the agent to read
paused exists while the agent is paused
run-now created by `run_now`; the agent removes it
update.json (600) the journal of an update in flight
lock held while the version changes
agent.pid the agent's pid and start time (its identity)
runtime.pid the runtime's pid and start time
runtime.json (600) the runtime's own update state: version, previous, hold, pin, last outcome, trial
runtime.lock held while that state changes
last-report.json when the last report went out and whether it worked
runtime.log the runtime's log
agent.out.log (600) the agent's stdout and stderr
caldera.pyz a copy of the runtime, if `init` ran from a .pyz; the file the unit runs, replaced by a self-update
caldera.pyz.previous the runtime that ran before it (mode 700), for `rollback-runtime`
current is a symlink and the swap is one rename. Replacing a symlink with
os.replace is atomic: at every instant current names a complete version. An
update killed at any point leaves current on the old or the new version, never
half of either.
State is outside the version, linked in. Each path in the manifest's state
list lives in <dir>/state and every version gets a symlink to it. A file the
bundle ships at a state path is a seed: copied into state only if nothing
is there yet, so a new version can bring defaults without overwriting what the
agent has learned.
Only two versions are kept: the running one and the previous one. Older ones are deleted after a successful update.
The service
init writes ~/.config/systemd/user/caldera-<name>.service (or under
$XDG_CONFIG_HOME):
[Unit]
Description=Caldera runtime for the agent <name>
After=network-online.target
[Service]
ExecStart="<python>" "<dir>/.caldera/caldera.pyz" "run" "--dir" "<dir>"
Restart=always
RestartSec=10
KillMode=process
[Install]
WantedBy=default.target
then systemctl --user daemon-reload and systemctl --user enable --now caldera-<name>.service. To keep it running when nobody is logged in:
loginctl enable-linger <user>.
The unit never changes when the runtime does. It names
<dir>/.caldera/caldera.pyz, and a self-update replaces that file with one
rename; the unit, its interpreter and its arguments stay as they are.
KillMode=process is not a detail. The default (control-group) kills every
process the unit started when it stops, which would take the agent down with a
runtime restart. The agent must outlive the runtime.
Logs of the runtime: journalctl --user -u caldera-<name>.service and
<dir>/.caldera/runtime.log. Every line passes through a redactor that replaces
the agent token and the typed secrets with their names.
How it supervises the agent
caldera run has two threads, deliberately apart:
- The supervisor looks at the agent once a second and never touches the network.
- The reporter talks to Caldera every interval, with a timeout on every
request (default 10 s;
CALDERA_REQUEST_TIMEOUT, 1 to 120).
A Caldera that hangs for ten seconds delays the next report and nothing else. The agent is kept running, a pause is applied within a second, and the rollback window keeps counting.
At start the runtime first finishes or undoes an update that was interrupted (see the journal).
Process runtime (runtime.type: process)
- The agent is started from
runtime.command(an argument list, never a shell) inversions/<version>/<workdir>, with the environment below, stdin closed, stdout and stderr appended to.caldera/agent.out.log(truncated at start when it is larger than 5 MB). - It is started in its own session, so a crash, restart or
systemctl stopof the runtime does not take it along. A runtime that starts again finds the agent by its pid file (pid and start time, because a pid alone is reused) and adopts it instead of starting a second one. - Stopping: SIGTERM to the process group, up to 10 seconds of grace, then SIGKILL and up to 5 more seconds.
- Restarts: if the agent is not running and not paused, it is started. After a
failure the next try waits 5 seconds, then doubles, up to 300 seconds. A process
that ran longer than 60 seconds resets the count.
run_nowskips the wait.
Compose runtime (runtime.type: compose)
The same contract through docker compose -f <file>: up -d to start, stop to
stop, ps --status running -q to look, with a 300-second timeout per call. It
has not been verified on a real Docker machine. Treat it as untried.
The environment the agent gets
The agent gets the runtime's own environment plus everything in
.caldera/agent.env and .caldera/secrets.env, except CALDERA_TOKEN: the
agent has no use for the token that speaks for the runtime, and a process that
never held it cannot leak it. Plus these variables:
| Variable | Is |
|---|---|
CALDERA_SETTING_<KEY> |
each setting's value when the process started (true or false for bool, compact JSON for a list, empty if unset); the key is upper-cased |
CALDERA_SETTINGS_FILE |
JSON of all settings, rewritten on every change |
CALDERA_PAUSE_FILE |
exists while the agent is paused. The runtime stops the process, but waits while the agent reports an active run: check the file before you start a new run |
CALDERA_SECRET_NAMES |
the names the runtime put into the environment from secrets.env at the start, comma separated; the standard library's live_environ reads these fresh from the file, so a changed secret needs no restart |
CALDERA_RUN_NOW_FILE |
created by run_now; the agent removes it when it acts |
CALDERA_STATE_DIR, CALDERA_AGENT_DIR |
the state directory and the agent's directory |
CALDERA_AGENT_STARTED |
Unix time (seconds, three decimals) at which this process was started |
CALDERA_BINDING_<PRODUCT>_URL, _WORKSPACE, _TOKEN |
one set per binding, and per data source of the install (from agent.env) |
CALDERA_DOCS_PRODUCT, CALDERA_DOCS_COLLECTION, CALDERA_DOCS_PAGE |
the documentation area the admin gave the agent, as a product name and ids, from agent.env. The runtime rewrites them when an answer changes the area, so the values a running process started with can be out of date |
CALDERA_AGENT_ENV_FILE |
the path of agent.env: read it again to see a changed area without a restart |
CALDERA_URL is also in the environment (it is in agent.env). The agent needs
none of this to run. It is how it cooperates without Caldera.
The status file
The agent reports by writing the JSON file the manifest names as status
(relative to the version directory, for example data/status.json), in the shape
of a protocol report. The runtime forwards only these keys: state, health,
active, gauges, runs, panels, quota and findings (see Findings and actions). Any other key, such as a heartbeat the
agent keeps for its own health check, is not forwarded.
- A file larger than 200 KB is not read; the report gets a health line "Status file" at warn.
- A file that is not a JSON object costs one health line, not the report.
- A file that does not exist yet means the agent has not said anything.
- Write it atomically (write a temporary file, then rename). The catalog's
starterblueprint does.
The runtime adds agent (version and host name), settings, controls,
acks and applied, plus health items Process and, per binding, Binding <product>. It replaces state with Paused (warn) or Not running (bad,
with "restarting in N s") when that is the truth, and uses Running (ok) if the
agent reports no state.
A pause waits for the run's end (runtime 0.40 or later). When Caldera pauses an
agent whose status file lists an active run, the runtime keeps the process until
the list is empty, at most 90 minutes after the pause. Meanwhile Process and the
state's detail say "pausing after the run". caldera pause on the machine stops at
once: it is the emergency stop. An agent that lists no active run is stopped at
once, as before.
A run that hangs shows. A run in active whose started (Unix seconds) is more
than two hours ago adds the health item Run (warn), for example "Run has been
active for 125 minutes". Ending it is the agent's own timeout, or a person's.
Commands from Caldera
Each is checked against this agent's manifest and answered with an ack in the next report.
| Command | What the runtime does |
|---|---|
pause |
If pause is in the manifest's controls: writes .caldera/paused and stops the agent. While the status file lists an active run, the process is kept until the list is empty, at most 90 minutes. Ack "Paused." |
resume |
If offered: removes the file; the supervisor starts the agent. Ack "Running again." |
run_now |
If offered: refused with "Paused. Resume first." while paused. Otherwise creates the run-now file and skips a restart wait. Ack "Requested." |
set |
Every key must be a declared setting and every value inside its bounds, or nothing changes (all or nothing). Ack "Applied: ." or "Nothing changed: : ." |
message |
If message is in the manifest's controls: hands the person's message over to the agent (adapter verb message, or a file in the inbox). Without it: refused with "This agent does not take messages." before anything is fetched, written or called. Needs runtime 0.36 or later. |
session |
If session is in the manifest's controls: on: true opens the session (an optional message), on: false closes it. See Talk to the agent. |
action |
The payload is {"name": "<action>"} and nothing else; anything else, or an undeclared name, is refused and costs no run. See Findings and actions. |
log |
Only a name declared in the manifest's logs, and only a file that resolves inside the agent's directory and outside .caldera/. The last 512 KB are uploaded; anything else is answered with the text "There is no such log." No ack: the upload is the answer. |
| anything else | Refused: "This agent does not know the command ..." |
A control the manifest does not offer is refused the same way. controls
defaults to pause and resume; run_now, burn, session and message must be named.
The pause is the same file caldera pause writes. That is what makes every
command reversible without Caldera.
Settings
- The manifest declares the schema, bounds and defaults. Values live in
.caldera/config.json; a setting with no stored value reads its default. setrewritessettings.jsonand does not restart the agent. The environment variablesCALDERA_SETTING_<KEY>only change at the next start, so an agent that must react at once readsCALDERA_SETTINGS_FILEbefore each decision.nullclears a setting only if the manifest gives it no default.- A key that is no longer declared by a newer version stays in
config.jsonbut is ignored.
Health checks
The manifest's health.command (argv, run in the new version's working directory,
with the agent's environment including secrets and CALDERA_AGENT_STARTED)
decides whether a version works. Exit 0 passes. It fails on a non-zero exit, a
timeout (timeout_seconds, default 60, at most 600) or a command that cannot
run. A manifest with no health always passes.
Write the check so that it needs the new version to have worked. Compare a
heartbeat in the status file against CALDERA_AGENT_STARTED: a fresh-looking file
the previous version left behind must not pass for the new one. A good check also
verifies the agent's configuration and that the programs it calls are in the
path.
Updates and rollback of blueprints
An update is five steps, and the order is the safety argument:
- Fetch the bundle and verify its checksum. A network error ends the update
as
failed, with a retry after 10 minutes. - Stage it beside the running version and validate it. A refused bundle ends
as
failedand the version is held. - Swap
current, one rename. - Restart on the new version and run
health. - Keep (
previous= the old version, a 30-minute window, outcomeok) whenhealthpasses, or swap back, restart the old version, outcomerolled_backand hold the new one, when it does not.
Is it wanted? The runtime applies desired when all hold: it names the
agent's own blueprint, version is a semantic version (anything else is never
used as a path), it is not the running version, and it is not on hold.
The hold. A version the runtime rolled back from or refused is not applied
again until desired names a different version. Otherwise a local caldera rollback would be undone by the next report. A successful update to another
version clears the hold. The one exception is a failed fetch (Caldera
unreachable): it is retried after ten minutes.
Outcomes (reported in applied.outcome, with a one-line message):
| Outcome | Meaning |
|---|---|
ok |
The new version runs and passed its health check. The message is "installed" before any update. |
rolled_back |
The new version failed its health check, or got worse inside the window, or a person ran caldera rollback. The agent is back on the old one. |
failed |
Nothing changed: the bundle could not be fetched, was refused, or an update was interrupted and undone. |
The window. After a kept update the runtime remembers the agent's level at
that moment. For 30 minutes (fixed, not configurable) it checks every 15
seconds, and rolls back by itself if the level got worse. The level is bad
when the agent is not running, otherwise the level of the state in the status
file (info counts as ok). Health items do not count; a paused agent is not
checked, and a person's pause is never a reason to roll back.
Rollback (caldera rollback, or Caldera naming the old version) swaps
current to the previous version and restarts. It needs no network, only the
disk. Because only two versions are kept, rollback toggles between the running
version and the previous one. To go further back, Caldera names that version and
the runtime fetches it again.
The journal and recovery
update.json records the step reached: fetched, staged, swapped. A process
killed between any two steps is handled at the next start:
- killed at
fetchedorstaged: the leftovers are discarded; the old version never stopped being the right one; - killed at
swapped(the new version is linked but nobody checked it): back to the old version, outcomefailed, hold on the new one.
A lock keeps rollback and an update from interleaving, and keeps the supervisor
from starting the wrong version during one.
Updating the runtime itself
An update of the runtime is code from Caldera running as the agent's user, which
on a real machine holds keys and product tokens. A checksum from the same server
proves nothing against a compromised server or a manipulated release, so every
runtime file is signed outside the server and the runtime refuses an update it
cannot verify. The runtime never updates itself unasked: an admin presses
"Update runtime" on the agent's page, which makes the next answer carry
runtime_desired, or has switched on "Update automatically" for that agent, in
which case Caldera makes the same wish itself when a newer runtime, approved by
the owner, is offered.
- Download
caldera.pyzandcaldera.pyz.sig, no token. A network error or a missing signature ends asfailed, retried after 10 minutes. - Verify the checksum, then the signature. No key, no
ssh-keygenor a bad signature ends asfailed; the old file stays. - Ask the new file for its version (
python new.pyz --version). A file that does not start, or names another version, ends asfailed. - Swap and restart. The old file is kept as
.previous, the new one replaces it with one rename, and the runtime restarts in place. The agent imports the standard library from that file, so the runtime restarts the agent too, once its current run has ended (at most 15 minutes later; an agent whose status file lists noactiveruns is restarted at once); until then the agent's page shows the findingruntime:replaced(runtime 0.53). - Trial. The first successful report within five minutes makes it good
(
ok). A runtime that crashes, or does not report in time, goes back to.previousby itself (rolled_back) and the version is held.
The signature. The release build, and the job that publishes a runtime
without a release, sign caldera.pyz with an OpenSSH ed25519 key, namespace caldera-runtime. The runtime checks it with
ssh-keygen -Y verify -f <allowed_signers> -I caldera-release -n caldera-runtime -s <sig> < caldera.pyz
against a public key built into the runtime. No ssh-keygen, no signature
(/cli/caldera.pyz.sig answers 404), a signature by another key or for other
bytes: no update. The outcome is failed with the reason in
runtime.applied.message, and the old file is untouched.
Is it wanted? The wish is acted on when runtime_desired is a version string
([0-9A-Za-z][0-9A-Za-z._-]{0,63}, never a path), it is not the running version,
it is not held, it is not ruled out by a pin, and no earlier update is
still on trial.
What is held. A version the runtime went back from, and a file it refused for
what is in it (a checksum, a signature, a file that does not start, another
version than the wish), is not tried again until runtime_desired names a
different version. What is only the machine's or the network's trouble (no
ssh-keygen, no signature yet, a failed download, not running from the unit's
file) is retried after ten minutes while the wish stands.
Restart in place. After the swap the runtime replaces itself with the new
file in the same process: the same process id, so the systemd unit sees one
unbroken process. The agent's own processes are not touched: in process mode the
agent runs in its own session and the new runtime finds it again by its pid file;
in adapter mode there is nothing to adopt. Only a runtime that runs from
<dir>/.caldera/caldera.pyz (what the unit names) can replace itself; one
started from somewhere else says so.
Atomic and stable. The old file is first written to
.caldera/caldera.pyz.previous, then the new file replaces caldera.pyz with one
rename: both files are whole at every instant. The unit is never rewritten.
The trial. The new runtime counts as good after its first successful report
within five minutes (the window restarts with each start of the new runtime). It
goes back to the previous file by itself when that window passes without a
successful report, or when it was started more than three times without one (a
crash loop). Going back puts the previous file in place, holds the version,
restarts in place and reports rolled_back. With Caldera unreachable during the
trial a good update therefore goes back, and is held: that is the price of a check
that needs no trust in the new file.
Outcomes are the blueprint's (ok, rolled_back, failed) and travel in the
report as runtime.applied with the version that works now. While a runtime is on
trial it claims nothing; ok is reported only after it proved itself.
Offline. caldera rollback-runtime swaps the two files (so a second call goes
forward again), holds the version it left, and signals a running runtime to
restart from the file; without a running runtime the file is used at the next
start. caldera pin-runtime <version> makes the runtime update to no other
version than that one, whatever Caldera wishes; pin-runtime off releases it. The
pin is reported. Neither needs a connection. With Caldera unreachable nothing
happens at all: the runtime keeps the file it has.
A runtime installed before this feature cannot update itself. Replace
.caldera/caldera.pyz once by hand; after that it can. See
Operating agents.
Container stack
An agent can run in a container instead of on a host: the image
ghcr.io/speedxy/caldera-agent has the runtime as its entrypoint, and Caldera
generates the compose file (see Install as a container stack).
What the runtime does there:
- Layout. All state is on three named volumes:
/data/agentis the agent's directory as on a host (versions/,current,state/with the clone,.caldera/with the token and the runtime's own, updating copy of itself),/data/homeis the agent user'sHOME(Claude Code, what the setup script installed, git's configuration) and/data/claudeisCLAUDE_CONFIG_DIR(the sign-in, Remote Control, the workspace trust, the session transcripts). - First start (
caldera stack). If no agent is installed it redeems the code inCALDERA_INSTALL_CODE(after the preview, likeinit), with the declared secrets fromCALDERA_SECRET_<NAME>; the agent token lands on the volume. The code is never read again, so a restart of the container with the spent code still in its environment is not an error. The code and the secret variables are removed from the runtime's own environment, so neither the agent nor Claude Code ever holds them. A start with no agent and no code stops with a message that says what to do. - Claude Code is installed with Anthropic's installer
(
https://claude.ai/install.sh) at a start that does not findclaude, onto/data/home. It is not in the image. - The setup script (
container.setup) runs once per blueprint version: the supervisor starts it in the background before it starts the agent, the agent starts when it has succeeded, and a marker/data/home/.caldera-setup/<name>-<version>.donerecords that. A failure is tried again after 30 s, doubling to five minutes; the output is.caldera/setup.log. An update runs it to its end before it restarts the agent on the new version; a failure there is a failed update and goes back. caldera setup(caldera-agent setup) walks three steps at a terminal:claude auth login, a plainclaudein the agent's directory (Claude Code asks for the workspace trust of that folder, which covers the folders below it), andclaude remote-control(which asks to enable Remote Control). The runtime answers none of the questions and writes nothing into Claude's files; it only skips the trust step when Claude's own file already says the folder is trusted. The three are what a headless session needs (Talk to the agent).- Sessions and resuming work as on a host: the runtime starts Claude Code in the container, where the transcripts are.
- Stopping. The container stopping stops the runtime, and the runtime stops the agent with it (unlike a host, where the agent is left running).
- The way back is
docker exec <agent container> caldera pause|resume|session off|status.
Adapter mode
For an agent that keeps its own processes the runtime owns none. It starts nothing, stops nothing, restarts nothing and reads no file of the agent. It calls one command the manifest names with a verb. The interface is described on Adapter mode and its contract.
The Claude account hint
The runtime can report which Claude account its machine is signed in to. See The Claude account hint.
Burn through until the reset
An owner can let an agent use up what is left of the week on purpose: it runs without its quota
limits until the weekly reset, and the mode ends by itself. The runtime does not see an agent's Claude
runs, so it cannot lift a limit: it provides the switch, the end and the display, and the agent's own
gate decides what "no limit" means. An agent without burn in its manifest's controls has no switch.
- Switch: the command
burnfrom Caldera (admins only) orcaldera burn on|off --dir <dir>, which needs no connection. Pause wins: burning lifts no pause and no hold. - The end is computed here, never sent. It is the
resets_atof the seven-day window: from the agent's ownquota(adapter:adapter status; process agent:quotain the status file), else, for a process agent only, from one lean measurement when the switch is pressed (claude -pwith a one-line system prompt, no settings, no tools, no MCP, the smallest model, about 860 tokens). It reads the Claude login of the runtime's user; an agent under another account must report its ownquota. The measurement never gets the Caldera token. - Refusals: with no reliable reset time, or one already past,
onis refused and says why. An adapter may refuse too, or set an earlier end. - State: process agent
.caldera/burn.json({"until": <epoch seconds>}), written onon, removed onoffand at the end; adapterburninadapter status.untilat or before now is off: a file left behind after the reset does not keep the mode on. The agent gets the file's name inCALDERA_BURN_FILE.
Talk to the agent (a Claude Code session)
(ADR-0045 D11.) An admin presses "Talk to the
agent" and a Claude Code session starts on the agent's machine, in the agent's working directory; it is
continued in the Claude app or on claude.ai, without SSH. It is off unless the manifest names session
in controls: the owner of the agent decides that an admin may do this.
What it runs. claude remote-control --name "<agent> (Caldera)" --permission-mode default, found
as claude on PATH or in ~/.local/bin, ~/.claude/local, /usr/local/bin, /opt/homebrew/bin.
Measured on Claude Code 2.1.292: it starts headless (no terminal, stdin closed), connects, creates one
session in its working directory under the given name, prints its address
(https://claude.ai/code/session_…) and runs until it is stopped. The permission mode is default:
every tool the session wants to use is asked for in the app, as in a terminal. Nothing else is invented:
no flag of Claude's is used that its --help does not list. What is not known: whether Claude ends an
idle session by itself. The runtime therefore ends it at its own limit.
Whose session it is. It belongs to the Claude account this machine is signed in to (the account hint). Only someone signed in to that account sees it in the app, and it uses that account's quota. Caldera's confirmation says both.
- Where: process and compose agents: the current version directory (plus the manifest's
workdir); adapter agents: the manifest'sworkdir(often the agent's own checkout). - Detached, and bounded. Started as the runtime's own user in a process group of its own, through a small
watchdog that ends it after two hours (
--minuteson the command line, 1 to 480; Caldera sends none) even when the runtime is gone. It never touches the agent or the runtime; a runtime that restarts itself finds the session again by its pid and start time (a reused pid is never signalled). - One at a time. A second press is refused and says where the first is and until when.
- No Caldera in its environment.
claudegetsPATH,HOME,USER,LOGNAME, the locale andTZ,TMPDIR, theXDG_*directories,DBUS_SESSION_BUS_ADDRESSandCLAUDE_CONFIG_DIR, and nothing else: noCALDERA_*, nothing ofagent.envorsecrets.env, no OAuth token (Remote Control needs the machine's full login and refuses an inference-only one). A start command of the manifest's own additionally getsCALDERA_SESSION_NAME, with a first messageCALDERA_SESSION_MESSAGE_FILE, and with a conversation to continueCALDERA_SESSION_RESUME. - A directory Claude does not trust is refused, in Claude's own words ("Workspace not trusted. Please
run
claudein first …"): runclaudeonce in that directory and accept the dialog. A new blueprint version is a new directory, so trust given to a parent directory (for example the agent's directory) is what makes this survive updates. - The state is
.caldera/session.json(mode 600: pid, start time, name, end, directory, the address if seen) and the output is.caldera/session.log, emptied when it passes 1 MB. Every report carriessession: {started, name, ends, url?, resume?}read from there;endsat or before now, or a process that is gone, is a closed session. - Offline:
caldera session,caldera session off, andstatusshows it.
The manifest's own start command. An agent whose checkout must not be worked in by a session and a
scheduled run at once (one with a scheduler sets a session mark that scheduler reads) names its own start in the
manifest: session: {command: [scripts/session.sh]} (only together with session in controls; argv, never
a shell). The runtime runs it in the working directory with the Remote Control call appended to its
arguments (<path of claude> remote-control --name … --permission-mode default), so it is a wrapper that
ends in exec "$@". Every rule above applies to it too.
A first message. The command from Caldera may carry message, plain text of at most 2000 characters
without NUL. claude remote-control takes none, so the default start cannot deliver it and the ack
says so; a start command of the manifest's own reads it from the file named by
CALDERA_SESSION_MESSAGE_FILE (mode 600, in .caldera/, deleted when the session ends). It is data: never
an argument, never in the environment, never through a shell.
Remote Control must be switched on once per machine user. The first claude remote-control of a machine
user asks "Enable Remote Control? (y/n)" and waits for a yes. The runtime recognises the question in the
session's output, ends the start at once and refuses with "Remote Control is not switched on for this user:
run claude remote-control once on the machine and answer yes." Do that once, as the user the runtime runs as,
before the first session; afterwards it stays on.
The same holds for Claude Code's workspace trust question. In a folder that was never trusted the session
stops at "Do you trust this folder?" and shows no address. The runtime ends the start at once and names the
folder. Run claude in that folder once, as the runtime's user, and accept the question. What counts is the
folder the session starts in; folders added with --add-dir did not ask when measured.
Continue a conversation
(ADR-0050.) An agent that works on separate pieces of work lists them in its status as resumable, and an admin
continues one from Caldera's page. Needs runtime 0.36 or later.
- Only with a start command of the manifest's own. The runtime reports
resumableonly for an agent that namessessionincontrolsandsession: {command: [...]}; the default start refusesresume. - The id is data. It reaches the start command in
CALDERA_SESSION_RESUME, never as an argument and never through a shell; the runtime checks its shape (^[A-Za-z0-9][A-Za-z0-9._:-]{0,119}$) again. - A pseudo terminal.
claude --resume <session> --remote-control <name>prints the session's address and shows the earlier conversation, but fails without a terminal ("Provide a prompt to continue the conversation"). The start command therefore runs it asscript -qfec "<quoted call>" /dev/nullwith a stdin that stays open. Nothing of the earlier run's tool rules is inherited: it passes the same rules as the agent's own runs. Everything else of a session holds unchanged, one at a time included. - Offline:
caldera session --resume <id>. The catalog's project agent (1.3.0) is a working template.
Try a blueprint locally (caldera dev)
(ADR-0106 D1.) Run from the repository of an own blueprint, with the caldera.pyz whose runtime and
standard library the agent will run on:
python3 caldera.pyz dev --example > ~/dev-config.json # a template; edit it, then chmod 600
python3 caldera.pyz dev --dir . --config ~/dev-config.json
One pass runs the blueprint once and needs no code of its own in it:
- The environment is the agent's. The repository is unpacked as a version the way an install does it, and
agent.env(the settings asCALDERA_SETTING_*, the bindings, the documentation area, the board, the Claude access), the connectors file andsecrets.envare written by the same code the runtime uses when Caldera hands these over, all mode 600. They live in a state folder outside the repository,~/.local/state/caldera-dev/<blueprint>/($XDG_STATE_HOMEif set), which keeps the agent'sstatepaths and its inbox between passes, so a second pass knows what is new. The repository is unpacked afresh each pass. - The agent is started as the supervisor starts it (process mode), or asked through its adapter (adapter mode). A compose blueprint is refused.
- A pass ends with the agent's first complete report: its status file, written after the start, lists no
run that is still
active. It also ends after at most 15 minutes (--timeout SECONDSshortens it), and the agent is stopped at the end. If the process ends before it reported, the pass says so and prints the end of its output (exit code 1; 2 when the time ran out; 0 after a report). - The chat is the terminal. The agent's notices and questions are printed; on a terminal a question is answered by the number of an option or by typing (the runtime's own check applies, and the answer reaches the agent through its inbox). Without a terminal a question is printed and left open. Nothing reaches Caldera, Telegram or a mailbox. At the end the findings, the health and the state are printed as the agent's page shows them.
- It writes for real where the configuration points: into the page and the board it names, on the servers its secrets reach. Name test targets, never production ones.
- A dev pass never runs a repair. Where an installed agent would start an action because a finding names
it in
auto_on, the pass printsrepair <name> would run (auto_on: <finding>)and starts nothing. - Secrets stay off the screen. Every value of the configuration (tokens, the Claude key, connector secrets,
secrets) is blanked in what the pass prints, the agent's output included. The state folder and the folders made on the way to it are mode 700. A pass stops an agent an earlier, cut-off pass left, and Ctrl+C, SIGTERM and SIGHUP stop the agent before the command ends. - A status without an active run ends the pass at once. An agent that writes an idle status before it
starts its work ends the pass before the work: write the status after the first run, or list the run as
activefrom the start. A blueprint without astatuspath has no report to wait for: the pass ends when the process ends (exit code 0 if it exited 0, else 1) or after the time limit.
The configuration is a JSON file. The command refuses one that group or others can read, or that lies inside the repository, so a token can never be committed:
{
"settings": { "example_setting": "value of a setting the blueprint declares" },
"documentation": {
"product": "<the knowledge product>",
"page": "<page id, or \"collection\": a collection id>",
"url": "https://<address of that product>",
"workspace": "<workspace id of the TEST area>",
"token": "<token of a bot that may write the TEST page only>"
},
"board": {
"product": "<the board product>",
"board": "<board id>",
"url": "https://<address of that product>",
"workspace": "<workspace id of the TEST board>",
"token": "<token of a bot that may write the TEST board only>"
},
"connectors": [
{ "name": "Test API", "kind": "http", "role": "source", "purpose": "what the agent reads there",
"url": "https://api.example.test", "header": "Authorization", "secret": "Bearer <token of a TEST account>" }
],
"claude": { "plan": "api", "key": "<a Claude key for trying>" },
"secrets": { "SSH_KEY_PATH": "/path/to/a/key/for/a/TEST/server" }
}
Every key is optional except the secrets the manifest declares as required (secrets names them). settings
is checked against the manifest's bounds. A connector is an mcp server or an http API, with a header and
its secret when it needs a sign-in. claude.plan is subscription, business or api.
Publishing a version (caldera publish)
(ADR-0045 D10.) Run from an agent's repository after building the bundle:
export CALDERA_API_TOKEN=… # or --token-file FILE (mode 600)
python3 caldera.pyz publish dist/personal-agent-1.0.3.zip \
--url https://app.calderaapp.io --workspace <workspace id> --deploy personal-agent-pi
It uploads the bundle to the blueprint named in its manifest, publishes the version and, with --deploy,
asks the named agent to move to it. The agent applies it with its next report, checks its health and goes
back by itself if that fails, exactly as for a press in the app.
- The token is a personal access token of an admin with the scope "Publish agent versions"
(
blueprints:write), created on Caldera's Tokens and connections screen, which also shows the workspace id. Never an agent's token (refused locally), never a cookie. It is read fromCALDERA_API_TOKEN, or from the file--token-filenames (refused if group or others can read it); never from the command line. It goes to Caldera's API and nowhere else, is never printed (every printed line is passed through a redactor), no redirect is followed and cleartext is only for localhost. --workspaceis the id. A token addresses only its own workspace and cannot look one up by name.--blueprintis a check, not a choice: it must equal the manifest'sname. The blueprint must exist (a token cannot create one: create it in the app, or by session).- Nothing is released until everything that can be checked is. Locally: the bundle is a zip, at most 20 MB,
with a valid manifest. Then, before the upload: the blueprint exists and the agent named by
--deployexists and runs from this blueprint. A typo in an agent's name costs nothing. - Running it again is safe. A version already published with the same bytes is not uploaded again
(
--deploystill happens); the same version with other bytes is refused, because a published version never changes: raise the version incaldera.agent.yaml. - Refusals are printed in the server's words with the reason, for example
(version_published).
| Exit code | Means |
|---|---|
| 0 | Done. |
| 1 | Caldera refused. The sentence says why and what, if anything, was done before. |
| 2 | This machine refused before asking: arguments, token, bundle. Nothing was sent. |
| 3 | Caldera could not be reached, or answered with an error of its own (5xx). Try again. |
| 4 | The version is published, but the agent was not asked to move to it. |
Findings and actions
An agent reports what is wrong as findings, and may offer named repairs as actions. The checks stay in the agent; the runtime reports, counts and limits.
Findings. In process mode the status file may carry findings: [{key, level: warn|bad, text, since, needs_session?}], in adapter mode adapter status does. The runtime cleans them the way Caldera reads
them (an entry that is not the shape is dropped, a second entry of a key is dropped, key at most 120 and
text at most 300 characters, a level that is not bad is warn, at most 50, bad first). The report
carries findings only when the body is complete: the adapter answered, the status file was read as an
object, or the manifest names no status file. Then the field is always there, [] included, because
Caldera resolves a finding when a report that carries the field no longer has its key. A report without a
body (the adapter timed out or failed, the status file is missing, too large or not an object) leaves
findings out, so one hiccup of the agent resolves nothing.
Actions. The manifest's actions are reported with their limit and the runs used, and the runs
themselves as a short history.
- Running one. Adapter mode:
<command...> action <name>(see the adapter contract). Process mode: the action's owncommandfrom the manifest, in the agent's working directory, with the environment a health command gets (neverCALDERA_TOKEN) plusCALDERA_ACTION=<name>. Both: 30 seconds, exit 0 = done, exit 1 = the agent refuses (a normal answer, its message is the answer), any other exit or a timeout = failed. - Only the name reaches the agent. The command's payload is the name and nothing else. Another key, a name that is not text and a name the manifest does not declare are refused before anything is called, and do not count. A button in Caldera can never push data into an agent.
- The limit is the same for every agent, and counted on the machine. At most 3 runs per action in any
24 hours, a sliding window (no fresh attempts at midnight); a manifest may only lower it
(
actions_limit). A run the agent refused or that failed counts; an attempt the limit stopped does not. The count is kept in a file in the agent's.caldera/directory and survives a restart. - Past the limit nothing runs. The runtime reports the finding
action:<name>:exhausted(levelbad, needs a session) while the limit is full and an attempt was stopped by it. It resolves by itself when the window slides. - Automatic repair is local. An action whose
auto_onnames a key among the agent's own findings starts by itself, decided on the machine, so it happens with Caldera unreachable. The same limit applies, and at most one automatic start per action every 10 minutes. - History. Every run, by Caldera's button, automatic or by hand, is reported with its outcome (
ok,refused,failed,exhausted) and the agent's message.
caldera action lists the actions with the runs left, and caldera action <name> runs one on the machine
(same limit, no connection). Exit 0 done; 1 refused, failed or stopped by the limit; 2 not a declared
action.
Behaviour with Caldera unreachable
- The reporter logs
report failed: ...and tries again at the next interval. Nothing else changes: the agent keeps running, restarts still happen, pause and resume work, the rollback window keeps counting. - A fetch that fails during an update is outcome
failedand is retried after ten minutes. status,pause,resume,rollbackandactionnever open a connection, and automatic repairs run on the machine whether or not a report can be sent.- Stopping the runtime does not stop the agent.
- Only
initneeds Caldera.
Environment variables
| Variable | Used by | Is |
|---|---|---|
CALDERA_URL |
init, publish |
the default for --url |
CALDERA_API_TOKEN |
publish |
the admin's API token (Publishing a version); --token-file wins when given |
CALDERA_REQUEST_TIMEOUT |
run and the local commands |
seconds a request may take; 10 by default, clamped to 1 to 120 |
CALDERA_AGENT_DIR |
every command | the default for --dir (the stack's image sets /data/agent); the agent receives it too, set to its own directory |
CALDERA_STACK |
run |
1 in the container image: the stack's behaviour (the setup script, stopping the agent with the container) |
CALDERA_INSTALL_CODE |
stack |
the one-time install code, read at the first start only; removed from the runtime's environment at every start |
CALDERA_SECRET_<NAME> |
init, stack |
the value for the declared secret <NAME>, for unattended setups |
XDG_CONFIG_HOME |
init |
where the systemd user unit is written (default ~/.config) |
The variables the agent receives are in the table above. Names starting with
CALDERA_ belong to the runtime; a manifest's secrets may not use them.
Security properties
| Property | How |
|---|---|
| The token is private | agent.env and secrets.env are mode 600, written through a temporary file created with that mode from the start, so a secret is never readable in between. .caldera/ is mode 700. |
| The agent never gets the token | CALDERA_TOKEN is removed from the agent's environment. |
| Secrets stay out of logs | Every log line is passed through a redactor for the token and the typed secrets (values of at least 6 characters). |
| No redirects | A redirect would re-send the Authorization header to wherever it points. The protocol has none, so one is refused. |
| No cleartext off this machine | https only, http only for localhost. |
| Errors name no secret | An error carries the HTTP status and the server's error code, never a header, body, token or URL. |
| A bundle is untrusted | Refused whole, leaving nothing, if any entry: has an absolute path, .., a backslash, a drive letter or a NUL; is a symlink, device or other non-regular file; appears twice; lies under .caldera/; or if the archive has more than 5000 entries, unpacks to more than 100 MB (counted while unpacking, not read from headers) or one file to more than 50 MB, or is larger than 20 MB; or lacks a file the manifest names; or its version is not the one asked for. |
| The real path is checked | After resolving, every target must stay inside the directory; every path out of a manifest (workdir, status, logs) is joined through a check on the real path, so a symlink cannot lead a read out of the agent's directory or into .caldera/. |
| The checksum is verified | At install the answer's sha256 must match the bundle. At update the X-Caldera-Sha256 header must match; a missing header means no check, so the runtime relies on Caldera sending it. |
| The runtime update is signed | A runtime file is replaced only after its signature verified against the key built into the running runtime. |
| No shell | runtime.command, health.command, session.command and the adapter's command are argument lists. |
| A session carries no Caldera value | claude gets a whitelist of the runtime's environment; a manifest's own start command adds only CALDERA_SESSION_NAME, the message file's path and the id of the conversation to continue. A first message is a private file, never an argument. |
| A session has an end the runtime does not have to keep | A watchdog ends it at the limit, in a process group of its own; the state is read by pid and start time. |
| The publish token is not an agent's | caldera publish refuses an agent token or install code before sending anything, reads the token from the environment or a mode-600 file, and never prints it. |
| Versions are immutable | A version directory is never edited after it is staged. |
| Dotenv lines are safe | A name or value that would break out of a line (a line break or NUL) is refused. |
What it does not do: it does not encrypt secrets.env (a private file is the
protection), and it does not rotate runtime.log.
Known limits
- Token rotation is manual. Rotating the token in Caldera does not reach the
machine; edit
agent.envand restart (see Operating agents). - No container image of the runtime. The compose runtime calls
docker composefrom the host. - No substitution in
.mcp.json. The runtime ships the file as is and passes the variables in the environment; whatever reads the file resolves${NAME}. - The 30-minute window is fixed.
- A change to a secret means editing
secrets.envby hand and restarting.