Agent Protocol
The Agent Protocol defines how to invoke agents, stream responses, and handle tool invocations via the OpenClaw Gateway API.Invoke Agent
Send a message to an agent and receive a response.Method: agent
Request:
User message to send to the agent
Session key for conversation context (e.g.,
"user:alice", "signal:+1234567890")Optional unique run identifier for tracking. Auto-generated if not provided.
Target agent ID. Defaults to configured default agent.
Override model for this request (e.g.,
"gpt-4", "claude-opus-4")Thinking budget:
"low", "medium", "high", "extended"Whether to deliver the response via configured channel
Channel for delivery (e.g.,
"signal", "telegram", "discord")Recipient identifier (phone, user ID, etc.)
Additional system prompt to prepend
Request timeout in seconds
Unique run identifier
Array of response payloads (text, images, etc.)
Streaming Responses
Agent responses are streamed in real-time via WebSocket events.Event: agent
Receive agent response chunks during execution.
Run identifier matching the request
Stream type:
"assistant", "tool", "lifecycle"Stream-specific data
Stream Types
assistant - Text response chunks:
tool - Tool invocations:
lifecycle - Execution phases:
"start", "thinking", "end", "error"
Wait for Agent Response
Wait for a specific agent run to complete.Method: agent.wait
Run identifier to wait for
Wait timeout in seconds
Abort Agent Run
Abort an in-progress agent run.Method: agent.abort
Run identifier to abort
Agent Identity
Get agent metadata and identity information.Method: agent.identity.get
Agent ID. Defaults to default agent.
List Agents
List all configured agents.Method: agents.list
Tool Invocation Events
When the agent invokes tools, you receive real-time events: Tool start:Example: Complete Agent Invocation
Next Steps
Sessions
Manage conversation sessions
Messages
Send messages via channels
Events
Subscribe to all event types

