Skip to main content
Swarm is configured by CLI flags and swarm.yaml; environment variables are not a configuration source. swarm verify is the only command that runs without a runtime or a token. Every other command targets the runtime’s API and needs a bearer token.

Connecting to the runtime

The runtime exposes one HTTP listener serving health, readiness, /v1/rpc, /v1/ws, and the MCP routes. Its default address is http://127.0.0.1:8081. Configuration is one file format — swarm.yaml — discovered in layers, later layers overriding earlier ones:
  1. user-global $XDG_CONFIG_HOME/swarm/swarm.yaml
  2. project ./swarm.yaml
  3. local operator ./.swarm/swarm.yaml (machine-local overrides; keep it out of git)
  4. explicit --config <path> (or SWARM_CONFIG, the one accepted env pointer)
Flags override config. Ambient environment variables are not a configuration source (see Retired settings).
string
Base URL of the runtime. Default http://127.0.0.1:8081. Config: connection.api_server.
string
File holding the bearer token. Required for every command except swarm verify. Config: connection.api_token_file (client side) / serve.api_token_file (server side). An inline --api-token is not accepted, to keep secrets out of shell history.

swarm run

swarm run start reaches a runtime in one of two ways:
  • Local (default). With no --connect, it boots a runtime in process on 127.0.0.1:8081. Override the port with --api-port <n>.
  • Connected. With --connect <url>, it attaches the run to an already-running runtime (started by swarm serve) instead of booting its own.
Either way, a bearer token is required.

Local startup flags

These flags configure a runtime that swarm serve or swarm run start boots in-process. They have no effect when attaching to a running runtime with --connect.
string
Explicit swarm.yaml config file; overrides the discovered layers listed above, then built-in defaults apply for anything unset.
Older releases read a separate config.yaml next to the running binary. That two-file model was unified into the layered swarm.yaml described on this page.
string
Path to the agent-visible read-only /data reference directory. Resolution order: --data > workspace.data_source in swarm.yaml > the auto-default .swarm/data/ (created next to .swarm/dev.db if it doesn’t exist, so the runtime starts with no /data configuration). Available on both swarm serve and swarm run start.
--store and --backend are documented under Runtime store and LLM backend and credentials.

The configuration file: swarm.yaml

One schema, discovered in layers (later overrides earlier): Keys are trust-tiered: A committed swarm.yaml in a cloned repo cannot expose your machine. The top-level sections (swarm doctor reports which layers loaded and what each supplied):
  • connection.* — CLI target: api_server, api_token_file, contexts
  • serve.* — listeners and server token: api_listen_addr, mcp_listen_addr, api_token_file
  • paths.* — contracts_path, platform_spec_path, prompt and tooling paths
  • store.* / database.* — backend selection and Postgres parameters
  • llm.* — backend profile, model aliases per backend, session rotation, provider rate/concurrency limits, claude_cli settings
  • workspace.* — backend preference, data_source, image settings
  • runtime.* — recovery_on_startup, decision-card cadence (first reminder, urgency, reminder interval, input draft TTL)
  • budget.* — global/per-entity/system monthly caps, human-task budgets
  • sharding.* — parallelism bounds for sharded agent workloads
  • provider_triggers.* / channels.* — pack directories

Runtime section shape

CLI flags override config keys (--store > store.backend, --backend > llm.backend, --data > workspace.data_source). There are no env-var equivalents. See the sections below for each subsystem’s precedence.
Backend selection is --backend or llm.backend only; for the removed spellings, see Retired settings.

Runtime store

The runtime stores events, entity state, gates, timers, and sessions in a relational database. SQLite is the default for local and development runs (file-backed at .swarm/dev.db, no service needed); Postgres is the opt-in backend for external and production deployments. Select the backend with --store sqlite or --store postgres, or store.backend in swarm.yaml; the flag overrides the config key.
string
Runtime store backend: sqlite (local/dev default, file at store.sqlite.path, default .swarm/dev.db) or postgres (external/production opt-in).
object
Postgres connection parameters (used when postgres is selected): database.host, database.port, database.name, database.user, database.sslmode, database.pool_size. Defaults: 127.0.0.1, 5432, swarm, postgres, disable. The password is never read implicitly: declare database.password_env: <VAR> and exactly that named environment variable becomes the accepted source (see Retired settings).

LLM backend and credentials

Select the LLM backend with the --backend flag on swarm serve or swarm run start, or with llm.backend in swarm.yaml. Environment variables never select the backend (see Retired settings). The default backend when nothing is set is anthropic. A flow with no agents boots without any credential. Credentials are read from the environment and a local credential store, and are never logged or persisted. For the removed profile ids, see Retired settings.

Storage

string
Runtime-private root for git repositories written by artifact_repo_commit (a deployment-environment variable, not a config key — one of the few the runtime reads directly). Default /var/lib/swarm/artifacts. Never mounted into agent sessions.

Budget caps

The budget_*_percent thresholds in policy.yaml are percentages of a monthly USD cap, set in the budget: configuration section. A scope is monitored only when its cap is above zero. See Budget and cost.
swarm.yaml

Sharding

When a node fans a workload across multiple instances of an agent (Agent sharding), the sharding: section bounds the parallelism so it cannot run away. The defaults apply when a key is omitted.
swarm.yaml

Retired settings

These spellings are removed and fail with a teaching error naming the replacement: