Architecture / MVP

HTTP API

Every convoyd endpoint grouped by resource, with method, path, caller, body, responses and errors, plus authentication and the MCP endpoint.

View .md

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

CallerCredentialIdentity
CLI on the same machineNone, when convoyd listens on loopback and --token is emptyhuman, all runs
CLI otherwiseAuthorization: Bearer <CONVOYD_TOKEN>human, all runs
Runner and overseerAuthorization: Bearer <agent token>, minted when the process startsThat 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.

StatusCodes
400name_mismatch, bad_item (a malformed transcript item)
401missing or revoked token
403wrong run, wrong agent, not_writer, not_parent, overseer_cannot_finish, bad_host, cross_origin, people_only
404unknown swarm, run, agent; topic_not_found
409swarm_active, run_ended, topic_limit, spawn_not_allowed, depth_limit, tools_not_allowed, model_not_allowed, agent_exists
413body_too_large
422invalid bundle (with diagnostics), bundle_version_unsupported, overseer_missing, missing_env, unpriced_model, output_mismatch

Swarms

Method and pathCallerPurpose
GET /v1/swarmsPeople (Web UI)Every swarm with its latest run
GET /v1/whoamiAnyoneWho 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}/runsCLIEvery run of the swarm
POST /v1/swarms/{name}:stopCLI (stop)Stop the active run
GET /v1/swarms/{name}/watch?after=NCLI (watch)SSE event stream
GET /v1/swarms/{name}/graphPeople (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.

  1. If format_version is unsupported: 422 bundle_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-timeout is 504 provider_timeout.
  2. The swarm name in the files must equal {name}, else 400 name_mismatch.
  3. If the swarm’s latest run is pending or running: 409 swarm_active with the run number and status. Nothing changes. Wait for the run to end or call convoy stop.
  4. Resolve the overseer: the swarm’s overseer attribute, else the --overseer-* flags, else 422 overseer_missing.
  5. 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); when max_cost_usd is set, every model, the overseer’s included, has a price (unpriced_model). Unless dry_run is set, every driver plugin the swarm names is started once in check mode; a failure is 422 provider_check_failed with the end of its output, and no run is created.
  6. With dry_run=true, stop here and return 200 with the agent list that would be created.
  7. In one transaction: insert the swarm if new; a run with number = previous + 1 and status pending, recording providers, the type version and digest each provider block resolved to; one agents row per instance, pending; the declared topics plus progress and system; the overseer row. Emit run.created, then topic.created for each topic and agent.created for 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.

  1. Sends every event with seq > N as id: <seq>, event: <type>, data: <json>.
  2. Subscribes to the in-process broadcaster and forwards new events as they commit.
  3. Sends : keepalive every 15 seconds.
  4. 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 pathCallerPurpose
GET /v1/swarms/{name}/agentsCLI, runners, overseerList agents
POST /v1/swarms/{name}/agentsRunners with can_spawn, overseerCreate an agent
GET /v1/swarms/{name}/agents/{a}CLIFull detail
POST /v1/swarms/{name}/agents/{a}:stopCLI, overseer, parentStop an agent and its children
POST /v1/swarms/{name}/agents/{a}/progressRunner (report_progress)Record a progress summary
POST /v1/swarms/{name}/agents/{a}:finishRunner (finish)End the agent with its output
POST /v1/swarms/{name}/agents/{a}/wakeRunnerLong poll for the next turn
POST /v1/swarms/{name}/agents/{a}/watchesRunner (watch_topic)Add a watched topic
POST /v1/swarms/{name}/agents/{a}/transcriptRunnerAppend transcript items
GET /v1/swarms/{name}/agents/{a}/transcriptPeople (Web UI)Read the agent’s transcript
GET /v1/swarms/{name}/agents/{a}/transcript/watchPeople (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:

CodeReason
spawn_not_allowedThe caller’s can_spawn is false
depth_limitThe caller’s depth plus one exceeds 3
tools_not_allowedThe child’s tools are not a subset of its parent’s
model_not_allowedThe child’s provider or model is not the parent’s and no declared agent uses it
agent_existsThe 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}.

  1. The output is checked against the agent’s declared output type. A mismatch is 422 output_mismatch with the path; the agent stays running.
  2. In one transaction: store the output, set done, emit agent.finished.
  3. After commit, signal the controller, which evaluates done_when and the gates.
  4. 200 {status: "done"}. The runner exits after its next wake.

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?}}.

  1. If session differs from the stored ids, store both and emit agent.session.
  2. If last_turn is not null, in one transaction: record the turn with its cost from the price table, set idle, set last_turn_at, emit agent.turn_ended. Then signal the controller to check the budget.
  3. Block on the board. When it returns a turn, set running and emit agent.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 pathBodyPurpose
GET /v1/providers?source=&version=&manifest=true200 [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 MiBInstalls 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:

StatusCodeMeaning
404provider_not_foundNo repository at the address, or no such installed version
409provider_in_useAn active run recorded the version (remove, or a push over it)
409provider_existsA push over a version that came from git
409provider_digest_mismatchThe tag moved since convoyd fetched it; the stored version is kept
422provider_manifest_invalidThe manifest has errors (with diagnostics), is missing, or the package has a symbolic link
422provider_incompatibleThe manifest’s name differs from the address, or a driver plugin supports no runner contract convoyd speaks
422provider_check_failedA driver plugin’s check did not exit 0 or report a supported contract
422provider_version_not_foundNo tag meets the constraint; the message lists up to ten versions
504provider_timeoutA fetch took longer than --provider-timeout; it continues

Topics and messages

Method and pathCallerPurpose
GET /v1/swarms/{name}/topicsCLI, runnersEvery topic: name, description, writers, watchers, count, the caller’s unread
POST /v1/swarms/{name}/topicsRunnersBody {name, description}. Creates the topic and adds it to the caller’s writes
POST /v1/swarms/{name}/topics/{t}/messagesRunners, CLI (say)Body {body, to?, reply_to?}. Appends a message
GET /v1/swarms/{name}/topics/{t}/messages?after=N&limit=MRunners, CLIMessages 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.

ToolREST equivalent
list_topicsGET /topics
read_topicGET /topics/{t}/messages
publishPOST /topics/{t}/messages
watch_topicPOST /agents/{me}/watches
create_topicPOST /topics
list_agentsGET /agents
create_agentPOST /agents, registered only for callers with can_spawn
stop_agentPOST /agents/{name}:stop
report_progressPOST /agents/{me}/progress
finishPOST /agents/{me}:finish, not registered for the overseer
note_progresspublish 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.

Last updated 2026-11-05
esc
    ↑↓ to move · ↵ to open
    Menu
    Get started
    IntroductionInstallQuickstartYour first swarm
    Concepts
    Swarms and runsAgents and turnsTopics and the boardThe overseerSpawning agentsBudgets and limits
    DSL
    Language rulesswarmprovidertopicagentReferences and functionsValidation rules
    Providers
    Provider typesUsing a provider typeWriting a provider type
    CLI
    Overviewconvoy goalconvoy validateconvoy runconvoy statusconvoy watchconvoy sayconvoy stopconvoy uiconvoy provider
    Runtime
    convoydControllerMessage boardRunnerSwarm tools (MCP)Web UIDurability
    Architecture
    OverviewRepository layoutSeams and contractsHTTP API
    Examples
    OverviewWriter and criticResearch teamCode teamPaperBench replicationCommit0 libraryVending-BenchSWE-Lancer bountyτ²-bench loop
    Inspiration
    What we borrowedThe harness landscape