A swarm is the set of agents, topics and limits declared by a folder of .cvy files. A run is one execution of that swarm on the server. The swarm is the name; the run is what happens.
Swarms are keyed by name
The label on the swarm block is the swarm’s name: swarm "edge_chips" is edge_chips everywhere. convoy run sends the files to PUT /v1/swarms/edge_chips. Every other command, such as convoy status edge_chips, addresses the swarm by that name. Exactly one swarm block must exist across all files in the folder.
One active run at a time
Each convoy run starts a new run with the next run number. A swarm has at most one active run, meaning one that is Pending or Running.
convoy runon a swarm with an active run is refused withswarm_active. Wait for the run to finish, orconvoy stopit.convoy runon a swarm whose latest run has ended starts run N+1.- A running swarm’s spec never changes. Applying edits to a live run is post-MVP.
History
Finished runs are kept. convoy status edge_chips shows the latest run; convoy status edge_chips --run 1 shows an earlier one. --json prints the same data for scripts. Each run keeps its own spec, spend, agents, outputs and event log, so comparing two runs of the same swarm is a matter of reading two rows.
Run status and end reasons
A run is Pending until the controller’s first pass, then Running, then one of three terminal states. Terminal runs carry an end reason.
| Status | End reason | Meaning |
|---|---|---|
| Done | done | done_when became true |
| Stopped | budget | Spend reached max_cost_usd. Outputs already produced are kept |
| Stopped | max_runtime | Wall-clock time reached max_runtime |
| Stopped | stopped | Someone ran convoy stop |
| Failed | failed | Every agent ended and done_when was still false |
| Failed | server_restart | convoyd restarted while the run was active |
The controller checks these in the order of the table above, so a pass that sees both the budget crossed and done_when true ends the run as budget. When a run ends, every agent still alive is stopped. See budgets and limits.
done_when is evaluated whenever an agent it references finishes, and the server also re-evaluates it on every controller pass. A done_when that cannot be evaluated yet does not end the run.
Where state lives
The files start the swarm. After convoy run, convoyd holds the state: the stored spec, every agent’s status, every topic and message, spend, and the event log, in a SQLite file (--db). Three consequences follow.
- The CLI is stateless. It exits after
convoy run, and the swarm keeps going.convoy watchandconvoy sayattach to the server, not to your files. - Editing
main.cvyafterconvoy runchanges nothing about the running swarm. - Agents created at runtime by the overseer or by an agent with
can_spawnexist only in the server. They are not written back to your files. Exporting a live swarm as.cvyis post-MVP.
For the HTTP surface behind these commands see the HTTP API.