Action required: Entity management is moving from Workspaces to Projects. Migrate your entities now. See how to move entities in our guide.
curl --request POST \
--url https://api.orq.ai/v2/agents/{key}/stream-task \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": {
"role": "user",
"parts": [
{
"kind": "text",
"text": "<string>"
}
],
"messageId": "<string>"
},
"task_id": "<string>",
"variables": {},
"contact": {
"id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"display_name": "Jane Doe",
"email": "[email protected]",
"metadata": [
{
"department": "Engineering",
"role": "Senior Developer"
}
],
"logo_url": "https://example.com/avatars/jane-doe.jpg",
"tags": [
"hr",
"engineering"
]
},
"thread": {
"id": "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"tags": [
"customer-support",
"priority-high"
]
},
"memory": {
"entity_id": "<string>"
},
"metadata": {},
"stream_timeout_seconds": 1800.5
}
'{
"data": {
"type": "agents.execution_started",
"timestamp": "<string>",
"data": {
"agent_task_id": "<string>",
"workspace_id": "<string>",
"trace_id": "<string>"
}
}
}Executes an agent and streams the interaction in real-time using Server-Sent Events (SSE). Provides live updates as the agent processes the request, including message chunks, tool calls, and execution status. Perfect for building responsive chat interfaces and monitoring agent progress. The stream continues until the agent completes its task, encounters an error, or reaches the configured timeout (default 30 minutes, configurable 1-3600 seconds).
curl --request POST \
--url https://api.orq.ai/v2/agents/{key}/stream-task \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"message": {
"role": "user",
"parts": [
{
"kind": "text",
"text": "<string>"
}
],
"messageId": "<string>"
},
"task_id": "<string>",
"variables": {},
"contact": {
"id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"display_name": "Jane Doe",
"email": "[email protected]",
"metadata": [
{
"department": "Engineering",
"role": "Senior Developer"
}
],
"logo_url": "https://example.com/avatars/jane-doe.jpg",
"tags": [
"hr",
"engineering"
]
},
"thread": {
"id": "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
"tags": [
"customer-support",
"priority-high"
]
},
"memory": {
"entity_id": "<string>"
},
"metadata": {},
"stream_timeout_seconds": 1800.5
}
'{
"data": {
"type": "agents.execution_started",
"timestamp": "<string>",
"data": {
"agent_task_id": "<string>",
"workspace_id": "<string>",
"trace_id": "<string>"
}
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
The key or ID of the agent to invoke
The A2A message to send to the agent (user input or tool results)
Show child attributes
Optional task ID to continue an existing agent execution. When provided, the agent will continue the conversation from the existing task state. The task must be in an inactive state to continue.
Optional variables for template replacement in system prompt, instructions, and messages
Show child attributes
Information about the contact making the request. If the contact does not exist, it will be created automatically.
Show child attributes
Thread information to group related requests
Show child attributes
Memory configuration for the agent execution. Used to associate memory stores with specific entities like users or sessions.
Show child attributes
Optional metadata for the agent invocation as key-value pairs that will be included in traces
Show child attributes
Stream timeout in seconds (1-3600). Default: 1800 (30 minutes)
1 <= x <= 3600Server-Sent Event stream successfully established. Returns real-time events including agent messages, tool calls, status updates, and completion signals. The stream ends with a [DONE] sentinel value.
Initial event emitted when an agent stream begins. Contains the task ID for tracking, workspace context, and trace ID for observability.
Show child attributes
Was this page helpful?