# Quickstart

> Install Convoy, start the server with one API key, and run your first swarm, in about five minutes.

This guide installs Convoy and runs the smallest example, [writer and critic](/docs/examples/writer-critic/): two agents in a loop that ends when the critic approves. You need macOS or Linux, [uv](https://docs.astral.sh/uv/), and an Anthropic or OpenAI API key.

### Install

The script installs two binaries: `convoy`, the CLI, and `convoyd`, the server.

```sh
curl -fsSL https://raw.githubusercontent.com/convoyharness/convoy/main/install.sh | sh
```

To build from source instead, or to see what else `convoyd` needs, read [install](/docs/install/).

### Start the server

`convoyd` holds every swarm and starts one process per agent. It reads provider keys from its own environment; a swarm names the variable and never contains the key.

```sh
export ANTHROPIC_API_KEY=sk-ant-...   # or: export OPENAI_API_KEY=sk-...
convoyd
```

The first start takes longer, about fifteen seconds on a fast connection, while `uv` downloads Python and the agent SDKs. Leave it running.

### Get the example

In a second terminal:

```sh
git clone https://github.com/convoyharness/convoy
cd convoy/examples/writer_critic
```

The folder is the swarm: [`main.cvy`](/docs/examples/writer-critic/#the-swarm-file) and one Markdown prompt per agent. As written it uses an Anthropic key. For an OpenAI key, change the two lines of the `provider` block to the values in their comments:

```hcl title="main.cvy"
provider "llm" {
  source = "openai_agents"
  model  = "gpt-6.1-sol"
}
```

### Run it

`convoy run` validates the folder, sends it to the server, prints the run and exits. The swarm keeps running on the server.

```console
$ convoy run
swarm "writer_critic" run 1 accepted: 3 agents pending

AGENT     STATUS   PROVIDER  MODEL
critic    pending  llm       claude-sonnet-5-5
overseer  pending  llm       claude-sonnet-5-5
writer    pending  llm       claude-sonnet-5-5

watch with: convoy watch writer_critic
```

### Watch it

`convoy watch` shows the agents and the message board live, and prints the result when the run ends.

```console
$ convoy watch writer_critic
swarm writer_critic   run 1   DONE   elapsed 00:00:39 / 10m   spend $0.10 / $1.00

AGENT     STATUS   TURNS  PROVIDER  SPEND  LAST PROGRESS
critic    done     3      llm       $0.04  Approved the revision at 9/10
writer    stopped  2      llm       $0.03  Revised the draft from the critic's note
overseer  stopped  2      llm       $0.03

run 1 ended: DONE

result  critic
  approved  true
  score     9
  final     A race condition happens when a program's result depends on ...
```

`convoy ui writer_critic` opens the same run in the browser: the graph, the board, and every agent's transcript.

If the key is wrong or its account has no credit, the run ends within seconds as `FAILED`, and the same two commands say why:

```console
run 1 ended: FAILED

failed  critic, writer
  the provider's account has no credit ("Credit balance is too low"). Add credit
  to the account ANTHROPIC_API_KEY belongs to, then run the swarm again.
```

## What just happened

1. The server created three agents: the two you declared and the overseer.
2. Neither the writer nor the critic has `inputs`, so both started at once. The critic found nothing to review and ended its turn.
3. The writer published a draft to `drafts`. The critic `watches` that topic, so the message gave it a turn.
4. The critic published its notes to `review`, which woke the writer. The loop is nothing more than those two `watches`.
5. The critic called `finish` with `approved = true`. `done_when` became true and the run ended **Done**, well inside its one-dollar and ten-minute limits.

## Next
