Overview
ThePOST /chat endpoint returns a Server-Sent Events (SSE) stream. Each event has a type field indicating what happened.
Event types
thinking
Agent is processing. Includes a status message.
text
Streamed response text (arrives in chunks).
tool_call
Agent invoked a tool.
tool_result
Tool execution completed.
approval_needed
Tool requires user approval before executing.
POST /tool-result to approve or reject.
session_info
Session metadata update.
done
Execution complete. Includes token usage.
error
An error occurred.
cancelled
User cancelled the run.
Approval flow
Whenapproval_needed is received:
- Display the tool call to the user
- Collect their decision (approve/reject)
- Submit via
POST /tool-result: