Lesson 3.1
From one agent to a swarm
A single agent with a long prompt tends to blur roles: the same context window is asked to research, critique, and summarize at once. A swarm splits those roles into separate agents, each with a focused system prompt, and an orchestration pattern that controls how they interact. The result is usually higher quality output and prompts that are far easier to maintain.
Every multi-agent request goes to one endpoint and uses the SwarmSpec schema:
/v1/swarm/completions| Field | What it does |
|---|---|
| name | Identifier for the swarm run |
| description | What this swarm accomplishes |
| swarm_type | The orchestration architecture (the heart of this part) |
| agents | Array of AgentSpec objects; everything from Parts 1 and 2 applies |
| task | The objective the swarm works on |
| max_loops | How many rounds the swarm may run |
| stream | Stream tokens from every agent in real time |
The swarm_type field selects the architecture. You can list every supported value at any time:
/v1/swarms/available/v1/swarms/available