> ## Documentation Index
> Fetch the complete documentation index at: https://axe-engine.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# axed command line

> Every axed flag with its type, default and meaning, plus value syntax, environment variables and signals.

`axed --help` prints the same flags. `axed --version` (or `-V`) prints the version.

## Value syntax

**SIZE** `byte size`

A whole number of bytes, optionally followed by a binary unit: `B`, `K` or `KiB`, `M` or `MiB`, `G` or `GiB`. `K`, `M` and `G` mean the same as `KiB`, `MiB` and `GiB`. Examples: `4096`, `64KiB`, `1M`, `2GiB`. `axed` refuses decimals (`1.5MiB`) and decimal units (`1MB`).

**DURATION** `Go duration`

Go's `time.ParseDuration` syntax. A duration is `0`, or one or more decimal numbers, each followed by a unit: `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`. Examples: `500ms`, `1.5s`, `1h30m`, `.5m`. `axed` refuses negative durations and bare numbers other than `0`. Where a duration is a limit, `0` turns it off.

**BOOL** `boolean`

Flags marked `BOOL` that take a value need one: `--agent-sandbox=false` or `--agent-sandbox false`.

`axed` accepts Go-style single-dash long flags everywhere. It rewrites `-root-dir=/w` to `--root-dir=/w` before parsing, so a command line written for sandboxd works unchanged. Rewriting stops at `--`. It leaves single-letter flags such as `-V` as they are.

Flags marked **sandboxd** have the same name, default and meaning as in sandboxd, except where the flag's entry says otherwise (`--stream-chunk-size`). The rest are AXE additions.

## Listeners and auth

**--listen** `URI, repeatable` (default: tcp\://LISTEN\_HOST:GRPC\_PORT)

An endpoint that serves the gRPC services: AXE's native API (`axe.v1`), gRPC reflection, and the protocol adapters you enable. Forms:

* `tcp://host:port`, for example `tcp://0.0.0.0:9090`. The host must be an IP address.
* `unix:///path`. A stale socket at the path, one nothing answers on, is removed before binding. If a server still answers on it, startup fails instead of taking the socket over. Other file types are left alone and the bind fails. Listing the same path twice fails startup.
* `vsock://cid:port`. Use `any` (or `-1`) as the cid to accept from any context.
* `fd://N`, a listening socket inherited from the parent. `axed` takes ownership and marks it close-on-exec. Startup fails for descriptors 0 to 2 (stdin, stdout and stderr), for a descriptor listed more than once, and for a descriptor that is not a socket in the listening state.

Append `?auth=none` to skip the bearer token on that listener, for channels that are themselves the trust boundary. `?auth=none` is refused on `tcp://` listeners. No other query option exists. On a Unix socket, `?auth=none` creates the socket with mode `0600`, so only its owner can connect. On vsock, `?auth=none` refuses connections from inside the guest (the loopback CID 1, or the guest's own CID), so only the host and other VMs reach it.

When you pass `--listen`, it replaces the default listener and `--grpc-port` is unused. `axed` binds every endpoint before it serves any, and a bad endpoint fails startup.

**--mcp-listen** `URI, repeatable`

An endpoint that serves the [Model Context Protocol](https://axe-engine.mintlify.site/deploy/mcp.md) at `/mcp`: tools for agents to run commands and handle files. Takes the same URIs as `--listen`, including `?auth=none` on non-TCP endpoints, and never shares an endpoint with it. A connection with no request open is closed after 5 minutes; `--grpc-idle-timeout` does not apply. Off unless given; the other APIs are unaffected.

**--listen-host** `IP address or hostname` (default: 0.0.0.0)

**sandboxd.** Interface for the default gRPC listener and the REST listener. `axed` resolves a hostname such as `localhost` to its first address. The empty string means every interface. Use `127.0.0.1` for loopback only.

**--grpc-port** `integer, 1 to 65535` (default: 9090)

**sandboxd.** Port of the default gRPC listener. Ignored when `--listen` is given.

**--rest-port** `integer, 0 to 65535` (default: 8080)

**sandboxd.** Port of the Agent Sandbox REST API, on `--listen-host`. `0` lets the kernel pick; the chosen port appears in the `axed listening` log line. Only bound with `--agent-sandbox=true`. Without `--listen`, it must differ from `--grpc-port` unless it is `0`.

**--auth-token-file** `path`

**sandboxd.** File holding the bearer token, for example a mounted Kubernetes Secret. `axed` trims surrounding whitespace. An empty file fails startup. `axed` keeps only the token's SHA-256 digest in memory. Conflicts with `--auth-token-sha256`.

`axed` reloads the file when anything in its directory changes, which covers an editor replacing it and Kubernetes swapping a Secret's symlinks, and on `SIGHUP`. After a reload the previous token keeps working for 60 seconds, so clients can switch without failed calls. If the file is then empty or unreadable, `axed` logs a warning and keeps the current token. It never logs tokens. See [Rotate the token](https://axe-engine.mintlify.site/deploy/security.md#rotate-the-token).

**--auth-token-sha256** `hex string`

**sandboxd.** Hex SHA-256 digest of the bearer token, 64 hex digits. Conflicts with `--auth-token-file`.

With a token configured, every call needs it except `GET /v1/health` and `GET /readyz` on the REST port and `grpc.health.v1` on every gRPC listener. gRPC reflection needs it too, except on `?auth=none` listeners. Clients send it as `Authorization: Bearer <token>` or `X-Sandboxd-Token: <token>`, as HTTP headers or gRPC metadata. MCP endpoints take only `Authorization: Bearer <token>`. Without a token, `axed` logs a warning at startup when any TCP port is open.

At startup `axed` raises its soft `RLIMIT_NOFILE` to the hard limit, as Go programs such as sandboxd do. Processes it starts get the original soft limit back, as Go's `os/exec` gives them, unless the request sets `open_files`. Open client connections are capped at half that limit, clamped between 16 and 65536. The cap is split evenly among the listeners, with the REST port and each `--mcp-listen` endpoint counting as one, and each gets at least one connection. Connections beyond a listener's share wait in that listener's accept backlog, so clients of one listener cannot use up the connections of another. A gRPC client must complete the HTTP/2 preface and first frame within 10 seconds of connecting.

**--grpc-idle-timeout** `DURATION` (default: 5m)

Close a gRPC connection that has no call open and receives nothing but HTTP/2 keepalive pings for this long, so idle clients do not hold connection slots. A call that stays quiet, such as `Attach` to a silent process, keeps its connection however long it lasts. Clients reconnect on their next call. `0` disables the limit.

## Workspace

**--root-dir** `path` (default: /workspace)

**sandboxd.** Directory that file operations and working directories are confined to. Created if missing. See [File confinement](https://axe-engine.mintlify.site/files/confinement.md).

## Limits and retention

**--retain** `SIZE` (default: 1MiB)

Output kept per process for replay, unless a client asks for more. Raised to at least the chunk size.

**--max-retain** `SIZE` (default: 64MiB)

Most output a client may ask to keep per process. A larger request fails with `INVALID_ARGUMENT` (`LIMIT_EXCEEDED`). Startup fails if `--retain` exceeds it. Raised to at least the chunk size.

**--output-budget** `SIZE` (default: 256MiB)

Ceiling on output retention reserved across all processes. A start evicts the oldest finished processes to fit, and fails with `RESOURCE_EXHAUSTED` when running processes fill it. Raised to at least `--max-retain`.

**--capture-budget** `SIZE` (default: 256MiB)

Ceiling on the output that all concurrent unary executions (`Exec`, `Execute`, `ExecuteWithLimits`) buffer together. Output past it is dropped and marked truncated. Separate from `--output-budget`, so the most process output `axed` holds at once is the sum of the two, 512 MiB by default.

**--max-processes** `integer` (default: 1024)

Most processes tracked at once, running or finished. A start evicts the oldest finished processes to make room, so only running processes can fill it; then a start fails with `RESOURCE_EXHAUSTED` (`BUDGET_EXHAUSTED`). It doubles as a cap on concurrent processes.

**--max-finished** `integer` (default: 256)

Finished processes kept for reattach before the oldest is forgotten.

**--cgroups** `auto | off | required` (default: auto)

Whether to place each process in its own cgroup v2 leaf.

* `auto` uses cgroups when `axed` owns a writable cgroup v2 subtree (it is PID 1, or alone in its cgroup), and otherwise logs `cgroups unavailable; using process groups and rlimits`.
* `off` never uses cgroups.
* `required` refuses to start without them.

When `axed` takes over a cgroup, it removes per-process cgroups left there by an earlier run, killing anything still in them.

Without cgroups, `axed` refuses CPU limits and `System.Freeze`, falls back to rlimits for memory and task limits, and does not detect OOM kills. See [Platform requirements](https://axe-engine.mintlify.site/reference/platform-requirements.md).

**--stream-chunk-size** `SIZE` (default: 0 (64 KiB))

**sandboxd** name, different default and meaning. Largest stdout or stderr read from a process at once. It is a ceiling, not a fixed chunk size. `0` selects 64 KiB. Chunks are whatever one read returns, up to this size. In sandboxd the default is 4096 bytes. See [sandboxd compatibility](https://axe-engine.mintlify.site/reference/sandboxd-compatibility.md#processes).

## Default policies

These apply to every protocol, to each process whose request leaves the limit unset. All are off by default, so axed behaves as sandboxd does. `0` also turns one off. `System.Info` reports them.

**--default-timeout** `DURATION`

Timeout for a process whose request sets none. Counts running time, like a request's own `timeout`. The exit reports `TIMED_OUT`.

**--default-memory** `SIZE`

Memory limit for a process whose request sets none: cgroup `memory.max`, or `RLIMIT_AS` without cgroups.

**--default-max-tasks** `integer`

Task limit for a process whose request sets none: cgroup `pids.max`, or `RLIMIT_NPROC` without cgroups, which the kernel does not apply to root.

**--max-timeout** `DURATION`

Longest timeout a request may set. A request asking for more fails with `INVALID_ARGUMENT` and reason `LIMIT_EXCEEDED`, and the message names this flag. A request that sets no timeout gets `--default-timeout`, or this ceiling without one, so no process outlives it. Startup fails if `--default-timeout` exceeds it.

**--max-memory** `SIZE`

Largest memory limit a request may set, refused the same way. A request that sets none gets `--default-memory`, or this ceiling without one. Startup fails if `--default-memory` exceeds it.

A request over a ceiling is refused, not clamped: a client that asked for more learns it will not get it. The Agent Sandbox `ExecuteWithLimits` time limit counts as a request's timeout, so it must also fit under `--max-timeout`.

## Protecting axed

As PID 1, axed must outlive the processes it supervises. These settings make memory pressure land on them first. See [Security](https://axe-engine.mintlify.site/deploy/security.md#memory-pressure).

**--child-oom-score-adj** `integer, -1000 to 1000` (default: 500)

The `oom_score_adj` each process sets for itself before it execs, so the kernel's OOM killer picks it before axed. Raising it needs no privilege; a value below axed's own needs `CAP_SYS_RESOURCE`. Best effort: a kernel that refuses leaves the inherited value.

**--default-user** `name, uid or uid:gid`

User to run a process as when its request names none, on every protocol. `axed` resolves it at startup and refuses to start if it cannot. For deployments where axed runs as root, such as a microVM's PID 1, so commands run unprivileged unless a request asks otherwise.

Two more need no flag. When `axed` has `CAP_SYS_RESOURCE`, it lowers its own `oom_score_adj` to `-900`, unless something already set it lower. With cgroups and the memory controller, it sets `memory.min` to 16 MiB on its own leaf (`axed`), so reclaim takes the supervised trees' memory first; the kernel honors that only as far as the cgroups above protect memory too.

## Lifecycle

**--on-sigterm** `shutdown | stay` (default: shutdown)

What `SIGTERM` does.

* `shutdown` stops processes and exits.
* `stay` keeps running and sets `eviction_pending` in `System.Health`, so the platform can suspend the sandbox instead of losing it (Agent Substrate's eviction contract).

`SIGINT` always shuts down.

**--shutdown-timeout** `DURATION` (default: 10s)

**sandboxd.** Bound on graceful shutdown.

On shutdown, `axed`:

1. Reports not ready. `GET /v1/health` and `GET /readyz` return 503, `System.Health` returns `ready: false`, and `grpc.health.v1` reports `NOT_SERVING`.
2. Sends `SIGTERM` to every running process group, and kills the remaining trees after 2 seconds or `--shutdown-timeout`, whichever is shorter. Their exits report `SHUTDOWN`.
3. Stops accepting connections and lets open calls finish until `--shutdown-timeout` has passed since step 1, then closes the rest.
4. Exits no later than `--shutdown-timeout` after step 1, even if filesystem work such as a large copy is still running; that work is cut short.

`axed` exits with status 0 after a shutdown, 1 when startup fails or a server stops unexpectedly, and 2 when the command line does not parse. A server that stops unexpectedly triggers the same shutdown sequence first, so running processes are stopped rather than left behind.

## Protocols

**--agent-sandbox** `BOOL` (default: true)

Serve the Kubernetes Agent Sandbox (sandboxd) API: `process.v1` and `watcher.v1` on every gRPC listener, and the REST API on `--rest-port`. With `false`, no REST port is opened. See [Agent Sandbox API](https://axe-engine.mintlify.site/reference/agent-sandbox-api.md).

**--agent-substrate** `flag` (default: off)

Serve Agent Substrate's guest API (`ateenv.v1alpha`) on every gRPC listener. Takes no value. See [Agent Substrate API](https://axe-engine.mintlify.site/reference/agent-substrate-api.md).

`axed` always serves AXE's native API (`axe.v1`), gRPC reflection and `grpc.health.v1` on every gRPC listener. Health needs no token and reports `SERVING` until shutdown starts. Reflection lists only the services enabled by these flags, and needs the token like every other service. See [Native API](https://axe-engine.mintlify.site/reference/native-api.md).

## Logging

`axed` logs to stderr. It uses ANSI colors only when stderr is a terminal.

**--log-format** `json | text` (default: json)

Log format. Without this flag, the format is `text` under `--zap-devel` or `--zap-encoder=console`, and `json` otherwise.

**AXE\_LOG** `environment variable`

A tracing filter, for example `debug`, `axed=debug`, or `info,axe=trace`. When set and valid, it overrides the level from `--zap-log-level` and `--zap-devel`. The default level is `info`.

## Agent Sandbox settings

These flags affect only the Agent Sandbox adapter.

**--metadata-env-prefix** `string` (default: SANDBOX\_)

**sandboxd.** Only environment variables with this prefix appear on `GET /v1/metadata`. The empty string means `SANDBOX_`. Variables whose names contain a sensitive word (`TOKEN`, `SECRET`, `PASSWORD`, `PASSWD`, `CRED`, `KEY`, `AUTH`, `BEARER`, `PRIVATE`, `CERT`, any case) are always left out.

**--http-idle-timeout** `DURATION` (default: 60s)

**sandboxd.** Close REST connections that wait this long for a request, have writes stuck this long (the client stopped reading), or stall an upload this long. Over HTTP/2, a connection with no request open that receives nothing but keepalive pings for this long is closed too. `0` disables the limit.

**--execute-default-time-limit** `DURATION` (default: 0)

**sandboxd.** Time limit for `Execute`, and for `ExecuteWithLimits` calls that set none. `0` means none. `axed` measures it as running time, so suspended time does not count.

**--execute-max-time-limit** `DURATION` (default: 0)

**sandboxd.** Largest `time_limit` a caller may request. When no default is set, calls that set no limit get this one. `0` means no maximum. Startup fails if the default exceeds it.

**--execute-default-stdout-limit-bytes** `SIZE` (default: 0)

**sandboxd.** Stdout bytes kept by `Execute` and `ExecuteWithLimits` when the call sets no limit. `0` falls back to the maximum.

**--execute-max-stdout-limit-bytes** `SIZE` (default: 0)

**sandboxd.** Largest stdout limit a caller may request. `0` means no maximum. Startup fails if the default exceeds a nonzero maximum.

**--execute-default-stderr-limit-bytes** `SIZE` (default: 0)

**sandboxd.** The same as the stdout default, for stderr.

**--execute-max-stderr-limit-bytes** `SIZE` (default: 0)

**sandboxd.** The same as the stdout maximum, for stderr.

Whatever these flags say, unary execution keeps at most 256 MiB per stream. `Execute` has no fields to report truncation or a time limit, so it fails with `RESOURCE_EXHAUSTED` when output is truncated, by these limits or by that cap, and when the time limit is exceeded. `ExecuteWithLimits` reports both outcomes in its response.

## Signals

* `SIGTERM`: shut down, or with `--on-sigterm stay`, report eviction pending.
* `SIGINT`: shut down.
* `SIGHUP`: with `--auth-token-file`, reload the token. Without it, `SIGHUP` keeps its default action.

## zap flags

`axed` accepts controller-runtime's logging flags so a sandboxd pod spec starts it unchanged.

**--zap-devel** `optional boolean` (default: false)

Development logging: `text` format at `debug` level. Write it bare or with `=`: `--zap-devel`, `--zap-devel=false`. Accepts `true`, `false`, `t`, `f`, `yes`, `no`, `y`, `n`, `on`, `off`, `1`, `0`, in any case.

**--zap-encoder** `json | console`

`console` selects the `text` log format and `json` the `json` format, unless `--log-format` is set.

**--zap-log-level** `string or integer`

`debug`, `info`, `warn` or `error` (`dpanic`, `panic` and `fatal` mean `error`), or a verbosity number: `0` is `info`, `1` is `debug`, `2` and higher is `trace`. Overrides the level `--zap-devel` sets. `AXE_LOG` overrides it.

**--zap-stacktrace-level** `debug | info | warn | error | dpanic | panic | fatal`

Accepted and ignored. Hidden from `--help`.

**--zap-time-encoding** `epoch | millis | nano | iso8601 | rfc3339 | rfc3339nano`

Accepted and ignored. Hidden from `--help`.

## Examples

sandboxd's command line, unchanged:

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
axed -root-dir=/workspace -grpc-port=9090 -rest-port=8080 -auth-token-file=/var/run/secrets/token -zap-devel
```

A microVM guest on vsock, with no Agent Sandbox API, as PID 1:

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
axed --listen 'vsock://any:1024?auth=none' --agent-sandbox=false --on-sigterm stay
```

A loopback TCP listener with a token, plus a Unix socket without one:

```sh theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
axed --listen tcp://127.0.0.1:9090 --listen 'unix:///run/axe.sock?auth=none' \
  --auth-token-file /run/token --retain 4MiB --output-budget 1GiB
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.