Skip to content

Commit b6b0587

Browse files
committed
update README
1 parent fdd948d commit b6b0587

File tree

1 file changed

+87
-1
lines changed

1 file changed

+87
-1
lines changed

README.md

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For project structure and architecture details, see [CODEBASE.md](CODEBASE.md).
99
1. Install tmux (version 3.3 or higher required)
1010

1111
```bash
12-
bash <(curl -s https://raw.githubusercontent.com/awslabs/cli-agent-orchestrator/install-script/tmux-install.sh)
12+
bash <(curl -s https://raw.githubusercontent.com/awslabs/cli-agent-orchestrator/main/tmux-install.sh)
1313
```
1414

1515
2. Install uv
@@ -90,6 +90,92 @@ Ctrl+b, then d
9090
cao shutdown --session <session-name>
9191
```
9292

93+
## MCP Server Tools and Orchestration Modes
94+
95+
CAO provides a local HTTP server that processes orchestration requests. CLI agents can interact with this server through MCP tools to coordinate multi-agent workflows.
96+
97+
### How It Works
98+
99+
Each agent terminal is assigned a unique `CAO_TERMINAL_ID` environment variable. The server uses this ID to:
100+
- Route messages between agents
101+
- Track terminal status (IDLE, BUSY, COMPLETED, ERROR)
102+
- Manage terminal-to-terminal communication via inbox
103+
- Coordinate orchestration operations
104+
105+
When an agent calls an MCP tool, the server identifies the caller by their `CAO_TERMINAL_ID` and orchestrates accordingly.
106+
107+
### Orchestration Modes
108+
109+
CAO supports three orchestration patterns:
110+
111+
**1. Handoff** - Transfer control to another agent and wait for completion
112+
- Creates a new terminal with the specified agent profile
113+
- Sends the task message and waits for the agent to finish
114+
- Returns the agent's output to the caller
115+
- Automatically exits the agent after completion
116+
- Use when you need sequential task execution with results
117+
118+
Example: Sequential code review workflow
119+
```
120+
Supervisor → handoff(developer, "Implement login feature") → waits
121+
122+
Developer completes
123+
124+
Supervisor ← receives code ← Developer exits
125+
126+
→ handoff(reviewer, "Review login code") → waits
127+
128+
Reviewer completes
129+
130+
Supervisor ← receives review ← Reviewer exits
131+
```
132+
133+
**2. Delegate** - Spawn an agent to work independently (async)
134+
- Creates a new terminal with the specified agent profile
135+
- Sends the task message with callback instructions
136+
- Returns immediately with the terminal ID
137+
- Agent continues working in the background
138+
- Delegated agent sends results back to supervisor via `send_message` when complete
139+
- Messages are queued for delivery if the supervisor is busy (common in parallel workflows)
140+
- Use for parallel task execution or fire-and-forget operations
141+
142+
Example: Parallel test execution
143+
```
144+
Supervisor → delegate(tester, "Run unit tests") → continues immediately
145+
→ delegate(tester, "Run integration tests") → continues immediately
146+
→ delegate(tester, "Run e2e tests") → continues immediately
147+
148+
Supervisor ← send_message("Unit tests passed") ← Tester 1
149+
← send_message("Integration tests passed") ← Tester 2
150+
← send_message("E2E tests passed") ← Tester 3
151+
```
152+
153+
**3. Send Message** - Communicate with an existing agent
154+
- Sends a message to a specific terminal's inbox
155+
- Messages are queued and delivered when the terminal is idle
156+
- Enables ongoing collaboration between agents
157+
- Common for swarm operations where multiple agents coordinate dynamically
158+
- Use for iterative feedback or multi-turn conversations
159+
160+
Example: Multi-role feature development
161+
```
162+
PM → send_message(developer_id, "Build payment API per spec")
163+
Developer → send_message(pm_id, "Clarify refund flow?")
164+
PM → send_message(developer_id, "Refunds go to original payment method")
165+
Developer → send_message(reviewer_id, "Ready for review")
166+
Reviewer → send_message(developer_id, "Add error handling for timeouts")
167+
Developer → send_message(reviewer_id, "Updated")
168+
Reviewer → send_message(pm_id, "Payment API approved")
169+
```
170+
171+
### Custom Orchestration
172+
173+
The `cao-server` runs on `http://localhost:8080` by default and exposes REST APIs for session management, terminal control, and messaging. The CLI commands (`cao launch`, `cao shutdown`) and MCP server tools (`handoff`, `delegate`, `send_message`) are just examples of how these APIs can be packaged together.
174+
175+
You can combine the three orchestration modes above into custom workflows, or create entirely new orchestration patterns using the underlying APIs to fit your specific needs.
176+
177+
For complete API documentation, see [docs/api.md](docs/api.md).
178+
93179
## Flows - Scheduled Agent Sessions
94180

95181
Flows allow you to schedule agent sessions to run automatically based on cron expressions.

0 commit comments

Comments
 (0)