What CAO Does
From one agent doing everything serially to a team of agents working in parallel — orchestrated by infrastructure, not magic.
The Problem
You have 3 features to build, one AI agent, and a deadline breathing down your neck. The agent works on Feature A... finishes... moves to Feature B... finishes... then Feature C. Each feature takes 10 minutes. That is 30 minutes of serial execution.
Now imagine: what if you could spin up 3 agents simultaneously, each working on a different feature in its own isolated terminal? All three finish in 10 minutes. Same work, one-third the wall-clock time.
That is exactly what CAO does.
CAO is not another AI model — it is infrastructure that lets any CLI-based AI agent work as part of a team. It handles process management, message routing, and lifecycle — so the agents can focus on code.
The Supervisor-Worker Pattern
Think of an air traffic control tower. The controller does not fly the planes — it assigns runways, sequences takeoffs, and resolves conflicts. The pilots (agents) do the actual flying. CAO's supervisor works the same way: it reads your task, breaks it into sub-tasks, and delegates each one to a worker agent.
The supervisor never writes code directly. It thinks in terms of delegation — "worker-1 handles the API route, worker-2 writes the tests, worker-3 updates the docs" — then monitors their progress through an MCP-based message system. When all workers report done, the supervisor synthesizes results and reports back to you.
What Happens When You Type cao launch
Five concrete steps, from your terminal to a running agent:
The cao CLI is a thin client. It sends your launch request to the locally running cao-server.
cao-
Each orchestration run gets its own isolated session (e.g., cao-a1b2c3d4) so multiple runs never collide.
The provider (e.g., Claude Code, Kiro CLI, Codex) starts in its own window — just like you would run it manually, but automated.
Profiles define the agent's role ("you are a code reviewer"), available tools, and constraints. This is how the supervisor knows it should delegate, not code.
You can watch the supervisor think, see workers appear in new windows, and even interact with any agent mid-task via tmux.
Quick Start
Install CAO and launch your first orchestrated agent in under a minute:
# Install CAO uv tool install cli-agent-orchestrator # Start the server (leave running) cao-server # Launch a supervisor agent cao launch --agents code_supervisor \ --provider claude_code
Multiple providers supported — swap --provider claude_code for kiro_cli, codex, copilot_cli, cursor_cli, and more.
The orchestration layer does not care which AI model runs inside the terminal. If it has a CLI, CAO can manage it.
Key Terms
tmux
A terminal multiplexer that lets multiple terminal sessions run independently inside a single window. CAO uses it to isolate each agent.
Session
A named tmux session (prefixed cao-) that groups all agent windows for a single orchestration run.
Terminal
A tmux window within a session where a single agent process runs. Each agent gets its own terminal.
Provider
A supported AI CLI tool (Claude Code, Kiro CLI, Codex, Copilot CLI, Cursor CLI, etc.) that CAO can launch and manage as an agent process.
Profile
A configuration file that defines an agent's role, system prompt, available MCP tools, and behavioral constraints.
MCP
Model Context Protocol — the standard interface agents use to call tools (like assign() and send_message()) exposed by the CAO server.
The Cast of Characters
Five components, each with a single job. Together they turn one CLI command into a fleet of cooperating agents.
Architecture at a Glance
Five components, three layers. Your commands flow down; agent results flow back up.
Agents also have access to a memory system — a persistent store that survives across sessions. Agents call memory_store to save learnings and memory_recall to retrieve them later. Memory is scoped (global, project, session, or per-agent) so knowledge stays organized. Think of it as the team's shared notebook.
Meet Each Component
cao CLI
User interface. Click-based Python CLI with commands like launch, session, profile, shutdown.
cao-server
State manager. FastAPI on port 9889 handling sessions, terminals, inbox, and the SQLite database.
src/cli_agent_orchestrator/api/cao-mcp-server
Agent toolbox. Exposes handoff, assign, send_message, memory_*, load_skill via FastMCP.
tmux backend
Process isolation. Creates sessions/windows per agent, runs pipe-pane to capture output into FIFOs.
Event Bus
Async glue. Pub/sub connecting FifoReader, StatusMonitor, and InboxService without polling.
src/cli_agent_orchestrator/services/event_bus.pyHow They Connect
Module 1 showed the high-level steps. Now let's see the same launch at the component level — which piece talks to which, and in what order:
Code: The CLI Entry Point
click library for building CLI commands.commands/ folder.cao command group.cao deploy) means creating a file in commands/ and adding one add_command line here.Each command is a separate file in cli/commands/. The main file only wires them together. This means you can add new CLI commands without touching existing ones.
How Agents Talk
Three orchestration tools. Each creates a different collaboration style between supervisor and workers.
Three Tools, Three Styles
CAO gives agents exactly three MCP tools for inter-agent communication. Each one creates a distinct interaction pattern between supervisor and worker, matching a real-world collaboration style.
Master these three and you understand everything about how CAO agents coordinate.
handoff()
Sync. Blocks until the worker finishes. Auto-deletes on success.
assign()
Async. Returns immediately. Worker reports back later via inbox.
send_message()
Direct. Delivers to an existing agent's inbox. No new terminal.
The Key Difference
handoff = Blocked
Supervisor waits. Nothing else happens until the worker finishes or the 10-minute timeout hits.
Use when: the next decision depends on the result.
assign = Free
Supervisor continues immediately. Can fire multiple assigns back-to-back for parallel work.
Use when: tasks are independent and can run simultaneously.
# mcp_server/server.py (simplified)
worker_message = message + "[...reply to me with send_message]"
terminal_id, _ = _create_terminal(
agent_profile=agent_profile,
initial_message=worker_message,
defer_init=True,
)
return {"success": True, "terminal_id": terminal_id, ...}
Append a note telling the worker where to reply...
Create a new terminal for this agent...
with the task plus that reply instruction...
but DON'T wait for it to start.
Return the worker ID immediately.
Match the Patterns
Drag each chip into the correct zone:
handoff()
assign()
send_message()
When to Use What
Real orchestration decisions come down to one question: does the supervisor need the result right now, or can it keep working? Pick the right tool for each scenario.
1. You need a code review before merging — the result determines your next step.
2. You want 5 workers building different microservices simultaneously while the supervisor plans the integration.
3. A worker finished its task and needs to tell the supervisor it's done.
Running Your Own Agents
From install to your first multi-agent session in 5 minutes.
From Zero to Multi-Agent in 5 Minutes
Python 3.10+, tmux, and at least one AI CLI agent (Claude Code, Kiro CLI, or Codex). CAO requires macOS or Linux — tmux is not available on Windows.
Six commands take you from nothing installed to a fully running multi-agent session:
uv tool install cli-agent-orchestrator — Downloads the CAO binary and all dependencies in one shot.
cao-server — Launches the FastAPI orchestration service. Keep this terminal open; everything else talks to it.
cao launch --agents code_supervisor --session-name demo --provider claude_code — Creates a tmux session and starts the supervisor agent inside it. The session is named cao-demo — CAO prefixes every session with cao-.
cao session status cao-demo --workers — Shows the session state: which agents are running, idle, or finished.
cao session send cao-demo "Add unit tests" — Types a new task straight into the supervisor's terminal. The agent must be idle; if it is still working, the command tells you to wait.
cao shutdown --all — Terminates all agent tmux sessions and cleans up terminal records. The server keeps running.
Run cao update to pull the latest version. Use cao profile list to see all available agent profiles on your machine.
Anatomy of a Profile
Profiles are markdown files with YAML frontmatter. They live in a standard directory:
cao install
---
name: code_supervisor
description: Coding Supervisor Agent
provider: claude_code
role: supervisor
---
You are a supervisor. Delegate to
`developer` and `reviewer` profiles.
name — Unique identifier passed to --agentsdescription — Human label shown in cao profile listprovider — Which AI CLI runs this agent (claude_code, kiro_cli, codex, etc.)role — Determines default tool access (supervisor, developer, reviewer)The Role System
Each role grants a specific set of tools. Choose the narrowest role that fits the agent's job.
Orchestrates other agents. Cannot edit files or run commands directly.
@cao-mcp-server, fs_read, fs_list
Full execution environment. Reads, writes, runs commands, fetches URLs, and coordinates via MCP.
@builtin, fs_*, execute_bash, web_fetch, @cao-mcp-server
Read-only access. Can inspect code and communicate findings but cannot modify anything.
@builtin, fs_read, fs_list, @cao-mcp-server
The --yolo flag removes ALL restrictions — useful for experimentation but dangerous for production. The agent can run any command including rm -rf and aws calls.
Providers are interchangeable — the orchestration layer is provider-agnostic. A supervisor on Claude Code can assign workers to Kiro CLI, Codex, or any mix.
Final Check
1. You installed CAO but cao launch says "Failed to connect to cao-server". What's wrong?
You now understand how CAO works — from the supervisor-worker pattern to the orchestration tools to hands-on usage. Go build something with multiple agents.
Ready for more?
Learn about Workflows, Skills, Scheduled Flows, and the Ops MCP Server.
Advanced Features →