Request
The model to use for the agent. If not provided, uses the server’s default model (if configured). Format:
provider/model-name (e.g., openai/gpt-4o-mini, anthropic/claude-3-5-sonnet-20241022)Array of conversation messages following the OpenAI message format.Each message has:
role- One of:system,user,assistant,toolcontent- Message content (string or array of content parts for multimodal)tool_calls- Tool calls made by assistant (forassistantrole)tool_call_id- ID of tool call this is responding to (fortoolrole)
Additional context to inject into the agent’s system prompt.
Tool execution permission rules.
Execution mode. Options:
agent(default) - Standard agentic mode with tool executionrlm- Reasoning Loop Mode for code execution with REPL
Maximum number of iterations for RLM mode (default: 10).
Maximum depth for recursive agent spawning in RLM mode (default: 2).
Example Request
Response
Returns a Server-Sent Event stream withContent-Type: text/event-stream.
Connected Event
First event sent when connection is established:Always
"connected"Unique session identifier for this chat. Use this for relay requests.
Harness Start Event
Always
"harness_start"Unique identifier for this agent run
ID of the agent emitting this event
Parent agent or tool call ID (if this is a subagent)
Nesting depth for subagents
Maximum iterations allowed
Text Event
Streamed text content from the AI:Always
"text"Run identifier
Unique event ID
Agent identifier
Parent context ID
Text content chunk
Reasoning Event
Internal reasoning steps (for models that support extended thinking):Always
"reasoning"Run identifier
Unique event ID
Agent identifier
Reasoning content
Tool Call Event
Agent is invoking a tool:Always
"tool_call"Run identifier
Tool call ID (used to match with tool_result)
Agent identifier
Name of the tool being called
Tool input parameters
Tool Result Event
Result from tool execution:Always
"tool_result"Run identifier
Tool call ID (matches the tool_call event)
Agent identifier
Name of the tool that was executed
Tool output result
Relay Event
Permission request for tool execution:Always
"relay"Always
"permission"Run identifier
Relay ID (use this to resolve the relay)
Agent identifier
ID of the tool call requiring permission
Name of the tool requesting permission
Tool parameters for permission review
Usage Event
Token usage information:Always
"usage"Run identifier
Agent identifier
Number of input tokens used
Number of output tokens generated
Tokens read from cache (if supported)
Tokens used to create cache (if supported)
Harness End Event
Always
"harness_end"Run identifier
Agent identifier
Why the harness ended:
"final" or "max_iterations"Number of iterations completed
Cumulative token usage for the entire run
Error Event
Always
"error"Run identifier (if available)
Agent identifier
Error message
Example Response Stream
Error Responses
400 Bad Request
Returned when the request is malformed:Notes
- Each POST /chat creates a fresh
AgentOrchestratorfor that session - The orchestrator is automatically cleaned up when the SSE stream ends
- Default tools available:
agent(spawn subagents),bash,read,patch - Skills are automatically discovered from configured skill directories and injected into the system prompt
- All events after the initial
connectedevent include anagentIdfield
