Skip to content

Stateless runs

Use --stateless on abt run and abt dispatch when many callers share one project checkout (container service, read-only image mount, concurrent CLI users).

What you get

abt dispatch -s my_workflow --vars '{"tenant":"acme"}' --stateless
  • Compile and run happen in an automatic temp workspace
  • The project tree is not modified — no writes under <project_root>/target/
  • Run behaviour is unchanged (streaming, exit codes, structured results)
  • Scratch space is deleted when the command finishes

Optional: copy run artifacts before cleanup:

abt dispatch -s my_workflow --stateless --artifact-dir /tmp/out

Configuration

abt compile and abt docs resolve stateless as CLI flag → environment variable → abt.yaml flags:. abt run, abt dispatch and the SDK runner (which abt watch dispatches use) read only the --stateless flag: flags.stateless and ABT_STATELESS do not apply to them.

# abt.yaml
flags:
  stateless: true
abt compile                                   # scratch workspace, from flags.stateless
ABT_STATELESS=0 abt compile                   # disable it for one session
abt dispatch -s my_workflow --stateless       # run and dispatch need the flag on every call

See Project flags.

Flag comparison

Flag Purpose
--stateless Auto temp workspace; project target/ untouched; removed on exit (overrides --workspace)
--workspace PATH Persistent workspace base when not using --stateless (you manage cleanup). run, dispatch
--manifest PATH Skip compile; load pre-built manifest. run, dispatch
--ephemeral Force in-memory checkpoint backend (orthogonal to --stateless)
--no-manifest Compile-only validate mode (abt compile only)

Workspace precedence

When --stateless is active (for abt compile and abt docs, also ABT_STATELESS or flags.stateless):

  • Runtime writes always go to an auto-created temp directory (abt-run-* under the system temp).
  • --workspace, AGENT_WORKSPACE_DIR, and ABT_TARGET_DIR are ignored for execution: writes go to the scratch directory.
  • The temp directory is removed when the command exits unless you copy artifacts out first with --artifact-dir. The export leaves out blobs/, where flags.offload_binary_content keeps the media an agent read.

Without stateless, --workspace PATH (on run and dispatch) selects a persistent workspace base (same as setting AGENT_WORKSPACE_DIR for that invocation).

Containers often combine:

abt dispatch -s my_workflow --vars '{...}' --stateless --ephemeral

Compile cache

Stateless compiles store fingerprints in a shared cache (not in the project target/):

export ABT_COMPILE_CACHE_DIR=/var/cache/abt/compile

Repeated identical --vars reuse cached manifests. See Environment variables.

Limitations

  • Custom handlers and extensions must write under the run's target/ directory, not a cwd-relative target/…. Relative paths resolve against the process working directory and can leak writes into the project checkout during --stateless runs.
  • HITL approval runs need checkpoint and approval-store state that survives scratch cleanup. Stateless mode is fine when both use external backends (e.g. DynamoDB checkpoint + DynamoDB approvals.store). It fails when the checkpoint is memory / --ephemeral, when SQLite defaults would land under the scratch workspace, or when the approval store is in-memory or uses the default SQLite path under <project_root>/target/.
  • Configure approvals.store.backend: dynamodb, or set approvals.store.config.path to a file outside the project target/ tree, for HITL runs in stateless mode.
  • The check runs before anything executes, for abt run -s <agent> and for abt dispatch -s <workflow> (against the workflow's entry agent); an incompatible setup fails with E_STATELESS_APPROVALS.
  • --artifact-dir requires --stateless.

K8s Job example

command: ["abt", "dispatch", "-s", "my_workflow", "--stateless", "--artifact-dir", "/out"]
volumeMounts:
  - name: artifacts
    mountPath: /out

abt dispatch takes the workflow name after -s; to run a single agent use abt run -s my_agent --stateless --artifact-dir /out. Mount the project read-only; write only to /out and the compile cache volume if needed.