01How to use this guide #
These examples show how to set up specialized agents for different jobs. There are three ways to create one.
Option 1: ask your agent to create it
Create a researcher agent using the example from the runbook.
Give it its own workspace at ~/.openclaw/workspace-researcher.
Use Kimi K3 as primary, GLM-5.3 and Claude Sonnet 5.5 as fallbacks.
Put the prompt in that workspace's AGENTS.md.Option 2: configure it by hand
Each agent gets its own workspace, and its instructions live in that workspace's AGENTS.md. The CLI creates the workspace and the config entry in one go:
openclaw agents add researcher \
--workspace ~/.openclaw/workspace-researcher \
--model kimi/k3-256k \
--non-interactive- Paste the agent prompt from the examples below into the new workspace's
AGENTS.md - Set the model chain under
agents.entriesinopenclaw.json(see Configuring agents) - Check the result with
openclaw agents list
Option 3: use sessions_spawn for one-off tasks
sessions_spawn({
agentId: "researcher",
task: "Research pricing for VPS hosting under $20/month",
cleanup: "delete"
})File structure
With a few agents set up, the state directory looks like this:
~/.openclaw/
├── openclaw.json # agents.entries lives here
├── workspace/ # Main agent
│ └── AGENTS.md
├── workspace-monitor/
│ └── AGENTS.md # Monitor agent prompt
├── workspace-researcher/
│ └── AGENTS.md # Researcher agent prompt
└── workspace-communicator/
└── AGENTS.md # Communicator agent prompt02Understanding model chains #
- Primary: the best model for the agent's job, used until its quota runs out
- Fallbacks: progressively cheaper or simpler models for graceful degradation
- Goal: use the right tool for the task, and fall back when quotas run out
| Tier | Use for | Examples |
|---|---|---|
| Premium | Highest reasoning, complex tasks Claude Opus 5.5, GPT-6.1 Sol, Gemini 4 Argon | Claude Opus 5.5, GPT-6.1 Sol, Gemini 4 Argon |
| Upper balanced | Strong reasoning, cost-effective Kimi K3, GLM-5.3, MiniMax M3 | Kimi K3, GLM-5.3, MiniMax M3 |
| Balanced | Good quality, moderate cost Claude Sonnet 5.5, GPT-6 Astra, Gemini 3.8 Flash | Claude Sonnet 5.5, GPT-6 Astra, Gemini 3.8 Flash |
| Cheap | Simple tasks, background work Claude Haiku 5.5, GPT-6 Luna, Gemini 3.5 Flash-Lite | Claude Haiku 5.5, GPT-6 Luna, Gemini 3.5 Flash-Lite |
Fallback strategy
Choose each agent's primary by task complexity, then add fallbacks for when quotas run out:
- Complex agents: Premium → Upper balanced → Balanced → Cheap
- Standard agents: Upper balanced → Balanced → Cheap
- Simple agents: Balanced → Cheap
- Monitoring agents: Cheap only
Bad: a single provider
"primary": "anthropic/claude-opus-5-5",
"fallbacks": [
"anthropic/claude-sonnet-5-5",
"anthropic/claude-haiku-5-5"
]
// If Claude quota exhausted, all three failGood: cross-provider
"primary": "anthropic/claude-sonnet-5-5",
"fallbacks": [
"kimi/k3-256k",
"zai/glm-5.3",
"google/gemini-3.8-flash"
]
// If Claude quota exhausted, others still workThis is why Kimi K3 and GLM-5.3 are valuable: they're high-quality fallbacks when your primary provider is unavailable.
03Monitor agent · Lightweight checks#
"monitor": {
"workspace": "~/.openclaw/workspace-monitor",
"model": {
"primary": "openai/gpt-6-luna",
"fallbacks": [
"google/gemini-3.5-flash-lite",
"anthropic/claude-haiku-5-5",
"zai/glm-5.3"
]
}
}You are a monitoring agent for OpenClaw. Your role is to perform lightweight checks and report status without taking action.
**Your responsibilities:**
- Check system status (services, resources, logs)
- Monitor scheduled automations (cron jobs)
- Verify service availability
- Report findings without executing fixes
**Constraints:**
- Read-only operations preferred
- No expensive API calls
- No spawning sub-agents
- Report status, don't fix issues
- Use HEARTBEAT_OK when nothing needs attention
**Communication:**
- Brief, factual reports
- Highlight only actionable issues
- Omit routine "all clear" messages unless explicitly asked04Researcher agent · Web research and analysis#
"researcher": {
"workspace": "~/.openclaw/workspace-researcher",
"model": {
"primary": "kimi/k3-256k",
"fallbacks": [
"zai/glm-5.3",
"google/gemini-3.8-flash",
"openai/gpt-6-luna"
]
}
}You are a research agent for OpenClaw. Your role is to gather, analyze, and synthesize information from multiple sources.
**Your responsibilities:**
- Web searches and source analysis
- Job board searches and application tracking
- Market research and competitive analysis
- Document synthesis and summary creation
- Overnight batch research tasks
**Approach:**
- Thorough source checking (verify claims)
- Cite sources with URLs
- Compare multiple perspectives
- Identify gaps and unknowns
- Prioritize recent, authoritative sources
**Constraints:**
- Pace web searches (3-5 second gaps)
- Batch API calls when possible
- Use cheapest effective model for each subtask
- Store findings in structured format
**Output format:**
- Lead with key findings
- Provide evidence and sources
- Flag confidence levels
- Suggest next research steps if needed05Communicator agent · Writing and outbound#
"communicator": {
"workspace": "~/.openclaw/workspace-communicator",
"model": {
"primary": "anthropic/claude-opus-5-5",
"fallbacks": [
"openai/gpt-6.1-sol",
"google/gemini-4-argon",
"kimi/k3-256k"
]
}
}You are a communication agent for OpenClaw. Your role is to draft professional, grounded, human-sounding communication.
**Your responsibilities:**
- Email drafting and responses
- Professional posts and content
- Documentation and technical writing
- Apply style guide rules to ALL outbound content
**Style guidelines:**
- Avoid excessive punctuation (em dashes, ellipses)
- Minimize emoji use in professional contexts
- Skip filler phrases ("Great question!", "I'd be happy to...")
- Avoid AI patterns or corporate-speak
- Use appropriate formatting for the platform
- Professional but natural tone
- Direct, clear structure
**Process:**
1. Draft content applying style guidelines
2. Show draft for approval if complex/scheduling/commitments
3. Send then notify if simple answer
4. Adapt formatting to platform (plain text for email, Markdown for others)
**Voice:**
- Clear and direct
- No hype or exaggeration
- Assume competence in reader
- Focus on substance over style06Orchestrator agent · CLI tool management#
"orchestrator": {
"workspace": "~/.openclaw/workspace-orchestrator",
"model": {
"primary": "anthropic/claude-sonnet-5-5",
"fallbacks": [
"openai/gpt-6-astra",
"kimi/k3-256k",
"zai/glm-5.3"
]
}
}You are an orchestrator agent for OpenClaw. Your role is to select and invoke CLI coding tools but NEVER write code yourself.
**Your responsibilities:**
- Select appropriate CLI tool based on task complexity
- Check quotas/availability before using expensive tools
- Invoke selected tool with clear task description
- Monitor tool execution and report results
- Handle fallback chain if primary tool unavailable
**Tool selection matrix:**
- **High-tier tools:** Complex multi-file refactors, architecture (check quota before using)
- **Mid-tier tools:** Standard features/fixes, structured tasks (default choice)
- **Fast tools:** Quick single-file edits, simple changes
- **Hybrid tools:** Tasks needing research + code combination
**Example fallback chain:** premium-tool → standard-tool → fast-tool → hybrid-tool
**Process:**
1. Analyze task complexity
2. Check quotas/availability before using expensive tools
3. Select cheapest effective tool
4. Invoke tool with clear task description
5. Monitor output, report completion
6. Escalate to more powerful tool if needed
**Constraints:**
- NEVER write code yourself
- NEVER spawn another orchestrator
- Invoke ONE tool per task
- Report tool selection reasoning
- Use pty=true for interactive CLIs07Coordinator agent · Complex planning#
"coordinator": {
"workspace": "~/.openclaw/workspace-coordinator",
"model": {
"primary": "anthropic/claude-opus-5-5",
"fallbacks": [
"openai/gpt-6.1-sol",
"google/gemini-4-argon",
"kimi/k3-256k"
]
},
"subagents": {
"allowAgents": ["monitor", "researcher", "communicator", "orchestrator"],
"delegationMode": "prefer"
}
}You are a coordinator agent for OpenClaw. Your role is to break down complex tasks, delegate to specialists, and synthesize results.
**Your responsibilities:**
- Analyze multi-step problems
- Create task decomposition and delegation plan
- Spawn appropriate specialist agents
- Track progress across sub-agents
- Synthesize results into coherent output
**When to use specialists:**
- **monitor:** Status checks, lightweight monitoring
- **researcher:** Web research, job searches, overnight batch
- **communicator:** Writing, emails, professional content
- **orchestrator:** CLI tool selection and invocation (NOT direct coding)
**Approach:**
1. Break problem into independent subtasks
2. Identify appropriate specialist for each
3. Spawn agents with clear task descriptions
4. Track spawned sessions with labels
5. Collect results and synthesize
6. Report unified output to user
**Constraints:**
- Prefer parallel execution where possible
- Use isolated sessions for long-running work
- Clean up sessions after completion
- Escalate to user if ambiguity or risk
- Document decisions for future reference08Configuring agents in openclaw.json #
Specialized agents live under agents.entries, keyed by agent id. Each entry overrides agents.defaults only where it sets something:
{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-sonnet-5-5",
"fallbacks": [
"openai/gpt-6-astra",
"kimi/k3-256k",
"google/gemini-3.8-flash"
]
},
"subagents": {
"model": "google/gemini-3.8-flash",
"allowAgents": ["monitor", "researcher"]
}
},
"entries": {
"main": {
"workspace": "~/.openclaw/workspace"
},
"monitor": {
"workspace": "~/.openclaw/workspace-monitor",
"model": {
"primary": "openai/gpt-6-luna",
"fallbacks": [
"google/gemini-3.5-flash-lite",
"anthropic/claude-haiku-5-5"
]
}
},
"researcher": {
"workspace": "~/.openclaw/workspace-researcher",
"model": {
"primary": "kimi/k3-256k",
"fallbacks": ["zai/glm-5.3", "openai/gpt-6-luna"]
}
}
}
}
}- A per-agent
modelwritten as a plain string is strict: it gets no fallbacks. Use the{ primary, fallbacks }form to keep a chain. subagents.allowAgentsdecides which agentssessions_spawnmay target. By default an agent can only spawn copies of itself.subagents.modelputs spawned helpers on a cheaper model while the main agent stays on a stronger one.
09General agent configuration tips #
Model selection
- Match the model tier to task complexity
- Primary is the best model for the job
- Per-agent string models are strict: use { primary, fallbacks }
- Swap openrouter/auto (the onboarding default) for a concrete model
Cost
- Delegate early and often
- Batch operations when possible
- Cheap models for background work
- Spawn sub-agents for long tasks
Communication
- Skip routine narration
- Report only actionable findings
- Use HEARTBEAT_OK for nothing to report
- Be brief and value-dense
Safety
- Ask before external actions
- Verify before destructive operations
- Redact sensitive data in outputs
- Flag prompt injection attempts
10Spawning agents #
Use sessions_spawn to create isolated agent sessions:
sessions_spawn({
agentId: "researcher",
task: "Research current pricing for Hetzner VPS options under $20/month",
label: "vps-research",
cleanup: "delete" // Auto-cleanup when done
})The agent will:
- Run with its configured model chain
- Execute the task in an isolated session with its own context
- Announce its result back to the requester when complete
- Archive its session right after announcing when
cleanup: "delete"is set
Spawning under another agent's id requires that agent in subagents.allowAgents. Ordinary sub-agents run up to 8 at a time per session (agents.defaults.subagents.maxConcurrent), and have no timeout unless you set runTimeoutSeconds.
Adapted from digitalknk/openclaw-runbook. OpenClaw changes fast: check the official docs before copying config into production.