Deep Agent
Event-driven streaming from Deep Agent, exposing typed content blocks.
Deep Agent is currently under development phase.
Deep Agent streams responses as typed content blocks instead of plain text. Each chunk exposes what the agent is doing internally - reasoning, tool calls, tool results, or the final answer - in real time.
Deep Agent is only available for assistants configured with content_blocks = true. Calling the events/stream
endpoint with a standard assistant returns HTTP 422.
Endpoints
Deep Agent is available on both the Threads and Chat Completions APIs:
| Mode | Endpoint |
|---|---|
| Threads | POST /v1/threads/{thread_id}/run/events/stream |
| Chat Completions | POST /v1/chat/completions/events/stream |
Both endpoints return the same NDJSON response format (one JSON object per line) with identical content block types. The only difference is how you provide the conversation context — thread ID vs. inline messages.
The request body is identical to the corresponding regular stream endpoint (/run/stream or /chat/completions/stream).
Content Block Types
Each chunk is a list of content blocks. A single chunk typically contains one block.
| Type | Key field | Description |
|---|---|---|
text | text | A fragment of the final answer text. |
reasoning | reasoning | Internal thinking produced before the answer. |
tool_call | name, args, id | A tool invocation requested by the agent. |
tool_result | tool_call_id, output | The result returned for a preceding tool call. |
Blocks arrive in the order they are produced by the deep agent.
Response Shape
Each NDJSON line looks like this:
// tool_call
{
"message_id": "969b216f-605f-44f4-9df9-cc43e56326fd",
"thread_id": "...",
"created_at": "...",
"delta": {
"role": "assistant",
"content": [
{
"type": "tool_call",
"name": "human_resource_search_tool",
"args": { "user_query": "wiederholtes Zuspätkommen Abmahnung verhaltensbedingte Kündigung" },
"id": "call_pjGaby08YGRYEOVdqQtcIYRj"
}
],
"sources": []
}
}
// tool_result
{
"message_id": "969b216f-605f-44f4-9df9-cc43e56326fd",
"thread_id": "...",
"created_at": "...",
"delta": {
"role": "assistant",
"content": [
{
"type": "tool_result",
"tool_call_id": "call_pjGaby08YGRYEOVdqQtcIYRj",
"output": "<documents><document id=..."
}
],
"sources": []
}
}
// reasoning
{
"message_id": "969b216f-605f-44f4-9df9-cc43e56326fd",
"thread_id": "...",
"created_at": "...",
"delta": {
"role": "assistant",
"content": [
{
"type": "reasoning",
"reasoning": "Searching for specifics about repeated lateness and dismissal..."
}
],
"sources": []
}
}
{ "..." }
// text (final answer)
{
"message_id": "969b216f-605f-44f4-9df9-cc43e56326fd",
"thread_id": "...",
"created_at": "...",
"delta": {
"role": "assistant",
"content": [
{
"type": "text",
"text": "Wenn Sie nicht Arbeitgeber oder kündigungsberechtigte Person sind..."
}
],
"sources": [
{
"content": "§ 622 Abs. 3 BGB: Während einer vereinbarten Probezeit...",
"meta_data": { "document_title": "Bürgerliches Gesetzbuch (BGB)", "section": "§ 622 Abs. 3" }
}
]
}
}Sources are attached to the chunk that finalizes the answer - earlier chunks typically have an empty sources array.