Overview
The OpenClaw Gateway enables Agentic AI to execute commands through ClawdBot, a multi-skill AI agent that can:- Control applications - Open YouTube, Spotify, browsers, etc.
- Send messages - WhatsApp, Telegram, email
- Search the web - Google searches, lookup information
- Manage system - Run commands, control device
Architecture
How It Works
Brain analyzes intent
Gemini determines this is an actionable command (not conversation)Location:
src/agenticai/core/conversation_brain.py:310Installing ClawdBot
Configuration
Configure the gateway connection inconfig.yaml:
config.yaml
Reconnection Strategy
The gateway client uses exponential backoff for reconnection:- Attempt 1: Wait 1s
- Attempt 2: Wait 2s
- Attempt 3: Wait 4s
- Attempt 4: Wait 8s
- …
- Attempt 10: Wait 60s (max)
Gateway Protocol
JSON-RPC 2.0
The gateway uses JSON-RPC 2.0 for communication:Message Types
Location:src/agenticai/gateway/messages.py:1
- CallStartedMessage
- TranscriptMessage
- ActionMessage
- CallEndedMessage
- HeartbeatMessage
Sent when a call is initiated:
API Reference
GatewayClient
Location:src/agenticai/gateway/client.py:16
Usage Example
ClawdBot Integration
The Conversation Brain sends commands to ClawdBot: Location:src/agenticai/core/conversation_brain.py:120
Supported Commands
ClawdBot skills handle various command types:| Command | ClawdBot Skill | Example |
|---|---|---|
| YouTube | youtube-skill | ”Open YouTube and search for Zayn” |
| Spotify | spotify-skill | ”Play Shape of You on Spotify” |
| gog-skill | ”Check my emails” | |
| Messages | message-skill | ”Send hi to John on WhatsApp” |
| Web Search | search-skill | ”Search for nearby restaurants” |
| Browser | browser-skill | ”Open Google Chrome” |
Conversation Flow
Here’s how voice commands flow through the system:Brain analyzes intent
Location:
src/agenticai/core/conversation_brain.py:310Gemini determines:- Intent:
action - Actionable:
true - Command:
"Play my workout playlist on Spotify"
ClawdBot executes
ClawdBot’s Spotify skill:
- Opens Spotify app
- Searches for “workout playlist”
- Starts playback
"Playing your workout playlist on Spotify"Troubleshooting
Gateway connection refused
Check ClawdBot is running
Check ClawdBot is running
Verify gateway port
Verify gateway port
Check firewall
Check firewall
Ensure port 18789 is not blocked:
Commands not executing
Check ClawdBot logs
Check ClawdBot logs
Verify skill configuration
Verify skill configuration
Check ClawdBot skills are installed:Install missing skills:
Test command manually
Test command manually
High latency
Check ClawdBot timeout
Check ClawdBot timeout
Default timeout is 90s. Commands should complete faster:Location:
src/agenticai/core/conversation_brain.py:144Monitor command execution
Monitor command execution
Messages not queued during disconnection
Check queue size
Check queue size
Default queue size is 1000 messages:Location: Messages beyond this are dropped with warning:
src/agenticai/gateway/client.py:56Performance
Latency Breakdown
| Step | Typical Latency |
|---|---|
| Speech → Whisper transcript | 200-500ms |
| Intent analysis (Gemini) | 300-800ms |
| Gateway send | < 10ms |
| ClawdBot execution | 1-5s (varies by skill) |
| Response → Speech | 200-500ms |
| Total | ~2-7 seconds |
Optimization Tips
Skip intent analysis for keywords
Skip intent analysis for keywords
The brain skips Gemini for obvious action keywords:Location: Saves 300-800ms for common commands.
src/agenticai/core/conversation_brain.py:339Use faster ClawdBot skills
Use faster ClawdBot skills
Some skills are faster than others:
- Fast (< 1s): Browser, YouTube, Spotify
- Medium (1-3s): Email check, web search
- Slow (3-5s+): Email compose, message send
Next Steps
Conversation Brain
Learn how intent analysis works
Gemini Integration
Configure Gemini for intent detection
ClawdBot Integration
Deep dive into ClawdBot skills
Architecture
Understand the full system