# Overview

> The convoy CLI is a stateless Go binary. Each command reads the current folder or calls the convoyd API. This page lists the commands, global flags, environment, exit codes, and convoyd's own flags.

`convoy` is a single Go binary. It never holds state. Every command either works on the `.cvy` files in a folder or makes one or more calls to the [convoyd](/docs/runtime/) HTTP API. Close the terminal and nothing changes: the swarm lives on the server.

Only one command calls a model directly, [`convoy goal`](/docs/cli/goal/), and it needs no server.

## Commands

| Command | Reads | Calls | What it does |
| --- | --- | --- | --- |
| [`convoy goal`](/docs/cli/goal/) | goal text | a model provider | Writes `main.cvy` and `prompts/*.md` from a goal, validating and retrying. Starts nothing. |
| [`convoy validate`](/docs/cli/validate/) | the folder | `POST /v1/providers:resolve`, only for types that are not built in | Parses and checks every rule. |
| [`convoy run`](/docs/cli/run/) | the folder | `PUT /v1/swarms/{name}` | Validates, sends the bundle, starts a new run, exits. |
| [`convoy status`](/docs/cli/status/) | | `GET /v1/swarms/{name}`, `GET .../agents` | Prints run status, spend, and one row per agent. |
| [`convoy watch`](/docs/cli/watch/) | | `GET /v1/swarms/{name}/watch` | Live agent table above a tail of board messages. |
| [`convoy say`](/docs/cli/say/) | | `POST .../topics/{topic}/messages` | Publishes a message as `human`. |
| [`convoy stop`](/docs/cli/stop/) | | `POST /v1/swarms/{name}:stop` | Stops a run or one agent. |
| [`convoy ui`](/docs/cli/ui/) | | `GET /` | Opens the [Web UI](/docs/runtime/web-ui/) in a browser. |
| [`convoy provider`](/docs/cli/provider/) | a package folder, for some subcommands | `/v1/providers` | Lists, fetches, pushes, removes, checks, and documents [provider types](/docs/providers/). |

## Global flags and environment

These apply to every command.

| Flag | Environment | Default | Meaning |
| --- | --- | --- | --- |
| `--dir` | | `.` | Folder that holds the `.cvy` files |
| `--server` | `CONVOY_URL` | `http://localhost:7070` | convoyd base URL |
| `--token` | `CONVOY_TOKEN` | empty | Bearer token for the server. Not needed when the server is on localhost |
| `--json` | | off | Machine-readable output on stdout. Diagnostics and progress go to stderr |
| `--no-color` | `NO_COLOR` | auto | Disable ANSI color |

Color and terminal width are detected once at startup. Diagnostics wrap at the terminal width, capped at 120 columns.

Provider API keys are not CLI configuration. The CLI never reads or sends them for a swarm: convoyd reads them from its own environment. The one exception is `convoy goal`, which reads `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` from your shell to call the model that writes the swarm.

## Exit codes

| Code | Meaning |
| --- | --- |
| `0` | Success |
| `1` | Runtime error: network failure, a server error, a refused request such as `swarm_active` |
| `2` | Usage error: a missing or unknown flag, a missing required argument |
| `3` | Validation errors in the `.cvy` files, or a server-side 422 with diagnostics |

The proposal says `convoy validate` exits 1 on errors. The CLI RFC separates usage, runtime, and validation failures, and exit 3 is what ships. Scripts should test for `3`.

## Which run

Every swarm is keyed by name, and each `convoy run` starts a new numbered [run](/docs/concepts/swarms/). Commands that read or act on a swarm use the latest run. `status` and `watch` accept `--run N` to read an earlier one. `say` and `stop` always act on the latest run.

## convoyd flags

`convoyd` is the server. Each flag has an environment fallback.

| Flag | Environment | Default | Meaning |
| --- | --- | --- | --- |
| `--port` | `CONVOYD_PORT` | `7070` | Listen port |
| `--db` | `CONVOYD_DB` | `./convoy.db` | SQLite file |
| `--work-dir` | `CONVOYD_WORK` | `./.convoy/work` | Root of agent workspaces |
| `--runner` | `CONVOYD_RUNNER` | the runner built into `convoyd`, started with `uv` | A runner executable of your own to use instead |
| `--token` | `CONVOYD_TOKEN` | empty | The CLI token. Empty means loopback requests need none |
| `--public-url` | `CONVOYD_PUBLIC_URL` | `http://127.0.0.1:PORT` | Address runners use to reach convoyd. Required when runner processes live on another host |
| `--max-processes` | `CONVOYD_MAX_PROCESSES` | `50` | Most runner processes alive at once across all runs, overseers included. Agents beyond it wait in Pending |
| `--no-ui` | `CONVOYD_NO_UI` | off | Do not serve the [Web UI](/docs/runtime/web-ui/) at `/`. `1` or `true` in the environment |
| `--provider-dir` | `CONVOYD_PROVIDER_DIR` | `./.convoy/providers` | Where [driver plugin](/docs/providers/) packages are kept, as `<source>/<version>/` |
| `--provider-timeout` | | `5m` | How long a request waits for a provider fetch or check |
| `--stuck-after` | | `20m` | How long a running agent may show no progress before it is marked Stuck |
| `--debounce` | | `5s` | Board wake debounce |
| `--overseer-provider` | | none | Built-in provider type for the server-wide default overseer: `claude_agent_sdk`, `openai_agents`, or `openai_compatible` |
| `--overseer-model` | | none | Model for the default overseer |
| `--overseer-base-url` | | none | The type's `base_url`, for `openai_compatible` |
| `--overseer-api-key-env` | | none | The type's `api_key`: the name of the environment variable that holds its key |
| `--overseer-can-spawn` | | `true` | `can_spawn` for the default overseer |

The overseer flags are optional. A swarm's own `overseer` attribute wins over them, and a run with neither is refused with `overseer_missing`. See [The overseer](/docs/concepts/overseer/).

## A full session

```console
$ export ANTHROPIC_API_KEY=sk-ant-...
$ convoyd --port 7070 --db ./convoy.db --max-processes 50 \
    --overseer-provider claude_agent_sdk --overseer-model claude-sonnet-5 &

$ convoy goal --provider anthropic --model claude-opus-5 \
    "Write a sourced 10-page market report on edge inference chips"
  wrote ./main.cvy
  wrote ./prompts/research.md
  wrote ./prompts/writer.md
  wrote ./prompts/critic.md
  validate: ok

  agents   researcher[nvidia, groq, cerebras, tenstorrent] -> writer <-> critic
  topics   findings, drafts, review, human

  review the files, then: convoy run

$ convoy validate
validate: ok (6 agents, 4 topics)

$ convoy run
swarm "edge_chips" run 1 accepted: 7 agents pending

AGENT                    STATUS   PROVIDER   MODEL
critic                   pending  anthropic  claude-opus-5
overseer                 pending  anthropic  claude-sonnet-5
researcher[cerebras]     pending  anthropic  claude-sonnet-5
researcher[groq]         pending  anthropic  claude-sonnet-5
researcher[nvidia]       pending  anthropic  claude-sonnet-5
researcher[tenstorrent]  pending  anthropic  claude-sonnet-5
writer                   pending  openai     gpt-6.1-sol

watch with: convoy watch edge_chips

$ convoy watch edge_chips
$ convoy say edge_chips human "Skip Tenstorrent, focus on the other three"
published seq 41
$ convoy status edge_chips
$ convoy stop edge_chips
```

## Next

- [Quickstart](/docs/quickstart/) runs this session end to end.
- [Validation rules](/docs/dsl/validation/) lists every check `validate` makes.
- [convoyd](/docs/runtime/) describes what the server does with a run.
