Endpoint
Request body
Response headers
| Header | Description |
|---|---|
X-Thread-ID | The session ID (returned for new sessions) |
Content-Type | text/event-stream |
Event types
The SSE stream emits events with atype field indicating the event kind.
Run lifecycle
| Event | Fields | Description |
|---|---|---|
RUN_STARTED | threadId, runId | Agent run has begun |
RUN_FINISHED | threadId, runId | Agent run completed |
RUN_ERROR | message, code | Error occurred |
Reasoning (thinking)
| Event | Fields | Description |
|---|---|---|
REASONING_START | messageId | Agent started thinking |
REASONING_CONTENT | messageId, delta | Thought content chunk |
REASONING_END | messageId | Thought complete |
Text messages
| Event | Fields | Description |
|---|---|---|
TEXT_MESSAGE_START | messageId, role | Text response started |
TEXT_MESSAGE_CONTENT | messageId, delta | Text content chunk |
TEXT_MESSAGE_END | messageId | Text response complete |
Tool calls
| Event | Fields | Description |
|---|---|---|
TOOL_CALL_START | toolCallId, toolCallName | Tool invocation started |
TOOL_CALL_ARGS | toolCallId, delta | Tool arguments (streamed) |
TOOL_CALL_END | toolCallId | Tool call finished |
TOOL_CALL_RESULT | toolCallId, result | Tool returned a result |
Example stream
Max iterations guard
The AG-UI handler enforces a maximum number of tool calls per run, configured viaagent.max_iterations (default 30). If the limit is reached, a RUN_ERROR event is emitted.