AI Agent
Understand the OpenClaw AI Agent concept, how agents work, and how to configure agent behavior.
What is an AI Agent?
An AI Agent in OpenClaw is an autonomous entity that can receive messages, process them using AI models, and respond through connected channels. Unlike simple chatbots, agents support:
- Tool use — Call external APIs, run code, and interact with services
- Sessions — Maintain isolated conversation contexts per sender
- Memory — Store and recall information across conversations
- Multi-agent routing — Route messages to specialized agents based on context
How Agents Work
User Message → Gateway → Message Router → Agent → AI Model → Response
↕
Tools / Memory- A message arrives through a channel (WhatsApp, Telegram, etc.)
- The Gateway passes it to the message router
- The router selects the appropriate agent based on workspace rules
- The agent processes the message using its configured AI model
- The agent may call tools, access memory, or route to sub-agents
- The response flows back through the channel
Agent Configuration
Agents are configured in ~/.openclaw/openclaw.json:
{
"agents": {
"default": {
"provider": "openai",
"model": "gpt-4o",
"systemPrompt": "You are a helpful assistant.",
"temperature": 0.7,
"maxTokens": 4096
}
}
}Key Configuration Options
| Option | Description | Default |
|---|---|---|
provider | AI model provider (openai, anthropic, ollama, etc.) | openai |
model | Model name | gpt-4o |
systemPrompt | System prompt for agent behavior | — |
temperature | Response creativity (0-2) | 0.7 |
maxTokens | Maximum response length | 4096 |
Multi-Agent Routing
OpenClaw supports multiple agents with workspace isolation:
{
"agents": {
"coder": {
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"systemPrompt": "You are an expert programmer."
},
"writer": {
"provider": "openai",
"model": "gpt-4o",
"systemPrompt": "You are a creative writer."
}
},
"routing": {
"default": "coder",
"rules": [
{
"match": "write|story|blog",
"agent": "writer"
}
]
}
}Sessions
Sessions maintain conversation history per sender:
- Direct chats — Multiple messages from the same sender share one session
- Group chats — Each group has an isolated session
- Session reset — Send
/resetor configure auto-expiry
Tools
Agents can use tools to interact with external systems:
- File system access
- Web browsing
- API calls
- Code execution
- Database queries
Next Steps
- AI Model Integrations — Configure your AI provider
- Skills — Add custom skills to agents
- Memory — Configure persistent memory