Agents
Agents are AI model runtimes that process messages from channels and generate responses. OpenClaw uses the Pi agent runtime with support for multiple models, tool streaming, and workspace isolation.What is an Agent?
An agent is an AI assistant configured with:- Model: Which AI model to use (Claude, GPT, etc.)
- Workspace: Local directory for files and skills
- Tools: Available capabilities (bash, browser, canvas, etc.)
- Skills: Specialized knowledge modules
- Sandbox: Security isolation settings
Pi Agent Runtime
OpenClaw uses the Pi agent runtime from pi-mono. Features:- RPC Mode: Communicates with Gateway via JSON-RPC
- Tool Streaming: Real-time tool execution updates
- Block Streaming: Incremental response delivery
- Extended Thinking: Multi-step reasoning (GPT-5.2, Codex)
- Model Fallbacks: Automatic failover to backup models
Agent Process
The agent runs as a subprocess:Agent Configuration
Default Agent
The simplest configuration uses a single default agent:main using default settings.
Agent Defaults
Configure defaults for all agents:Multiple Agents
Define specialized agents for different channels or purposes:Model Configuration
Supported Providers
- Anthropic:
anthropic/claude-opus-4-6,anthropic/claude-sonnet-4 - OpenAI:
openai/gpt-5-turbo,openai/gpt-5-2,openai/codex-mini - Google:
google/gemini-pro,google/gemini-ultra - Local:
ollama/llama3,llamacpp/model-name
Model with Fallbacks
- Primary model is unavailable
- Rate limits are hit
- API errors occur
Per-Session Model Override
Users can override the model per session:Workspace
Each agent has a workspace directory containing:AGENTS.md
Defines the agent’s behavior and capabilities:SOUL.md
Defines personality and identity:TOOLS.md
Provides tool-specific instructions:Tools
Agents have access to various tools for interacting with the system and external services.Built-in Tools
File Operations
- read: Read file contents
- write: Write files
- edit: Edit existing files with find/replace
- glob: Find files by pattern
- grep: Search file contents
System
- bash: Execute shell commands
- process: Run long-running processes
Web
- browser: Web automation with Playwright
- Navigate, click, type
- Take screenshots
- Extract page content
Canvas
- canvas.push: Update canvas content
- canvas.reset: Clear canvas
- canvas.eval: Execute canvas JS
- canvas.snapshot: Capture canvas state
Nodes
- node.invoke: Execute device-specific actions
- Camera:
camera.snap,camera.clip - Screen:
screen.record - Location:
location.get - Notifications:
system.notify
- Camera:
Sessions
- sessions_list: List all sessions
- sessions_history: Get session transcript
- sessions_send: Message another session
- sessions_spawn: Create sub-agent session
Gateway
- gateway.restart: Restart the Gateway
- gateway.config: Update configuration
Tool Configuration
Control which tools are available:- Specific deny rules override allow rules
allow: ["*"]enables all toolsdeny: ["browser.*"]blocks all browser tools
Skills
Skills are specialized knowledge modules that extend agent capabilities.Skill Structure
SKILL.md Format
Sandbox Isolation
Sandboxing runs agent sessions in isolated Docker containers for security.Sandbox Modes
- off: No sandboxing (tools run on host)
- non-main: Sandbox group chats, main sessions on host
- all: Sandbox all sessions
Sandbox Scope
- session: One container per session (most isolated)
- agent: One container per agent (shared workspace)
- shared: Single container for all sandboxed sessions
Configuration
Sandboxing requires Docker to be installed and running.
Workspace Access
- none: No workspace access in sandbox
- ro: Read-only workspace access
- rw: Read-write workspace access
Sub-Agents
Sessions can spawn sub-agents for task delegation.Configuration
Usage
Spawn a sub-agent:Agent Communication
Agents can communicate via session tools:sessions_send
Send a message to another session:sessions_list
Discover active sessions:Performance
Response Times
- Simple queries: 1-3 seconds
- Tool usage: 3-10 seconds
- Complex reasoning: 10-30 seconds
- Extended thinking: 30-120 seconds
Token Usage
Typical token consumption:- Input: 500-2000 tokens (with context)
- Output: 100-500 tokens
- Tool calls: 50-200 tokens each
Memory Usage
- Base agent process: 100-200 MB
- +10-50 MB per active session
- +50-100 MB with browser tool
Troubleshooting
Agent not responding
Agent not responding
Check:
- Gateway is running:
openclaw gateway status - Model credentials:
openclaw auth-profiles list - Agent logs:
openclaw logs --agent main - Session status:
openclaw sessions list
Tool execution fails
Tool execution fails
Verify:
- Tool is allowed: Check
agents.defaults.tools.allow - Permissions: Check file/directory permissions
- Dependencies: Ensure required tools are installed
- Sandbox: Check Docker is running for sandboxed sessions
Slow responses
Slow responses
Possible causes:
- Model API latency
- Large context (many messages)
- Complex tool usage
- Network issues
- Use a faster model
- Prune session history
- Reduce tool allowlist
- Check network connectivity
High token usage
High token usage
Reduce costs:
- Use model fallbacks (cheaper models)
- Enable session compaction
- Limit context window
- Use thinking level “low” or “off”
Next Steps
Sessions
Learn about session management and storage
Routing
Configure multi-agent routing rules
Multi-Agent Guide
Set up specialized agents for different tasks
Security
Sandbox isolation and security best practices

