Building a CEO-Agent Architecture: Orchestrating Multiple OpenClaw Instances as a Team
A question came up in the OpenClaw Discord that many power users have wondered about: Is it possible to run multiple OpenClaw instances with one acting as a "CEO" that delegates to specialized agents?
The answer is yes, and it's one of the more powerful patterns for complex workflows. Here's how to think about it and set it up.
Why a CEO-Agent Architecture?
A single OpenClaw instance is powerful, but it has limitations:
- Context limits: One agent can only hold so much in memory
- Specialization: Different tasks benefit from different system prompts, skills, and models
- Parallelism: Some workflows need things happening simultaneously
- Isolation: You might want research agents separate from execution agents for safety
The CEO pattern solves these by having one "orchestrator" instance that delegates work to specialized "worker" instances.
The Basic Architecture
βββββββββββββββ
β CEO Agent β β Receives user requests
β (Gateway A)β β Decides what to delegate
ββββββββ¬βββββββ
β
βββββ΄ββββ¬ββββββββ¬ββββββββ
βΌ βΌ βΌ βΌ
βββββββ βββββββ βββββββ βββββββ
βRsrchβ βCode β βWriteβ βOps β
βAgentβ βAgentβ βAgentβ βAgentβ
βββββββ βββββββ βββββββ βββββββ
Each box is a separate OpenClaw instance with its own:
- Gateway port
- Workspace directory
- System prompt (SOUL.md)
- Skills and tools
- Optionally, different models
Setting Up Worker Agents
First, create separate workspaces for each specialized agent:
mkdir -p ~/agents/research ~/agents/coder ~/agents/writerEach workspace gets its own openclaw.json. For a research agent:
{
"port": 18790,
"workspace": "~/agents/research",
"llm": {
"default": "anthropic/claude-sonnet-4-20250514"
}
}The SOUL.md in each workspace defines the agent's specialization:
# Research Agent
You are a research specialist. Your job is to:
- Search the web thoroughly
- Synthesize information from multiple sources
- Return structured findings
You do NOT execute code or make changes. You research and report.The CEO Agent's Role
The CEO agent needs a way to communicate with workers. There are two main approaches:
Approach 1: HTTP API Calls
Each OpenClaw gateway exposes an API. The CEO can use curl or the web_fetch tool to send tasks:
curl -X POST http://localhost:18790/api/sessions \
-H "Authorization: Bearer $RESEARCH_TOKEN" \
-d '{"message": "Research recent developments in quantum computing"}'Approach 2: Sessions Spawn (Recommended)
If running on the same machine, configure agents in the CEO's config and use sessions_spawn:
{
"agents": {
"research": {
"workspace": "~/agents/research",
"model": "anthropic/claude-sonnet-4-20250514"
},
"coder": {
"workspace": "~/agents/coder",
"model": "anthropic/claude-sonnet-4-20250514"
}
}
}Then the CEO can spawn tasks:
sessions_spawn(agentId="research", task="Find the top 5 alternatives to Redis for caching")
The worker runs in isolation and reports back when done.
Practical Tips from the Community
-
Start simple: Begin with just CEO + one specialist. Add more as needed.
-
Define clear handoffs: The CEO's system prompt should explicitly state when to delegate vs. handle directly.
-
Use different models strategically: CEO might use Opus for complex reasoning, while workers use Sonnet for cost efficiency.
-
Log everything: Enable verbose logging on all instances during setup. Debugging distributed systems is hard without visibility.
-
Consider message queues: For production setups, some users route through Redis or RabbitMQ rather than direct HTTP calls.
When NOT to Use This Pattern
The CEO pattern adds complexity. Don't use it if:
- A single agent with good skills handles your workload fine
- You're just starting out (get comfortable with one instance first)
- Your tasks are simple and sequential
Resources
If you've built a CEO-agent setup, share your architecture in the Discord β the community is actively exploring this pattern and your experience helps everyone.
Comments (0)
No comments yet. Be the first to comment!