Skip to content

Architecture ​

adam-rs is a Rust workspace of 48 crates for durable AI agents. An agent is a state machine: the runtime saves its state after every step, so a worker that dies loses nothing and another resumes from the last saved step. Every piece of infrastructure (database, model, code host, A2A backend) sits behind a trait, chosen at build time.

This page is the mental model. Deep dives are linked from each section; decisions are in decisions/. Everything here describes the code as built; third-party claims are marked verified or unverified, and what was checked, when and against which commit is on the architecture's page for agents.

The mental model ​

WordMeaning
RunOne execution of an agent. Its id is the A2A task_id. The runtime keeps its state in RunRecord::state (JSON) and commits every transition with a compare-and-swap on version.
StepOne side effect, ctx.step(name, ..). Its outcome is written to the journal, keyed (run, seq). On replay the recorded outcome is returned and the effect does not run again. The first writer wins; a different step name at the same seq fails the run with NonDeterminism.
LeaseA worker's claim on a due run for a TTL. It avoids wasted work. Correctness is the version compare-and-swap: a worker whose lease expired cannot overwrite newer state.
ConversationAt most one open (runnable or parked) run per (agent, conversation_id), enforced by a unique index. A second message resumes the open run instead of starting another.
PortA trait that a crate defines and others implement (Store, ModelClient, TaskBackend, CodeHost, Environment, Notifier). Swapping is a build-time choice, never a runtime plugin.
SignalA hint over LISTEN/NOTIFY that makes a worker or a step react at once. Never the truth: polling and the store decide.

What survives a crash is the run record and the journal. What does not is anything in memory: live events, streamed text, a lease.

The crate map ​

An arrow means "depends on". Solid arrows are [dependencies]; dotted arrows are optional features. The picture is a selection: nearly every crate also depends on adam-error, and the test kits (adam-store-testkit, adam-notify-testkit, adam-mcp-testkit, adam-code-tools-testkit, adam-agent-fixture) are left out.

LayerCratesJob
Contractsadam-error, adam-core, adam-model, adam-a2a, adam-hostError classes, the Store port and run types, the ModelClient port, the TaskBackend port with the A2A 1.0 server, the process Role and Placement with a supervisor.
Implementationsadam-store-postgres, adam-store-mongodb, adam-store-sqlite, adam-model-openai, adam-model-oauth, adam-workspace, adam-code-tools (the file and command tools as a library, ADR 0047; moving out of the coder in steps), adam-git-sandbox, adam-env-kubernetes, adam-acp, adam-notify-postgresEach in a crate of its own, so a binary links only what it uses.
Runtimeadam-runtime, adam-a2a-runtime, adam-service, adam-schedule (a folder's schedules, ADR 0060: when they are due, the ids of their firings, each agent's scheduler <agent>/adam.schedule and reconcile; adam-agent and the coder run them with a schedules worker component, reconcile_until_stopped, and adam-engine with one reconcile at start)The run state machine, journal, workers and retry policy; the A2A backend over it; the composition every agent binary shares.
Agents and authoringadam-llm-agent, adam-ui, adam-mcp, adam-agent-fs, adam-assembly, adam-macros, adamThe model-and-tools loop; the screen's tools; MCP tools; the agent-folder parser; binding a folder to agents; #[tool]; the facade. See Write an agent.
Embeddedadam-engineadam-rs in an application with no server and nothing on the network of its own (ADR 0047): the embedded set, the runtime and its agent crates with adam-a2a's server, adam-a2a-runtime's push and adam-ui's thread-tools off, checked by tools/embedded-deps/check.sh. Its API (slice 4: send, steer, answer, cancel, list, over RuntimeTaskBackend and a store and a model the host gives) is built; its stream of events is not yet.
Binariesadam-coder, adam-agent, adam-egressThe two agents you can run, library and binary each, over adam-service; and the HTTPS-only egress proxy for run pods, which uses only adam-error and is in the same image; the chart deploys it with the run pods, whose network policy allows nothing else out (ADR 0042).

adam-env-kubernetes also ships the adam-kube-exec binary. adam-git-sandbox ships the server adam-git-sandbox and the relay adam-git, and its client is what adam-workspace sends the coder's local git through: the git commands that carry no credential run in a container that holds no secret, because git runs what a repository's configuration names (see its README; off unless GIT_SANDBOX_SOCKET is set, which the chart does for the coder pod with run pods, running the server as a second container of that pod with the same work volume, the same user and no secret, for ADR 0041's open decision 6: the chart's section). The workspace is crates/* and bin/* (root Cargo.toml): a new crate joins by adding a directory with a README.md.

Ports and implementations &ZeroWidthSpace;

A port is a trait. The core holds a dyn handle (DynStore, DynModel, DynTaskBackend, DynCodeHost, ...) and never names an implementation. Swapping happens in Cargo.toml and in the composition root.

PortDefined inReal implementationsDoubles
Storeadam-corePgStore, MongoStore, SqliteStoreMemoryStore (reference), FaultyStore and CountingStore (testkit)
ModelClientadam-modelOpenAiCompatible (adam-model-openai)MockModel
ModelCredentialsadam-modelStaticBearer (MODEL_API_KEY), DeviceGrant (adam-model-oauth, MODEL_AUTH=device); a host's own: a renewed token, a proof, an injector's tag (ADR 0058)RenewingCredentials
TaskBackendadam-a2aRuntimeTaskBackend (adam-a2a-runtime)InMemoryBackend (feature test-util)
PushStoreadam-a2aStorePushStore (adam-a2a-runtime, over the Store)InMemoryPushStore (feature test-util)
Notifier, EventSinkadam-runtimePgNotifier, PgEventSink (adam-notify-postgres), BroadcastSink (in process)LocalNotifier, NoopSink, CollectingSink
Clockadam-runtimeSystemClockManualClock
Agent, AgentStarteradam-runtimeLlmAgent/LlmStarter, CoderAgent/CoderStartertest agents
Tool, ToolSourceadam-llm-agentthe coder's tools, FnTool, MCP tools, Groups (adam-assembly: the group loaders and their withheld members), ThreadTools (adam-ui)test tools
CodeWorkspaceadam-code-toolsToolEnv (adam-coder: the slots of a run's workspace)DirWorkspace (adam-code-tools-testkit, the reference of its conformance cases)
CodeHostadam-workspaceGitHub (feature github)MemoryCodeHost (feature test-util)
GitCredentialsadam-workspaceScopedToken, GitHubApp (inside HostScoped), StaticTokennone needed
Environmentadam-workspaceLocal, KubeEnvironment (adam-env-kubernetes)a fake API server and exec seam in the tests
CallBeareradam-mcpGitHubReadBearer (adam-coder)test bearers
Admissionadam-budgetLocalAdmission (adam-admission-local): semaphores per pool and per conversation, one token bucketthe conformance suite admission_conformance! is the reference
Confineadam-workspaceRlimits, SystemdScope (adam-confine, Unix); best_effort() picksNoConfine; the suite confine_conformance! (adam-confine-testkit) is the reference
DeviceStateadam-device-statenone yet: the host pushes its readings, and adam_budget::Throttled lowers the admission by them (ADR 0065 decision 8)FakeDevice, the reference of device_state_conformance!
SiMemory (L1)adam-memoryFolderSiMemory, the in-folder store and L1's only one (ADR 0081 decision 2)InProcessSiMemory (reference); ScopeBlindSiMemory and DoubleWritingSiMemory (testkit, which the suite rejects)
PermissionPromptadam-acpnone (the default policy needs no prompt)StaticPrompt

AgentStarter is the start-only half of Agent (name, init, init_continuing): a process that only accepts requests registers a starter and never holds the model or credentials. Workspaces (git) and AcpClient (a child process) are concrete types, not ports.

Rules the code follows:

  • No implementation type appears in a trait signature; a driver error is a boxed source.
  • A store passes the conformance suite store_conformance!; to add a backend, implement Store and add one line (testing).
  • The guarantee is the version compare-and-swap in Store::commit_run, not the lease.

Admission: the budget, the pools and the permit &ZeroWidthSpace;

Before a unit of work starts, it asks the process's Admission for a seat of its Pool (ADR 0065): Pool::ModelCalls around a model call, Pool::ToolCalls around a tool call, and the pools the later slices add for processes, git, MCP servers and command memory. The Permit is released by dropping it, so a cancelled, failed or panicking holder frees its share and nothing releases a permit twice.

WhereWhat it asksA refusal does what
gate::Admitted, wrapping the agent's model clientone seat of Pool::ModelCalls per complete/stream, held until the answer or the stream ends; the tokens it estimates when the budget meters thema full pool is a RateLimited model failure with the refusal's retry_after, so the run waits and then parks (ADR 0061, ADR 0067)
The tool loop (LlmAgent::drive_one)one seat of Pool::ToolCalls per call, held until its work endsthe call waits up to a minute and then runs anyway with a warning: a run never fails because a slot was busy
commands::run (adam-code-tools)one seat of Pool::Processes per command of this container, held until the process is gone, and the command runs confined (below)the command waits up to a minute; past it the tool call fails as retryable (RateLimited) and the run tries again

The ceiling comes from the deployment or the device; a folder's or a person's budget is combined with Budget::lower, which takes the smaller value field by field, so nothing built from it can raise what the deployment allows. In an embedded engine the host's device lowers the admission further, at each ask and never below one run: Engine::set_device_state pushes the readings and adam_budget::Throttled applies the DeviceRules table (a battery below 20 % or in low-power mode admits one Pool::Runs at a time; a Serious or hotter device holds new Pool::ModelCalls and Pool::ToolCalls asks, which the tool loop's wait above then lets through after a minute). LocalAdmission is one process: it persists nothing, and two replicas each admit up to the whole budget (counting them in the store is StoreAdmission, undecided).

Confine: the OS limits on a command &ZeroWidthSpace;

Admission says whether a command may start; the operating system holds it to what it was given. A command of this container takes a seat, then Confine::confine limits it before it starts, and Confined::finish says afterwards whether the OS stopped it (ADR 0065 decision 6). A command stopped for a limit is not an error: the tool result says stopped: memory limit 2 GB and the run goes on, so the model can change approach. adam itself is never stopped.

BackendEnforcesdescribe()
SystemdScopea transient scope per command: MemoryMax, CPUQuota, TasksMax, plus the rlimits below except the address spaceFull, or Partial naming each controller the user manager does not delegate
RlimitsRLIMIT_FSIZE, RLIMIT_NOFILE, RLIMIT_CPU, RLIMIT_AS (Linux), nice 10, a process group; never RLIMIT_NPROCPartial: no CPU share, no process count, address space instead of resident memory
NoConfinenothing (an environment that runs the command elsewhere)None

adam-coder probes at start (adam_confine::best_effort) and logs what is enforced. macOS and Windows backends are not built yet.

Processes and roles &ZeroWidthSpace;

adam-service's serve(ServiceConfig, Agents, shutdown) is the whole process. A binary builds its agent and hands over Agents { name, card, register, options }; serve chooses the store from DATABASE_URL (Postgres, MongoDB or SQLite), connects it, builds the runtime, the A2A router and the signals, and registers the components of the role with an adam_host::Host. main is serve(Config::from_env(), sigterm).

ROLEComponentsNeeds
all (default)a2a-server, worker, notify in one processevery variable
control-planea2a-server, notify, over a runtime that has only the agent's starter and its helpers' starters (AgentDef::session_starters; starts, delivers, cancels and views runs; never steps)DATABASE_URL, A2A_BEARER_TOKENS, PUBLIC_URL; no model, GitHub or workspace variable
workerworker, notify, health (GET /healthz on LISTEN_ADDR, no A2A)everything except A2A_BEARER_TOKENS and PUBLIC_URL
  • The roles meet in the store (the record and its CAS, the leases) and in NOTIFY (below).
  • On SIGTERM Host stops the control plane first (open streams get 10 s), then the workers with no bound, so they finish and commit the steps they are in. A component that stops on its own stops the others in the same order and the process exits 70 naming it.
  • Several adam-agent processes with different folders can share one database: runs are scoped by the agent's name.

The path of a task &ZeroWidthSpace;

A task is a run. A client talks JSON-RPC (or HTTP+JSON: the same handler, below) over HTTP to the server in adam-a2a, which hands the request to a TaskBackend (adam-a2a-runtime); that starts or feeds a run in the Runtime. A worker advances the run one step at a time and commits each step. The client sees progress as events on an SSE stream.

Request in, events out &ZeroWidthSpace;

Rules this diagram cannot show:

  • Fail closed. Only GET /.well-known/agent-card.json, GET /healthz, the docs (GET /docs, its files and GET /openapi.json, unless A2A_DOCS=false) and, when the card is signed, GET /.well-known/jwks.json are public; an empty token list rejects everything (crates/adam-a2a/src/auth.rs).
  • Errors are HTTP 200 with a JSON-RPC error object; the mapping is in Errors.
  • Ownership needs no side table: the caller's subject is part of the run's conversation id (subject:context id). Someone else's task looks like one that does not exist.
  • A request names the extensions it wants; the card decides. The handler passes the backend only the ones the card declares (Caller::extensions), so each extension is optional on both sides.
  • Streams survive restarts. The snapshot comes from Runtime::view (the durable record) and is polled every 2 s; a Status event (a commit) makes the pump poll at once, so live events cut the latency and the interval is only the fallback for a change no event announced. A subscriber that attaches after the worker began first gets the run's recent live events from a bounded replay in BroadcastSink (the newest 64, none older than 30 s, dropped at each status change), so a step that started before it attached keeps its input; a repeat is possible and harmless. Dropping the SSE stream drops only the subscription; only CancelTask cancels.

Follow-ups, referenceTaskIds, steering, steps and streamed text are in the A2A server reference.

The model's profile &ZeroWidthSpace;

A deployment's models differ, so the reasoning level, the output cap and the extra body follow the model a call uses, not the process (ADR 0063, ADR 0064). MODEL_ALIASES_FILE (JSON only for now) holds profiles by model id and presets by name; ModelConfig reads and validates it at startup (crates/adam-service/src/config.rs), and the types are adam_model::ModelProfiles (crates/adam-model/src/profiles.rs). The assembly resolves each agent's default reasoning effort from its folder, its model_preset and the profile (crates/adam-assembly/src/assembly.rs), and resolves and clamps its output cap per model: the folder's limits.max_output_tokens, its preset's, the profile's, the profile's base preset, then 128,000, then the smallest of that, the model's maxOutputTokensLimit and what the window leaves after 20,000 tokens and the agent's history (crates/adam-assembly/src/assembly.rs, output_cap; the margin and the compaction budget are crates/adam-llm-agent/src/compaction.rs). A profile's endpoint is the deployment's own endpoint label for the model — a label only, never a provider, a host, a URL or a key — which a served model-pick/v1 choice carries beside its alias; a malformed one is omitted, never a refusal of the file (ANR-623, crates/adam-model/src/profiles.rs). An embedded engine takes the same profiles from its host (EngineBuilder::models), and its builder's level (EngineBuilder::reasoning_effort) sits between the folder and the preset: the folder's key wins over it, and it over the agent's model_preset and the profile (crates/adam-engine/src/engine.rs, the host's seat; crates/adam-assembly/src/def.rs, the root's fallback; crates/adam-assembly/src/assembly.rs, default_effort). The client sends the level through the model's reasoningWire, after MODEL_EXTRA_BODY and removing only the members the wire would duplicate (crates/adam-model-openai/src/wire.rs); the profile's extraBody is ADR 0064 slice 3.

The tokens of each model call &ZeroWidthSpace;

A completed model call is a RunEvent::Usage, sent to the client as a usage/v1 report when its request activated the extension; a subagent's call is an event of the root run, under the root's step that started it; the totals ride in the agent's state and are written on the task when it ends or waits (ADR 0032, crates/adam-llm-agent/src/agent.rs, crates/adam-a2a-runtime/src/usage.rs).

Nothing new is stored: the totals are the agent's state, which every store keeps. A call of a try that is retried, of a turn a cancel drops or of a remote subagent is in no total (the ADR says why).

The same object carries the compute a run's commands used. A tool reports how long a command ran in a run pod (ToolCtx::report_sandbox); the loop journals it with the call's result, adds it to Conversation::sandbox_usage in the same commit, and a parent adds its child's, as it does the tokens. totals_metadata writes it as the sandbox member beside totals when the task ends or waits: one entry per pod shape (the template's CPU and memory requests) with the commands and their milliseconds, and for a run in the coder's own container only the environment, which reads as not measured and never as zero (ADR 0043, bin/adam-coder/src/tools/sandbox.rs, crates/adam-a2a-runtime/src/usage.rs).

Swagger UI and the REST binding &ZeroWidthSpace;

Every agent serves A2A 1.0 twice over the same BackendHandler: JSON-RPC at POST / and HTTP+JSON at the paths of §11 of the specification (POST /message:send, GET /tasks/{id}, ...; crates/adam-a2a/src/rest.rs). The card lists JSONRPC first and HTTP+JSON second, at the same URL. Swagger UI at /docs documents both from one OpenAPI document (ADR 0031). A person opens it and sends a message over REST:

  • One handler. R->>H is the call the JSON-RPC route makes too, with the same ServiceParams: identity, extensions, push configs, ListTasks and the extended card behave the same on both bindings. A malformed REST request (not JSON, a query string that does not parse, over 10 MiB) gets the binding's envelope (PARSE_ERROR, INVALID_PARAMS, INVALID_REQUEST), never the extractor's plain text.
  • The document is public and the same for everyone: built once from the public card and the switches it shows (push, the extended card, bearer), with no token and nothing of the extended card. Try it out calls the server the page came from (the document's server is .).
  • Streams (/message:stream, /tasks/{id}:subscribe, and their JSON-RPC methods) cannot be watched in Swagger UI, which waits for the whole response; their descriptions give the curl.
  • There is no state diagram: nothing here has a lifecycle (the document and the assets never change while the router runs).

Push notification delivery &ZeroWidthSpace;

Off unless A2A_PUSH_ALLOWED_URLS names the webhooks a deployment allows (ADR 0030). A client registers a webhook for a task (CreateTaskPushNotificationConfig, or in SendMessage); the config and how far its delivery got are kept in the run store, so a restart or another replica loses nothing. A deliverer in the control plane reads the task as its owner and tells the webhook what it has not heard.

Rules this diagram cannot show:

  • A notification is a hint; GetTask is the truth. What a deliverer never saw (a state between two polls, or while every replica was down) is not sent, the next event is the state the task is in, and a webhook may hear one event twice.
  • A failed event is kept whole in the cursor (PushCursor.pending) and sent again as it was, before any later one, so a webhook that was down still hears each state the deliverer saw, in order.
  • Fail closed. The policy is judged at create time and again at delivery; the client resolves names itself, drops private addresses, never follows a redirect and ignores HTTP(S)_PROXY. A token and credentials are write-only (crates/adam-a2a/src/push/sender.rs).
  • Replicas share the work through leases, and the version compare-and-swap, not the lease, keeps a cursor from going backwards. A replaced or deleted config makes the commit of a delivery in flight lose; that request may still have reached the webhook once.

The lifecycle of one config (PushState, crates/adam-core/src/store/push.rs):

ListTasks is one indexed read per page of the run store (Store::list_runs) scoped to the caller's conversations, read as tasks; the extended card and the card's signature are built once when the router is built (crates/adam-a2a/src/server.rs). All of it is in the A2A server reference.

The worker: claim, step, journal, commit &ZeroWidthSpace;

Runtime::run_worker (crates/adam-runtime/src/worker.rs) runs in the same process as the server (all) or alone (worker). Any number of processes can share one database.

  • One step is one model turn. LlmAgent::step calls the model once (journaled step model:N), runs the tools it asked for (each a journaled step tool:<call id>) and returns Continue. A call whose arguments were not JSON is answered from the recorded turn with an error and has no step; a run that reaches max_turns or max_tool_calls makes one more model call with tool_choice: none and ends Done, marked limited. So does a model that makes the same call a third time with the same result and again after the refusal (doom_loop, limit: "repeated_call"). A call that runs past its tool's time limit (300 s unless it says otherwise) is stopped inside its step and answered with an error, which the journal keeps.
  • A hook sits inside the call's step (ADR 0050, slices H1 and H1b). LlmAgentBuilder::hooks/.plugin install a compiled HookSet; its message_received runs in the step that takes a person's message in (message:start, message:<inbound id>: taken only when a set is installed, and recorded as a MessageDecision — the rewritten text, or the refusal), its before_tool after a source's withhold and before the tool, and its after_tool once the tool answered, the last two inside tool:<call id> and all with no Ctx of their own. The call's step records HookedOutput: the output flattened, the decisions that were not Continue (point, verdict, reason, the failing plugin) and the arguments that ran when a hook rewrote them. A replay that finds the step recorded asks no hook. A hook may refuse a message (a start then fails Rejected with the reason; one that arrives while the run works is left out and the task goes on), rewrite the arguments or the text, deny the call, ask a person (slice H8: the run parks on a question, and on yes the call runs once in the journaled step tool:<call id>:approved; a no answers it with the person's words; a child run reads the ask as a denial) or stop the run; one that fails never lets the call or the message through. A rewrite that would change Tool::access is refused, because the schedule above was made from the model's arguments.
  • A tool may emit custom events (ADR 0050, slice H5). It declares each (Tool::events: a name ns.name, a version, a schema, and who may see it) and emits with ToolCtx::emit_event. The emit is recorded with the call's result, in the same step, and delivered from the record after it, so a replay says it again with the same key. An event declared for Hooks (the default) reaches only observers that subscribe to it; one declared for Clients also goes out as a RunEvent::Custom, which an A2A client reads as a data part. A name outside the declared ones, in a core namespace (tool, run, adam, ...), over 4 KiB, or past 16 in a step or 256 in a transition is refused.
  • The calls of a turn run at the same time (ADR 0049), up to max_parallel (10 by default). A tool says what a call shares (Tool::access); calls that conflict keep the model's order, and a call that is Alone, repeats the call before it, or follows a limit of 1 runs by itself, after the calls before it are applied. The seqs of a segment's steps are reserved in call order (Ctx::reserve_steps), so the journal is the one a sequential loop writes, and the results are applied in call order whatever order the calls finish in. A call the model gave after_previous: true (an optional argument the loop adds to every schema above a limit of 1) waits for every call before it and holds the ones after it. A tool that declares nothing is Alone, so a loop of such tools is sequential (adam-coder's classes are in the coder reference). A cancel stops new starts and waits up to 5 s for the running calls; a transient failure stops new starts, waits for the running ones and retries the transition.
  • A call starts while the model writes. The model's client says ModelDelta::ToolCallComplete when a call's arguments are whole, and the loop starts that call beside the stream, before the turn is recorded (src/early.rs is the pure gate, Early in src/agent.rs the batch of started calls). Only a call in the first segment that is no barrier, does not conflict with one already running or with an earlier call of the turn that did not start early, leaves room under max_tool_calls and is not a doom_loop refusal starts; every other call waits for the turn. The turn is still journaled first: model:N when the stream ends, then tool:<call id> at the seqs a sequential loop writes, so a crash mid-stream writes nothing and the replay asks the model again. A stream error waits for the started calls and retries the turn; a cancel waits TOOL_STOP_GRACE for them.
  • Replay is safe, effects are at-least-once. The effect runs before its outcome is written, so a crash in between runs it again. Tools must be safe to repeat.
  • Waking is polling plus hints. An idle worker sleeps at most one poll interval; start and deliver publish Signal::Runnable, cancel publishes Signal::Finished.
  • Messages that arrive during a step are kept; the commit merges them, and a step that asked to park resumes at once.
  • Retry. A transient failure is committed as Runnable with a future wake_at; the failed try's journal entries are abandoned.
  • Defaults (runtime.rs, retry.rs): lease 30 s, worker poll 250 ms, cancel watch 1 s, subscription poll 2 s, 4 concurrent runs per worker loop, 5 tries per transition, backoff 1 s doubling to 60 s.

Compaction: a long history is summarised once &ZeroWidthSpace;

A history that reaches its budget is summarised at a journaled step, so the run goes on in a context that fits and the requests after it keep one cached prefix again (ADR 0044 decision 11, ADR 0039 decision 5). It is decided at the start of LlmAgent::step, from the committed state, and only with no call and no wait open (crates/adam-llm-agent/src/agent.rs, compact_if_due).

PartRule
Budgetthe smaller of MODEL_CONTEXT_WINDOW less 20,000 less max_output_tokens (the cap resolved for the agent's model, ADR 0064), and limits.max_history_tokens; none when neither is set (a window with no room left counts as none)
Estimatethe last call's reported prompt tokens plus characters / 4 of what came after; with no report, characters / 4 of the instructions, the tools and every message
Cutat the start of a turn (an assistant message, never the first message), so a call is never parted from its result; the newest 1 to 8 turns worth at most a quarter of the budget stay verbatim; fewer than two turns to drop, eight compactions made by the run (a run that continues another carries the earlier ones as one record, which is not one of its eight), or a request that would still be over the budget with no summary, shortens instead
Summarythe agent's own model, the request as it stands (same system, tools and history) plus one built-in instruction as the last message, tool_choice: none, min(4,096, cap) output tokens, or 4,096 when the cap is 0 (the run's resolved cap, ADR 0064), capped at 16 KiB; its usage is reported under an id of its own (<run>-k<n>-<suffix>); the person sees one step, "Summarise the conversation"
New historythe task (the first part of the first message) verbatim, then the marker (its second part, Conversation::is_omission_marker), then the person's later messages verbatim (2 KiB each, 8 KiB in all, as parts of that message), then the turns that stayed
The marker's linesthe summary, then lines written by code from what left: the plan, the recap of the loaded tools (one line per loaded group or tool, minus the journaled removals, and one per loader still available; at most 2 KiB and 50 lines, names only past either), the results a tool pinned, a pointer to each kept output (built from the call's own output id), the names of the skills loaded earlier, a line that sessions exist. Text that is copied has each line that starts with [ written \x5b, so it cannot forge a loop line
Sessionsa run whose subagent_start was cut still waits for, and cancels, the sessions it started (Compaction::sessions)
Trustthe summary and the pinned results are in the first message, a user-role message: text a tool returned (a repository's instructions) has that standing from the first compaction on; it is labelled as the repository's, bounded and escaped, and the coder does not read it as the person's words. A when server's note in the recap is labelled (the server's words: …) for the same reason
A subagentcompacts against its own limits; one on another alias has no window, so its max_history_tokens applies

The summary request is the previous request plus one message, so the provider serves it from its cache (unverified without a provider: whether a changed tool_choice keeps the match). The request after a compaction is the first of a new prefix, and Conversation::compactions lists those turns beside shortenings; tests/prefix.rs holds the rule. Rolling back to a build without compaction turns a run that has compacted into a NonDeterminism error.

Signed turns: each assistant and tool turn is signed when it is committed &ZeroWidthSpace;

An LlmAgent given turn keys signs every assistant message and tool result in the step that commits it (ADR 0068, slice T3a-1). The signature names the run, the conversation, the row's position and a hash of every row before it, so a changed, moved or reordered row no longer verifies. A person's message is hashed but never signed. Without keys nothing changes.

Two rules keep a signature true. What is signed is the row as the store keeps it (a NUL is already the replacement character, ADR 0051). And a compaction or a shortening, which moves rows or changes their bytes, clears the signature of every row after the change, so the next commit signs those rows again. A signing failure fails the step: no turn is committed unsigned.

The runtime signs the run's head too (slice T3a-2). At every commit it signs the run, its conversation, how many rows the transcript has, a hash of all of them and the rest of the run's state (the inbox, the owed calls, the summary, the counters). When it reads a run back it recomputes the hash and checks that one signature before the agent runs. Change a field, add or drop a row, or move the run to another conversation and the run fails as corrupt, with no model call. This is on only when the runtime is given keys; without them nothing changes. A run with no signature at all, from before the keys, is accepted and signed at its next commit. If the keys cannot be reached when a run is picked up, the run waits and is tried again; it is not failed for it. A parent that reads a finished child's result checks the child first, and a child that does not check out is reported as failed, never as its forged output.

Every turn is checked too (slice T3a-3). Whenever a run's history comes back from outside the process (a worker picks the run up after a restart, a new task continues the conversation, a session starts its next round, the embedded engine reopens its file), each assistant and tool row of a signed run must carry a signature that verifies where the row stands, over everything before it, with a key that is still in the key set. A forged, unsigned, moved or revoked-key row fails the run before any model call. A history that is carried into a new run is signed again under the new run, so no signature names a run it does not belong to; a compaction and a shortening do the same for the rows they change. A run with no signature at all is still accepted once and signed at its next commit. A runtime that has keys but an agent that does not sign its turns fails the run at its first step, with an error that says to give the agent the same keys, instead of storing a history it could not read back. Reading a run's history back costs one signature check per turn, with no model call behind it when you ask for its state or continue it; polling a task's status does not pay it. Revoking a key makes every run it signed unreadable for good: to retire a key, add its replacement and keep the old one in the set.

The access tier: which tools a step may use &ZeroWidthSpace;

The person picks a tier for each message (plan, edits, auto, bypass; the A2A extension access-tier/v1, ADR 0036). The backend reads it (crates/adam-a2a-runtime/src/tier.rs), the coder keeps to it for what the model does through its tools (bin/adam-coder/src/tier.rs). It is not a boundary against a command: see the ADR, decision 6.

  • The newest message that names a tier wins, from the next step; one that names none leaves it. A larger context never drops the tier (PROTECTED_CONTEXT_KEYS), and a child run starts with its parent's.
  • The reasoning effort follows the same rule (ADR 0063): a message that activated reasoning/v1 writes vymalo.reasoningEffort ({"effort": "<level>"}), the newest message's level is asked for from the next model call, the key is protected like the tier, a child run starts with its parent's, and a compaction/summary call sends none. A level the model's profile does not declare is refused by the front before anything is written.
  • merge_pull_request needs more than the tier: green checks on the commit it merges, and then either the commit is one this conversation pushed (it merges), or the tool asks the person itself in a form of its own and merges on their yes to that form (any other pull request, or one opened with red checks accepted); at bypass it asks nothing. It never reads what the person typed.
  • An agent another agent asked asks nobody for consent. The A2A layer reads who a message was sent for from the claims of its thread-tools token (vymalo.caller: main, or ask:<n> for an agent another agent asked, an unreadable token counting as the latter, and once a message said so for the rest of the run); in such a run request_repository, create_repository and the merge's form return an error result instead of a question, no words are a consent, and the person's words are the ones the orchestrator carries beside the grant (vymalo.person, the person.said member of the thread-tools metadata): only the repositories those name are named, never the ask's text (ADR 0036).

The run lifecycle &ZeroWidthSpace;

RunStatus (crates/adam-core/src/store/mod.rs) has four values: Runnable, Parked, Done, Failed.

The lease is a separate lifecycle that a run goes through each time a worker takes it:

  • What makes a run due. sched_at is derived from status and wake_at (adam_core::store::sched_at):

    Statuswake_atDue
    runnablenoneimmediately
    runnablesetat wake_at (retry backoff)
    parkedsetat wake_at (timers, ctx.sleep)
    parkednonenever; resumed by committing it back to runnable (approval, inbound message)
    done / failed–never
  • Retries. A transient step failure (or a panic) is committed Runnable with wake_at = now + delay and attempt + 1. The delay is the larger of the backoff and the error's retry_after (capped at 24 h). The policy is the failing step's own when it names one, else the runtime's, and the failures are counted per step's key: at that key's max_attempts, at 100 consecutive failures whatever their keys, or for a class the policy does not retry, the run is Failed (ADR 0061).

  • A lease that lapses under a step. The worker passes the run as busy in every claim_due, so the store never leases it to the same worker twice. Another worker may claim it; the CAS rejects the commit that comes second.

  • Store trouble. Corrupt and Invalid fail the run (a row that can never be read must not be leased for ever); any other class commits nothing and keeps the lease.

  • Cancel. Runtime::cancel commits Failed with cancelled: <reason>. A running step is told through its CancelToken (at once in the same process, within one poll from another). Model calls and the coder's commands listen to it.

  • Deliver. Runtime::deliver appends to the inbox; a Parked run becomes Runnable at once. A step that asked for it (Ctx::reopen_on_arrival, which LlmAgent does) is not committed Done past an unread message; a child's adam.run.finished notice does not count (it only saves a waiting parent its timer).

  • Terminal states are Done and Failed; Store::purge_finished deletes them with their journal, and its cutoff must be older than SESSION_IDLE_DAYS: a session reads closed after that idle time, and a purged latest round would make it read wrongly (child runs).

How a run looks to an A2A client (task_state, crates/adam-a2a-runtime/src/convert.rs):

RunA2A task state
Runnable, version 1, no worker holds a leasesubmitted
Runnable, version 1, a worker holds an unexpired lease (RunView::claimed)working
Runnable, or Parked with a timerworking
Parked with no timerinput-required
Donecompleted
Failed with an error that starts cancelled: canceled
Failed otherwisefailed

Runtime::view reads the lease before the head, so a step that commits between the two reads is never shown as submitted again. A front that holds only the starter claims nothing: its tasks stay submitted. A task's id is derived, not random: task_id_for(agent, caller, context, messageId) (crates/adam-a2a-runtime/src/ids.rs), so a repeated SendMessage reaches the task its first attempt made.

Data: the run store &ZeroWidthSpace;

Six tables (PostgreSQL and SQLite) or collections (MongoDB), prefixed adam_ by default, plus a meta table with the schema version: push holds A2A push-notification configurations (schema version 3), blob and run_blob hold a run's file bytes and the digests it references (schema version 5, part 1), and body holds a run's transcript beside the head and head_version of a run (schema version 5, part 2; version 6 on PostgreSQL). The adapters keep them: MongoDB in the run document and the adam_body collection, PostgreSQL in runs.head/runs.head_version and the adam_body table, written in the same transaction as the CAS; SQLite in the same columns as PostgreSQL, in one BEGIN IMMEDIATE transaction. state is JSONB in Postgres, a real BSON document in MongoDB and JSON text in SQLite; in the contract release it is the tombstone (null) for a run whose head is current, and the whole v4 envelope only for a run that has not split yet (ADR 0055). A SQLite file is opened by one process and holds no cross-process signals (store adapters).

IndexPurpose
runs (agent, sched_at, id) where sched_at is setclaiming: due runs per agent, earliest first
unique runs (agent, conversation_id) where the run is openone open run per conversation
runs (agent, updated_at) where finishedretention sweeps
runs (parent_id) where setchildren of a run
runs (agent, conversation_id COLLATE "C", updated_at DESC, id DESC) INCLUDE (status) where setListTasks: an owner's runs, newest first, by keyset; the status filter is answered from the index
push (agent, next_attempt_at, run_id, id) where activeclaiming due push configs
blob (created_at)blob GC: unreferenced blobs older than the cutoff
run_blob (digest)blob GC: does any run still reference this digest
body (run_id, generation, idx)reading one generation in order, and the GC's "which generations of this run" (MongoDB now; index adam_body_generation)
body (written_at)body GC: superseded generations older than the cutoff (MongoDB now)

MongoDB keeps the same fields in adam_runs (_id is the run's UUID) plus open_key (a plain unique index; closed runs get ~<run id>), lease_token, the listing indexes adam_list ((agent, conversation_id, updated_at, _id)) and adam_list_status ((agent, status, conversation_id, updated_at, _id), for a status filter), the journal in adam_journal with _id = "<run>:<seq>", the push configs in adam_push with _id = "<run>:<config id>", the blobs in adam_blob with _id = the digest, the digests a run references in adam_run_blob with _id = "<run>:<digest>", and the transcript in adam_body with _id = "<run>:<generation>:<idx>". A version 4 run document has neither head nor head_version ({head_version: null} matches a missing field). How each adapter keeps its promises: store adapters.

What state holds (JSON, versioned v; the layout is private to the runtime, crates/adam-runtime/src/envelope.rs):

Envelope fieldMeaning
vlayout version: 1 is this envelope, 5 the head (below)
agentthe agent's own state; for an LlmAgent, a Conversation (below). The whole state in v: 1, the head without its messages in v: 5
inboxdelivered, not yet read messages (Inbound { id, kind, payload, received_at })
seq, attempt, revnext journal seq; consecutive failed tries of the run's transitions; bumped by each worker commit
retrywhile a run fails: the failures per step's key and each key's policy, recorded at its first failure; cleared by a transition that succeeds, absent otherwise (ADR 0061)
output, errorthe result of a Done run; the reason of a Failed one
artifactsartifacts emitted so far, committed with their transitions

A file artifact's bytes are written to the blob table under their SHA-256 (adam_runtime::blob_id) and the commit references the digest (RunUpdate::blobs); a v4 state also keeps the bytes, so a reader of the old format still reads a run, while a v5 head names them by digest and size (ADR 0055). Before a v5 head is built by a split, a failed transition or a cancel, every file it inherits is checked with one blob_stored; one whose bytes are gone is left out of the head and its references (logged), because the head cannot store it again. A delivery writes the head it read unchanged, so a later refused split still sees the missing file and refuses rather than demoting without its bytes.

The head and the body, in full

The head and the body (schema version 5, part 2; the contract release) &ZeroWidthSpace;

Every commit writes a head, the body rows it appends and — for a store that keeps bodies — the tombstone as state. Runtime::view is one Store::load_head and no body; Runtime::state is the one full-state read, joining the head and the generation it names: the head names a prefix (len) of the generation, and the rows past it — a lost CAS's extras not yet cleaned up — are ignored, so only a short or non-contiguous prefix is Corrupt.

Store::load_run, load_head, claim_due, open_run_for_conversation and list_runs answer the same document: the head when head_version == version, the whole state otherwise (a v4 run, or a head a later commit did not rebuild). A tombstoned run whose head is behind the version serves the head, the only readable document. The step path joins the head and the rows the claim read; a delivery, a cancel and a park_again write the head they read, so the head stays current and the next split appends to the same generation. The adapters keep the head and the body: MongoDB in the run document and the adam_body collection, PostgreSQL in runs.head/runs.head_version and the adam_body table. A PostgreSQL commit that writes a head or a body is one transaction — the run row locked FOR UPDATE, the version check, the rows, the refs and the CAS — so a foreign attempt's duplicate slot is resolved inside it (identical: adopted; older than the 5-minute orphan grace: collected and retried once; live and different: Conflict). SQLite does the same in one BEGIN IMMEDIATE transaction. The head is the envelope with v: 5, agent reduced to the agent's head, file artifacts by reference, and a body member naming one generation; the rows are the messages.

WhereWhat it holds
state (v: 1, or null)the whole run for a v4 run; null — the tombstone — for a run whose head is current
head (v: 5)agent without its messages, inbox, seq, attempt, rev, output, error, artifacts (files by digest and size), deadline, limit_secs, remaining_secs, agent_wake, hb, and body: {generation, len}
adam_bodyone row per message, keyed (run_id, generation, idx), with written_at for the GC

A generation is append-only: a normal commit writes only the rows after the old head's len and keeps the generation; a compaction (the transcript no longer starts with the old one) writes all rows under a new generation. The delta win now holds across every commit of a v5 run: the contract release's deliver, cancel, park_again and failed commits write the head they read, so the next split appends instead of compacting. (The expand release's headless commits measured 12.7 MB of body rows for 50 × 10 KB against ~0.5 MB of deltas; the measure_the_headless_transcript test keeps that line as the comparison.) The store writes the rows before the CAS with the attempt's writer, checks that all of them landed, and a commit that loses deletes its own rows and refs, so a loser cannot poison the next append. A duplicate slot is resolved by content and age: an identical foreign row is adopted, a differing one older than the 5-minute orphan grace is collected and the insert retried once, and a live attempt's differing row is a Conflict (ADR 0055). The grace is far longer than the insert→CAS gap of a live attempt (milliseconds; the default lease is 30 s), so it distinguishes a dead attempt from a live one without trusting the lease. The runtime reconstructs join(head, rows) before every commit and refuses a split that does not equal the state, which keeps a bad split at state only. A stale head is not an error: the state is served when it is the v4 envelope a v4 commit wrote, and the next step re-splits and rewrites the head; a tombstoned run (state = null, the head behind the version — a pre-S3 process failed a converted run) serves the head, so it stays readable. Runtime::view decodes either document (Stored: v: 1 or v: 5), so an observer of a v4 run and of a v5 one gets the same RunView shape; RunView.state is the agent's head and RunView.artifacts is a Vec<ArtifactRef>, a file by reference. Runtime::state joins the head and body_list(run, generation) (one body read, the only full-state read), and Runtime::artifact_bytes fetches a file's blob once into a bounded, shared cache.

A store that keeps no bodies (Store::keeps_bodies) is not written the contract: the runtime keeps the whole v4 state for it and writes no head, exactly as before. A run's format is per run: a pre-contract run keeps its v4 state and reads as before forever if it never commits again, and its first commit under the contract splits it. A v4 process cannot step a converted run: Envelope::decode refuses a head, the run is committed Failed, and that is why the contract is a separate deploy (see deploy the coder).

Conversation (crates/adam-llm-agent/src/conversation.rs) has messages, turns, tool_calls, usage, pending_calls, pending_wait (a question for the user, a child run or a remote task), deferred, artifacts, announced, source_notes, continued_from, omitted_turns, context and read_ids (the ids of the messages and the forwarded resumes the run read). Every field has a serde default, so older state still loads. Its split puts messages in the body and everything else in the head; Agent::split/join default to no split, and a wrapper that delegates init must delegate them too: a new run of a wrapper that does not stays in the v4 format, and a v5 run must split — a successful step that returns None on a current head is a refused split, so the commit demotes the run to the whole v4 state (a demotion re-reads the head's file digests, so the files keep their bytes) rather than writing the transcript into the head.

Not stored, by design: RunEvents (Status, Progress, Step, TextDelta, ReasoningDelta, Custom, Artifact) are live and may be lost (a short in-memory replay per run covers a late subscriber, see the A2A server); the durable truth is the record. Signals (Runnable, Finished) are hints.

Across processes: signals and events &ZeroWidthSpace;

With the front and the workers in different processes, they share only the database. Left alone, a worker finds a new run at its next poll. adam-notify-postgres closes the gaps over LISTEN/NOTIFY without changing who is right: every notification is a hint, and the run completes with the crate removed, only later. Each process has one PgNotify listening on {prefix}events and {prefix}signals; its PgEventSink is the runtime's event sink and its PgNotifier the notifier.

  • Best effort. publish and emit queue (1 024 items, then drop); a failed pg_notify drops its batch (up to MAX_BATCH_ITEMS, 32 items).
  • No echo. Events carry the sender's id and the listener skips its own; signals have no origin.
  • Size. PostgreSQL rejects a payload of 8000 bytes or more, so nothing over 7 999 is sent. An oversize Status loses the tail of its detail; an oversize Step crosses without its input and output; any other oversize event is dropped.
  • One connection of its own held by the listener (outside the pool): no transaction-mode pooler in front of it.
  • MongoDB has no equivalent on a standalone mongod, so it keeps polling.

The listener's lifecycle (listen_loop in crates/adam-notify-postgres/src/lib.rs). A Resync tells subscribers that notifications may have been lost; the worker then polls at once and re-reads the runs it is stepping.

Child runs &ZeroWidthSpace;

A subagent is a child run: an agent started by a tool of another agent, with its own history, tools and limits, whose final answer is the result of that tool call. The runtime supplies start_child, the adam.run.finished message, Ctx::child_status, Ctx::child_look and ToolError::AwaitRun; no scheduler. A child that parks tells its parent with adam.child.parked, and a parent wakes a child parked on the model through itself (Ctx::resume_child, ADR 0067 decision 5). A child with a conversation (a session round, ADR 0045) reports with adam.child.reported instead, and start_child_continuing starts it (Child runs).

The message is a hint; the parent's timer (wait_poll, 60 s) is the guarantee. A child parked on the model until it is woken is the one wait without a timer: such a child cannot finish on its own, so the parent parks with no timer too and its task says the reason, and a message or a resume to the root wakes the child through it (ADR 0067 decision 5). The child id is derived (child_run_id(parent, key)), so a tool that runs again asks for the same child. Cancelling a parent does cancel its children: a child whose parent is Failed is failed by its own worker, and a child started within a time limit is failed past it (Cancel cascades). A subagent on another A2A agent is the same wait with polling and no message, and a cancel does not reach that task. The failure interleavings, their tests and what the design refuses are in Child runs.

Child sessions &ZeroWidthSpace;

A subagent can also run in the background as a session (ADR 0045): a conversation of child runs ("rounds") in the parent's own conversation, started, read, sent to and closed by five tools that return at once. The parent parks only when a read asks to wait, or when its model answers while a session it started still works or a round ended and was not yet reported. A round that ends meanwhile is told to the model by its next call: the journaled step model:<turn> lists the sessions first and records the reports it appended (reports, no new step). A round that ended during the final call is read at the end of the turn with wait_<turn>, which answers at once and does not park. The sequence, the states and the interleavings are in Child runs.

The sessions of a conversation are limited by SESSION_MAX_OPEN, SESSION_MAX_WORKING and SESSION_MAX_ROUNDS (the root's file may lower them), and a kept-open session idle for SESSION_IDLE_DAYS reads closed: the runtime computes it when it lists or reads, nothing is written. Every role reads the settings. The workers' tools use them today; the A2A front takes them through ChildSessions::with_limits, which nothing calls yet (slice 6 part c wires it, with the root's effective limits) (child runs).

Errors &ZeroWidthSpace;

Every library error enum implements adam_error::Classify: a variant says what happened, its ErrorClass says what to do. Retry loops, the A2A error a client sees and the process exit code decide from the class, never from a variant.

ClassRetryA2A errorExit
Transient, RateLimited, Conflictyes (backoff; retry_after; at once, bounded)-32603 backend temporarily unavailable69
Invalidno-32602 invalid params78
NotFoundno-32001 task not found1
Rejectedno-32602 (-32002 for a cancel)1
Unauthenticated, Unsupportedno-32603 internal error1
Corrupt, Internalno, and alert-32603 internal error70

The tree of enums and the exit codes are in Errors.

Where a run's files and processes live &ZeroWidthSpace;

The coder keeps a workspace per run: <root>/workspaces/<run>/, a directory of slots, each a repository's worktree, a scratch project or a reference (a repository read beside the one the run works on and never written: a detached checkout that a run pod mounts read-only, References). Its commands run through the Environment port: in the coder's own container (Local) or in a Kubernetes pod of the run's own (KubeEnvironment); ADR 0052 removed the third environment, a repository's devcontainer on a container service.

Runs move between workers at every step, but a workspace lives on one worker's disk. The deployer picks a placement (adam_host::Placement, read from WORKSPACE_PLACEMENT; ADR 0002):

WORKSPACE_PLACEMENTWorker rootClaimsNeeds WORKER_ID
shared (default)WORKSPACE_ROOT, one volume for all workersClaimScope::Anyno
affinityWORKSPACE_ROOT/<WORKER_ID>ClaimScope::Pinnedyes
isolatedWORKSPACE_ROOT, a volume of this worker onlyClaimScope::Pinnedyes
a2a-onlynoneAnyrefused by adam-coder

A pinned run keeps an owner next to its lease, set by the first pinned claim and never cleared. A pinned run whose owner is gone is stranded: keep worker ids stable and do not scale pinned workers in. Slots, the environments' sequences and states, and the mirror lock are in Workspace and environments.

The package caches (npm, pnpm, cargo) are not part of a workspace: they are one deployment-level volume at /cache, mounted by every pod that runs toolchains (the coder, its run pods) and shared by all of them, off by default (ADR 0040; chart value cache). Installed trees (node_modules, target/) stay in the workspace.

The kept output of a long command, or of a long MCP result, is a file of the run too: <root>/outputs/<run>/<id>.txt, written by the coder's own process (never by a pod) after the text is scrubbed of the process's secrets, read back by read_output, and removed with the run by the janitor. Nothing of it is in the journal. An agent that is only a folder has no volume: it keeps a long MCP result in the run's own state, up to 4 MiB.

The images a model sees are kept the same way, apart from the text: the history holds an ImageRef (SHA-256, type, size, dimensions, origin) and never a byte. Where the bytes are depends on the agent. The inbound message holds them (and Conversation::pending_images, at most 2 MiB) until the first step reads it. After that the coder has them on its volume, <root>/images/<scope>/<sha256>.<ext>, per conversation, and in the process's memory once a request has read them: the hash is checked on the first read, and the checked bytes are kept for the life of the process (64 MiB in all, oldest first) so a later turn sends them without reading the file again (a file changed after that first read is not re-read). They are never in the journal, the state or the stored record (an MCP image of a server with files: true is also a file artifact and is journaled as every artifact is). An agent that is only a folder keeps them in the run's state (base64, within the 4 MiB it shares with kept outputs) and in the journal of the tool step that kept them, as a kept output is, within a run's 6 MiB of journaled image bytes. Whether they are sent at all is the deployment's word (MODEL_INPUT_MODALITIES): an image is admitted or replaced by a line once, when it enters the history, and what a request sends about it follows the settings now, so the prompt a request starts with only grows while the settings stay. See Images in and the coder.

A command that keeps running (start_command, a development server) writes into the same file as it prints, line by line, after the secrets are scrubbed, and has a record <id>.cmd beside it. The coder holds the process (the worker that started it is its owner and writes a beat into the record at every sweep); the other workers see it through the record, and stop it by writing a stop request that the owner's sweep carries out. A process group is killed whatever ended the leader; what a run starts ends with the run (a process that leaves its group with setsid is the exception). Who stops it, and the lifecycle, are in The coder agent.

A language server (file_diagnostics, find_definition, find_references) is the same kind of process with a pipe on stdin: the coder holds one per run, slot, language and project root on this worker, spoken to in JSON-RPC with Content-Length frames, and stops it where it stops a command that keeps running (the registry is Commands::language_servers(), so the agent's step, the sweep, the janitor and use_repository_environment reach it with no new wiring). There is no record on the volume and no beat: a run that another worker takes up starts a server there (placement shared; affinity and isolated keep a run where it is), and the first worker's server stops by itself when it is idle or its run is over. The tools, the limits and the lifecycle: The coder agent.

The two agents &ZeroWidthSpace;

adam-coderadam-agent
DoesAdam: answers, researches, writes documents, and takes a coding task to a verified pull requestserves any agent folder
Toolsthe coder's 17 own tools (workspace, files, checks, git, pull request) plus the screen's ask_user, show, ui_catalog and the plan's plan_work, plan_check, plan_addthe folder's MCP and skill tools, the screen's and the plan's tools, one per subagent
Needsmodel, GitHub, a workspacea model; no workspace, no GitHub
StatePostgres, plus files under WORKSPACE_ROOTPostgres
Prompt and cardbin/adam-coder/agent (embedded, or ADAM_AGENT_DIR)ADAM_AGENT_DIR, required

Both ship in one image, ghcr.io/vymalo/another-adam-rs/coder; a service that runs a folder overrides the entrypoint with adam-agent. How the coder works: The coder agent. Deploying it: guide. adam-agent has no embedded agent (ADR 0005).