Threads
Stream a run
Invokes the assistant on a thread and streams the response as NDJSON. The thread must contain at least one user message and end on a user or tool message. An assistant message requesting tool calls must be followed by the corresponding tool messages. For every tool message, a corresponding assistant message with the same tool_call_id must exist.
POST
/v1/threads/{thread_id}/run/streamAuthorization
APIKeyHeader api-key<token>
In: header
Path Parameters
thread_id*|null
Request Body
application/json
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://api.haufe.ai/agents/v1/threads/497f6eca-6276-4993-bfeb-53cbbbba6f08/run/stream" \ -H "Content-Type: application/json" \ -d '{}'{
"created_at": "2025-03-15T09:13:02.654321Z",
"delta": {
"content": "Während der Probezeit beträgt die Kündigungsfrist ",
"role": "assistant",
"sources": []
},
"message_id": "5e6f7081-9012-def0-1234-556677889900",
"thread_id": "1a2b3c4d-5678-9abc-def0-112233445566"
}{
"error_code": "assistant_not_available",
"detail": "Assistant not available to your tenant"
}{
"error_code": "thread_not_found",
"detail": "Thread not found"
}{
"error_code": "engine_does_not_support_streaming",
"detail": "The selected engine does not support streaming responses. Please use the non-streaming endpoint."
}{
"error_code": "rate_limit_gateway",
"detail": "Rate limit exceeded"
}{
"error_code": "api_timeout_error",
"detail": "OpenAI API request timed out."
}{
"error_code": "internal_service_error",
"detail": "An internal service required for processing the request is currently unavailable. Please try again later."
}