Agent SwarmAgent Swarm

Getting Started

Install Agent Swarm, configure your first lead and worker agents, and run your first multi-agent task in minutes

This guide walks you through setting up a fully operational Agent Swarm with a lead agent and workers.

Agent Swarm supports multiple AI providers via the harness system. The default is Claude Code (recommended), but you can also use pi-mono for access to other model backends. See the Harness Configuration guide for details.

Prerequisites

Using Templates

Agent Swarm ships with official templates that give your agents pre-configured identities, skills, and setup scripts. Instead of starting from scratch, pick a template that matches the role you need.

TemplateRoleBest for
LeadleadOrchestrating workers, decomposing tasks, coordinating projects
CoderworkerImplementation, PRs, code reviews
ResearcherworkerWeb research, analysis, documentation
ReviewerworkerCode review, quality assurance
TesterworkerTesting, validation, CI/CD
Forward Deployed EngineerworkerClient-facing work, rapid prototyping

To use a template, set the TEMPLATE_ID environment variable when starting an agent:

# Use the coder template for a worker
TEMPLATE_ID=official/coder docker compose up worker-1 -d

# Use the lead template
TEMPLATE_ID=official/lead docker compose up lead -d

Templates are fetched from the Templates Registry and cached locally for 24 hours. You can also create your own templates and contribute them to the community.

Browse all available templates at templates.agent-swarm.dev.

The fastest way to get a full swarm running. The interactive wizard collects credentials, generates docker-compose.yml + .env, starts the stack, and verifies health.

bunx @desplega.ai/agent-swarm onboard

Or in non-interactive mode with a preset:

ANTHROPIC_API_KEY=sk-... bunx @desplega.ai/agent-swarm onboard --yes --preset=dev

Available presets: dev, content, research, solo. Use --dry-run to preview without writing files.

Option B: Manual Docker Compose

Set up manually with Docker Compose for full control.

git clone https://github.com/desplega-ai/agent-swarm.git
cd agent-swarm

# Configure environment
cp .env.docker.example .env
# Edit .env — set API_KEY and CLAUDE_CODE_OAUTH_TOKEN at minimum
# Optionally set TEMPLATE_ID=official/coder for workers, TEMPLATE_ID=official/lead for leads

# Start everything
docker compose -f docker-compose.example.yml --env-file .env up -d

The API runs on port 3013. The dashboard is available separately (see the Dashboard UI section).

Option C: Local API + Docker Workers

Run the API locally and connect Docker workers to it.

git clone https://github.com/desplega-ai/agent-swarm.git
cd agent-swarm
bun install

# 1. Configure and start the API server
cp .env.example .env
# Edit .env — set API_KEY
bun run start:http

In a new terminal, start a worker:

# 2. Configure and run a Docker worker
cp .env.docker.example .env.docker
# Edit .env.docker — set API_KEY (same as above) and CLAUDE_CODE_OAUTH_TOKEN
bun run docker:build:worker
mkdir -p ./logs ./work/shared ./work/worker-1
bun run docker:run:worker

Option D: Claude Code as Lead Agent

Use Claude Code directly as the lead agent — no Docker required for the lead.

# After starting the API server (Option C, step 1):
bunx @desplega.ai/agent-swarm connect

This configures Claude Code to connect to the swarm. Start Claude Code and tell it:

Register yourself as the lead agent in the agent-swarm.

Verifying Your Setup

Once your swarm is running, you can verify it's working:

  1. Check the API — Visit http://localhost:3013/health
  2. Check agents — Use the dashboard or API to see registered agents
  3. Send a test task — Message the lead agent via Slack or the API

Configuration

Required Environment Variables

VariableDescription
API_KEYSecret key for API authentication
CLAUDE_CODE_OAUTH_TOKENOAuth token for Claude CLI (default provider)

Credential requirements depend on your chosen harness provider. See Harness Configuration for alternatives like ANTHROPIC_API_KEY or OPENROUTER_API_KEY.

Optional Variables

VariableDefaultDescription
PORT3013API server port
HARNESS_PROVIDERclaudeAI provider: claude or pi. See Harness Configuration
AGENT_IDAuto-generatedStable UUID for task resume
AGENT_NAMEAuto-generatedDisplay name for the agent
AGENT_ROLEworkerRole: worker or lead
MCP_BASE_URLhttp://host.docker.internal:3013MCP server URL

For the complete list, see Environment Variables.

Next Steps

On this page