All state changes go through this API. The CLI, the runners and the overseer use the same endpoints. Paths are under /v1. Request and response bodies are JSON, with snake_case keys, RFC 3339 UTC timestamps and Go duration strings. Request and response types are the structs in the public api package, which the Go client also uses.
Every endpoint under /v1/swarms/{name} names a swarm, not a run. Every GET there accepts ?run=N and defaults to the latest run. Every write acts on the latest run and returns 409 run_ended when that run is terminal, except :stop, which is idempotent, and a transcript append, which is accepted while the agent’s token is valid.
Authentication
| Caller | Credential | Identity |
|---|---|---|
| CLI on the same machine | None, when convoyd listens on loopback and --token is empty | human, all runs |
| CLI otherwise | Authorization: Bearer <CONVOYD_TOKEN> | human, all runs |
| Runner and overseer | Authorization: Bearer <agent token>, minted when the process starts | That agent, in that run |
A missing or revoked token is 401. A token for a run that is not the latest run of {name} is 403. A runner token is revoked when its runner process exits. Agent-only endpoints (progress, finish, wake, watches, and the transcript append) require the token’s agent to match {a}. The Web UI’s reads (the swarm list, the graph snapshot and transcript reads) are for people only: a runner token gets 403 people_only. The sender of every message and the creator of every agent come from the token, never from the body.
Errors
Every error is {"error": {"code": "<snake_case>", "message": "<text>", "diagnostics": [...]}}. diagnostics appears on validation failures, rendered as structured objects with source ranges.
| Status | Codes |
|---|---|
| 400 | name_mismatch, bad_item (a malformed transcript item) |
| 401 | missing or revoked token |
| 403 | wrong run, wrong agent, not_writer, not_parent, overseer_cannot_finish, bad_host, cross_origin, people_only |
| 404 | unknown swarm, run, agent; topic_not_found |
| 409 | swarm_active, run_ended, topic_limit, spawn_not_allowed, depth_limit, tools_not_allowed, model_not_allowed, agent_exists |
| 413 | body_too_large |
| 422 | invalid bundle (with diagnostics), bundle_version_unsupported, overseer_missing, missing_env, unpriced_model, output_mismatch |
Swarms
| Method and path | Caller | Purpose |
|---|---|---|
GET /v1/swarms | People (Web UI) | Every swarm with its latest run |
GET /v1/whoami | Anyone | Who the caller is |
PUT /v1/swarms/{name} | CLI (run) | Create a run from a bundle |
GET /v1/swarms/{name} | CLI (status) | State of the latest run, or ?run=N |
GET /v1/swarms/{name}/runs | CLI | Every run of the swarm |
POST /v1/swarms/{name}:stop | CLI (stop) | Stop the active run |
GET /v1/swarms/{name}/watch?after=N | CLI (watch) | SSE event stream |
GET /v1/swarms/{name}/graph | People (Web UI) | Graph snapshot of a run |
GET /v1/swarms
People only. 200 [{name, runs, latest: {run, status, goal, created_at, started_at, ended_at, end_reason, elapsed_seconds, spend_usd, max_cost_usd, agents_total, agent_counts}}], one per swarm that has a run, the most recent run first. agent_counts maps a status to a count.
GET /v1/whoami
200 {agent, swarm?, run?}: {"agent": "human"} for a person, or a runner token’s agent, swarm and run number.
PUT /v1/swarms/{name}
Body: a bundle.Bundle (format_version, files, env). Query: dry_run=true.
- If
format_versionis unsupported: 422bundle_version_unsupported. Otherwise load the bundle, resolving each provider’s type through the provider store and fetching a version the server does not hold; errors are 422 with diagnostics, and a type that cannot be resolved is TS016 among them. A fetch that takes longer than--provider-timeoutis 504provider_timeout. - The swarm name in the files must equal
{name}, else 400name_mismatch. - If the swarm’s latest run is
pendingorrunning: 409swarm_activewith the run number and status. Nothing changes. Wait for the run to end or callconvoy stop. - Resolve the overseer: the swarm’s
overseerattribute, else the--overseer-*flags, else 422overseer_missing. - Server-side checks, each a 422 with diagnostics: every variable a provider reads, such as its
api_key, is set in convoyd’s environment (missing_env, naming the variable and never a value); whenmax_cost_usdis set, every model, the overseer’s included, has a price (unpriced_model). Unlessdry_runis set, every driver plugin the swarm names is started once in check mode; a failure is 422provider_check_failedwith the end of its output, and no run is created. - With
dry_run=true, stop here and return 200 with the agent list that would be created. - In one transaction: insert the swarm if new; a run with
number = previous + 1and statuspending, recordingproviders, the type version and digest each provider block resolved to; oneagentsrow per instance,pending; the declared topics plusprogressandsystem; the overseer row. Emitrun.created, thentopic.createdfor each topic andagent.createdfor the overseer and each declared agent.
Response: 201 RunResponse{name, run, status, agents, providers}. Each entry of providers is {name, source, constraint, version, digest, kind, runner_version}; version and digest are empty for a built-in type, and runner_version is what a driver plugin’s check reported.
There is no in-place update of a running swarm. A changed bundle takes effect as a new run after the current one ends. Earlier runs, with their boards, outputs and spend, stay readable with ?run=N.
GET /v1/swarms/{name}
200 with the run: name, run, runs_total, status, goal, done_when (source text), max_runtime, max_cost_usd, spend_usd, unpriced_turns, overseer (provider, provider_source, provider_version, driver, provider_sdk, model, config, settings, env, can_spawn, source, price), providers (as in RunResponse), created_at, started_at, ended_at, end_reason, end_detail, elapsed, agent_counts (status to count), and progress (the last 5 messages of the progress topic). 404 if unknown.
end_reason is one of done, budget, max_runtime, failed, stopped, server_restart, or null while active. spend_usd is what actually happened, so a run stopped by its budget can show more than max_cost_usd. This is the body behind convoy status --json.
GET /v1/swarms/{name}/runs
200 [RunSummary{run, status, started_at, ended_at, end_reason, spend_usd}], newest first.
POST /v1/swarms/{name}:stop
Body {reason}. If the latest run is active, stops every non-terminal agent through the controller’s stop path (kills processes, revokes tokens), sets the run stopped with end_reason = stopped, and emits run.ended. Idempotent on a terminal run. 200 with the run.
GET /v1/swarms/{name}/watch?after=N
Server-sent events over one run’s event log.
- Sends every event with
seq > Nasid: <seq>,event: <type>,data: <json>. - Subscribes to the in-process broadcaster and forwards new events as they commit.
- Sends
: keepaliveevery 15 seconds. - Ends after forwarding
run.ended, or when the client disconnects.
The data object is {seq, type, swarm, run, agent, at, payload}. agent.log events are skipped unless logs=1. Event types are listed on convoyd.
GET /v1/swarms/{name}/graph
People only. 200 {seq, run, agents, topics, flows}: one run’s agents (status, parent, input_deps, watches, writes, turns, spend, last tool call), topics (message counts, first and last seq), and message flows (writes per sender and topic, reads per agent cursor with read and unread counts, addressed per sender, topic and recipient), read in one transaction with the event seq they reflect. run is the body of GET /v1/swarms/{name}. A client folds watch?after=<seq> into it to stay current.
Agents
| Method and path | Caller | Purpose |
|---|---|---|
GET /v1/swarms/{name}/agents | CLI, runners, overseer | List agents |
POST /v1/swarms/{name}/agents | Runners with can_spawn, overseer | Create an agent |
GET /v1/swarms/{name}/agents/{a} | CLI | Full detail |
POST /v1/swarms/{name}/agents/{a}:stop | CLI, overseer, parent | Stop an agent and its children |
POST /v1/swarms/{name}/agents/{a}/progress | Runner (report_progress) | Record a progress summary |
POST /v1/swarms/{name}/agents/{a}:finish | Runner (finish) | End the agent with its output |
POST /v1/swarms/{name}/agents/{a}/wake | Runner | Long poll for the next turn |
POST /v1/swarms/{name}/agents/{a}/watches | Runner (watch_topic) | Add a watched topic |
POST /v1/swarms/{name}/agents/{a}/transcript | Runner | Append transcript items |
GET /v1/swarms/{name}/agents/{a}/transcript | People (Web UI) | Read the agent’s transcript |
GET /v1/swarms/{name}/agents/{a}/transcript/watch | People (Web UI) | SSE of new transcript items |
GET .../agents
200 [AgentSummary{name, status, parent, declared, can_spawn, turns, spend_usd, provider, sdk, source, version, model, role_summary, last_progress, started_at, ended_at}], sorted by name. role_summary is the first non-empty line of the prompt, trimmed to 100 characters.
POST .../agents
Body {hcl: string}. Caller must be a runner or the overseer. The HCL must contain exactly one agent block (422 otherwise). It is decoded against the run’s configuration; count and for_each are rejected. Checks, each a 409:
| Code | Reason |
|---|---|
spawn_not_allowed | The caller’s can_spawn is false |
depth_limit | The caller’s depth plus one exceeds 3 |
tools_not_allowed | The child’s tools are not a subset of its parent’s |
model_not_allowed | The child’s provider or model is not the parent’s and no declared agent uses it |
agent_exists | The name is taken |
The child’s tools and settings are checked against its provider’s type, in the version the run recorded; a mismatch is 422 invalid_agent with diagnostics.
For the overseer, tools, provider and model are each checked against the union over declared agents. On success the row is inserted pending with parent set to the caller and declared = 0, agent.created is emitted, and the response is 201 with the AgentSummary. There is no limit on the number of agents; --max-processes bounds concurrency.
GET .../agents/{a}
200 AgentDetail{AgentSummary, spec, progress_reports, turns, output, children, sdk_session_id}. spec.provider is the resolved ProviderSpec: name, source, version, digest, driver, sdk (deprecated), model, config (what the driver receives, never a key), settings (the agent’s resolved settings), env (the variable set in the runner, mapped to the variable read from convoyd’s environment; names only), and price.
POST .../agents/{a}:stop
Body {reason}. Caller must be the CLI, the overseer, or the agent’s parent. Terminal states are idempotent. Stops children first, depth-first, then the agent. 200.
POST .../agents/{a}/progress
Body {summary}, at most 4 KB. Caller must be {a}. Stores the report, updates last_progress_at, emits agent.progress. A stuck agent returns to running. 201 {seq}.
POST .../agents/{a}:finish
Body {output}, JSON, at most 256 KB. Caller must be {a}.
- The output is checked against the agent’s declared
outputtype. A mismatch is 422output_mismatchwith the path; the agent stays running. - In one transaction: store the output, set
done, emitagent.finished. - After commit, signal the controller, which evaluates
done_whenand the gates. - 200
{status: "done"}. The runner exits after its nextwake.
POST .../agents/{a}/wake
Body: {last_turn: {input_tokens, output_tokens, cache_read_tokens, cache_write_tokens, sdk_cost_usd?} | null, session?: {sdk_session_id, last_response_id?}}.
- If
sessiondiffers from the stored ids, store both and emitagent.session. - If
last_turnis not null, in one transaction: record the turn with its cost from the price table, setidle, setlast_turn_at, emitagent.turn_ended. Then signal the controller to check the budget. - Block on the board. When it returns a turn, set
runningand emitagent.turn_started.
An agent with empty watches does not block; it returns at once with continue: true. Responses: {woken: true, continue?, addressed, unread, delta}, {stop: true, reason}, or {woken: false} after 30 seconds. See Message board.
POST .../agents/{a}/watches
Body {topic}. Adds the topic to the agent’s watches. Messages published to it afterward can give the agent a turn; its read cursor is unchanged. Emits agent.watches when the set changes. 201.
POST .../agents/{a}/transcript
Body {items: [...]}, at most 8 MiB. Caller must be {a}. Each item has idx (per agent, from 1), turn, kind (system, input, text, reasoning, tool_call, tool_result or error), at, and the kind’s fields: text, redacted, call_id, tool, input, output, is_error, and truncated with the original bytes when the runner cut it. Items already stored are skipped, so a retried batch stores nothing twice. One agent.tool_called event is emitted per newly stored tool_call while the run is active. 400 bad_item for an unknown kind, idx below 1, a tool_call without tool, or an oversized field. 200 {stored: n}.
GET .../agents/{a}/transcript?turn=T&after=I&limit=L
People only. 200 {items, next} in idx order. limit defaults to 500, at most 2000. next is the after value for the next page, 0 when there is none.
GET .../agents/{a}/transcript/watch?after=I
People only. Server-sent events, one per item: id: <idx>, event: item, data: <item>, with keepalives. Ends once the agent has ended and its runner process has exited.
Provider types
For people only: a runner token gets 403 people_only. The paths carry no source, because an address contains slashes. See Provider types.
| Method and path | Body | Purpose |
|---|---|---|
GET /v1/providers?source=&version=&manifest=true | 200 [ProviderInfo{source, version, digest, kind, origin, created_at, builtin, manifest?}]: the built-in types first, then installed versions by source, newest first | |
POST /v1/providers:resolve | {requirements: [{source, version}]} | Resolves each, fetching a type the server does not hold. Runs no provider code. 200 {providers: [{source, constraint, version, digest, kind, manifest}], errors: [{source, constraint, code, message, diagnostics?}]}; one failure does not fail the others |
POST /v1/providers:pull | {source, version?} | Fetches the highest version that meets the constraint unless it is installed, and checks a driver plugin. 200 ProviderInfo with the manifest and check |
POST /v1/providers:push | {source, version, files: {path: text}}, at most 32 MiB | Installs a package from uploaded files, origin push, then checks a driver plugin. Replaces a pushed version of the same number. 201 ProviderInfo |
POST /v1/providers:remove | {source, version} | Deletes the version’s row and package folder. 200 |
manifest is the type’s compiled manifest as JSON, so a client never parses HCL it did not read from disk. Errors:
| Status | Code | Meaning |
|---|---|---|
| 404 | provider_not_found | No repository at the address, or no such installed version |
| 409 | provider_in_use | An active run recorded the version (remove, or a push over it) |
| 409 | provider_exists | A push over a version that came from git |
| 409 | provider_digest_mismatch | The tag moved since convoyd fetched it; the stored version is kept |
| 422 | provider_manifest_invalid | The manifest has errors (with diagnostics), is missing, or the package has a symbolic link |
| 422 | provider_incompatible | The manifest’s name differs from the address, or a driver plugin supports no runner contract convoyd speaks |
| 422 | provider_check_failed | A driver plugin’s check did not exit 0 or report a supported contract |
| 422 | provider_version_not_found | No tag meets the constraint; the message lists up to ten versions |
| 504 | provider_timeout | A fetch took longer than --provider-timeout; it continues |
Topics and messages
| Method and path | Caller | Purpose |
|---|---|---|
GET /v1/swarms/{name}/topics | CLI, runners | Every topic: name, description, writers, watchers, count, the caller’s unread |
POST /v1/swarms/{name}/topics | Runners | Body {name, description}. Creates the topic and adds it to the caller’s writes |
POST /v1/swarms/{name}/topics/{t}/messages | Runners, CLI (say) | Body {body, to?, reply_to?}. Appends a message |
GET /v1/swarms/{name}/topics/{t}/messages?after=N&limit=M | Runners, CLI | Messages with seq > N, oldest first |
The server supplies the identity and the writes allowlist. A GET of messages from a runner advances that agent’s read cursor to the highest seq returned, and after defaults to the cursor; a read from the CLI does not move any cursor. limit defaults to 50 and is capped at 200. Publish errors are not_writer, topic_not_found and body_too_large. See Message board.
MCP
POST /v1/swarms/{name}/mcp
The Streamable HTTP MCP endpoint for the swarm tools, one instance per active run. Runners reach it through their SDK with the agent’s bearer token. Each tool calls the same Go function as the REST handler for that operation, so identity and permission rules are identical.
| Tool | REST equivalent |
|---|---|
list_topics | GET /topics |
read_topic | GET /topics/{t}/messages |
publish | POST /topics/{t}/messages |
watch_topic | POST /agents/{me}/watches |
create_topic | POST /topics |
list_agents | GET /agents |
create_agent | POST /agents, registered only for callers with can_spawn |
stop_agent | POST /agents/{name}:stop |
report_progress | POST /agents/{me}/progress |
finish | POST /agents/{me}:finish, not registered for the overseer |
note_progress | publish to progress, registered only for the overseer |
Tool errors come back as MCP results with isError: true. Inputs and behavior of each tool are on Swarm tools.