Skip to content

Your First Hour with AgentZero

A hands-on walkthrough that gets all three use cases running: CLI agent, HTTP API, and multi-agent swarm. Every command is copy-pasteable. For deeper explanations, see the Quick Start.


Terminal window
# Option A: pre-built binary
curl -fsSL https://raw.githubusercontent.com/auser/agentzero/main/scripts/install.sh | bash
# Option B: build from source
git clone https://github.com/auser/agentzero.git
cd agentzero
cargo build -p agentzero --release
cp target/release/agentzero ~/.cargo/bin/
Terminal window
agentzero onboard --interactive

Or skip the wizard:

Terminal window
agentzero onboard \
--provider openrouter \
--model anthropic/claude-sonnet-4-6 \
--memory sqlite \
--yes
Terminal window
# Pick one:
export OPENAI_API_KEY="sk-or-v1-..." # OpenRouter
export OPENAI_API_KEY="sk-ant-..." # Anthropic
export OPENAI_API_KEY="sk-..." # OpenAI
# Or save it permanently:
agentzero auth setup-token --provider openrouter
Terminal window
agentzero agent -m "What tools do you have available?"

The agent chains tools automatically — file search, content grep, shell commands:

Terminal window
agentzero agent -m "Find all Rust files containing TODO comments and list them with line numbers"

Watch it work with debug output:

Terminal window
agentzero -vvv agent -m "Summarize the README in this directory"
Terminal window
agentzero status # health check
agentzero doctor models # verify provider connectivity
agentzero tools list # see all available tools

Terminal window
agentzero gateway

You’ll see a pairing code printed at startup. Note it down.

In a second terminal:

Terminal window
# Exchange the pairing code for a bearer token
TOKEN=$(curl -s -X POST http://localhost:42617/pair \
-H "X-Pairing-Code: YOUR_PAIRING_CODE" | jq -r '.token')
echo $TOKEN
Terminal window
curl -s -X POST http://localhost:42617/api/chat \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "What is the capital of France?"}' | jq .

Works with any OpenAI client library:

Terminal window
curl -s -X POST http://localhost:42617/v1/chat/completions \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"model": "default",
"messages": [{"role": "user", "content": "Hello!"}]
}' | jq .

For long-running tasks, submit a job and poll for results:

Terminal window
# Submit
RUN_ID=$(curl -s -X POST http://localhost:42617/v1/runs \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Research the top 5 Rust web frameworks and compare them"}' | jq -r '.id')
# Poll for status
curl -s http://localhost:42617/v1/runs/$RUN_ID \
-H "Authorization: Bearer $TOKEN" | jq .status
# Get the result when complete
curl -s http://localhost:42617/v1/runs/$RUN_ID/result \
-H "Authorization: Bearer $TOKEN" | jq .
EndpointMethodDescription
/healthGETHealth check (no auth)
/pairPOSTExchange pairing code for token
/api/chatPOSTSynchronous chat
/v1/chat/completionsPOSTOpenAI-compatible
/v1/runsPOSTAsync job submission
/v1/runs/:idGETJob status
/v1/runs/:id/resultGETJob result
/v1/runs/:id/streamGETSSE event stream
/ws/chatGETWebSocket chat
/metricsGETPrometheus metrics

Stop the gateway with Ctrl+C, then continue to Part 3.


The business-office example has 7 agents (CEO, CTO, CSO, Marketing, Legal, Finance, HR) and 3 pipelines pre-configured:

Terminal window
mkdir -p ~/agentzero-swarm && cd ~/agentzero-swarm
cp /path/to/agentzero/examples/business-office/agentzero.toml .

Or if you cloned the repo:

Terminal window
mkdir -p ~/agentzero-swarm && cd ~/agentzero-swarm
cp ~/agentzero/examples/business-office/agentzero.toml .

The example uses OpenRouter by default:

Terminal window
export AGENTZERO_API_KEY="sk-or-v1-..."
Terminal window
agentzero gateway

Pair a client (same as Part 2), then test message routing:

Messages are automatically classified and routed to the right agent:

Terminal window
# Routes to CTO (technical keywords)
curl -s -X POST http://localhost:42617/api/chat \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Review the architecture of our API layer"}' | jq .
# Routes to CSO (security keywords)
curl -s -X POST http://localhost:42617/api/chat \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Audit our authentication for vulnerabilities"}' | jq .
# Routes to Marketing
curl -s -X POST http://localhost:42617/api/chat \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Draft a launch campaign for our new product"}' | jq .

Pipelines chain agents sequentially. The example has three built-in:

Terminal window
# Employee Onboarding: HR → CTO → Finance
curl -s -X POST http://localhost:42617/api/chat \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Onboard a new frontend engineer starting next Monday"}' | jq .
# Product Launch: CTO → Marketing → Legal
curl -s -X POST http://localhost:42617/api/chat \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Launch the new API v2 publicly"}' | jq .
# Security Audit: CSO → CTO → Legal
curl -s -X POST http://localhost:42617/api/chat \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Run a security audit on our payment processing"}' | jq .

Edit agentzero.toml to add your own agents:

[swarm.agents.devops]
name = "DevOps"
description = "Handles deployments, CI/CD, infrastructure, and monitoring."
keywords = ["deploy", "ci", "cd", "infrastructure", "docker", "kubernetes", "monitoring"]
provider = "openrouter"
model = "anthropic/claude-sonnet-4-6"
base_url = "https://openrouter.ai/api/v1"
allowed_tools = ["shell", "read_file", "write_file", "web_search"]
subscribes_to = ["task.ceo.directive", "channel.*.message"]
produces = ["task.devops.complete"]
max_iterations = 20
system_prompt = """You are the DevOps engineer. You handle deployments,
CI/CD pipelines, infrastructure provisioning, and monitoring setup."""

Add a pipeline that includes your new agent:

[[swarm.pipelines]]
name = "deploy-and-verify"
channel_reply = true
on_step_error = "abort"
steps = ["cto", "devops"]
[swarm.pipelines.trigger]
keywords = ["deploy", "ship to production", "release to prod"]

Want to…Go to
Learn day-to-day commandsDaily Usage
Set up Telegram/Discord/SlackChannels
Deep dive into swarm patternsMulti-Agent Patterns
Harden for productionProduction Setup
Deploy behind nginx/Caddy/DockerGateway Deployment
Add MCP tool serversMCP Servers
See every config optionConfig Reference
Browse all CLI commandsCLI Commands