Skip to main content

One log per process

Each process has one output log that holds stdout and stderr interleaved in the order the process wrote them. Every byte has an absolute offset, starting at 0. Each output event carries its offset, its stream (stdout or stderr) and its data. A process on a terminal reports everything as stdout. Process describes the log with two fields: axectl ps shows output_end in its OUTPUT column.

Replay from an offset

To continue after a disconnect, pass the offset one past the last byte you saw. You get exactly the rest of the output.
Attach first sends a started event that describes the process, then the output. With no_follow, it stops after the retained output. It sends exited if the process has finished, and ends without it if the process is still running. If you ask for bytes that were already evicted, you get a gap event with from_offset and to_offset naming the missing range, and the replay continues at the oldest retained byte. axectl prints this as axectl: N bytes of output were dropped on stderr.

Follow a process

Without no_follow, Attach keeps streaming new output and ends with an exited event.
axectl logs always exits 0 once it has printed the output, like docker logs. axectl attach exits with the process’s exit code.

Lossless and lossy readers

Every reader is one of two kinds. You choose with lossy on AttachRequest. Run and axectl exec read losslessly from offset 0, so an attached run never drops output. axectl attach is lossless unless you pass --lossy. axectl logs is always lossy. Each process allows at most 64 lossless readers at once. They include lossless Attach streams, Run streams (also those that repeat a request_id), and following StreamProcessOutput streams of the Agent Substrate API. One more fails with RESOURCE_EXHAUSTED until a lossless reader closes. Lossy readers are not limited. With no lossless reader attached, the log is a ring. A detached process never blocks on output, and axed evicts the oldest bytes as new ones arrive.
A lossless reader that stops reading without closing its stream holds the process back. Use a lossy reader for dashboards and log tailing that must never slow the process.

Retention

Retention is how many of the newest bytes each log keeps. Retention is never below the largest single read from a process, axed --stream-chunk-size (default 64 KiB), so axed raises smaller values to it, including --retain and --max-retain. A retain_bytes above --max-retain fails with INVALID_ARGUMENT. Memory grows only with output the process writes. An idle process holds no output buffer. axectl info and System.Info report default_retain_bytes and max_retain_bytes.

The global output budget

Every process reserves its full retention from a global budget, axed --output-budget (default 256MiB), from the moment it starts until axed forgets it. Every process also takes one of --max-processes slots (default 1024), running or finished. When a new start does not fit, axed evicts the oldest finished process records until it does. If running processes alone hold the whole budget or every slot, the start fails with RESOURCE_EXHAUSTED:
To fit more concurrent processes, lower their retention or raise --output-budget. The budget is never smaller than --max-retain.
Exec and the Agent Sandbox Execute and ExecuteWithLimits buffer their whole output in the response, under two limits. Each stream keeps at most the limit the call asks for, and never more than 256 MiB. All calls running at once also share a second budget, --capture-budget (default 256MiB), on top of --output-budget. When output does not fit either limit, Exec and ExecuteWithLimits keep a prefix of each stream and set stdout_truncated or stderr_truncated instead of waiting. The plain Agent Sandbox Execute has no truncation fields: it fails with RESOURCE_EXHAUSTED when its output is truncated or when its time limit kills the process.

Finished process records

When a process started with Start, Run, Exec with a request_id, the Agent Substrate API or MCP’s run exits, axed keeps its record, so you can still read its output and exit status and reattach by id or name. Records leave in three ways:
  • When more than --max-finished (default 256) records are finished, axed forgets the oldest.
  • When a new start needs budget or a slot, axed forgets the oldest finished records first.
  • You remove it with Processes.Remove (axectl rm). Removing a running process fails with FAILED_PRECONDITION unless you set kill (axectl rm -f).
Once a record is forgotten, its id returns NOT_FOUND, and its name resolves to an older kept process with that name, if there is one. A record axed evicted leaves its request_id behind, so a retry fails with REQUEST_EXPIRED instead of starting the command again. axed does not keep processes started with Exec without a request_id, or through the Agent Sandbox API. Their records vanish as soon as they exit.

Agent Sandbox API

The Agent Sandbox Start stream sends stdout and stderr events with no offsets and no replay, and its process dies when the stream ends. There is no equivalent of Attach. The native API and the Agent Sandbox API share the same budget and process slots.