Skip to main content
POST
/
v2
/
agents
/
{key}
/
stream-task
Stream agent execution in real-time
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>"
    }
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

key
string
required

The key or ID of the agent to invoke

Body

application/json
message
A2A Message · object
required

The A2A message to send to the agent (user input or tool results)

task_id
string

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.

variables
object

Optional variables for template replacement in system prompt, instructions, and messages

contact
object

Information about the contact making the request. If the contact does not exist, it will be created automatically.

thread
object

Thread information to group related requests

memory
object

Memory configuration for the agent execution. Used to associate memory stores with specific entities like users or sessions.

metadata
object

Optional metadata for the agent invocation as key-value pairs that will be included in traces

stream_timeout_seconds
number

Stream timeout in seconds (1-3600). Default: 1800 (30 minutes)

Required range: 1 <= x <= 3600

Response

Server-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.

data
Agent Execution Started Event · object
required

Initial event emitted when an agent stream begins. Contains the task ID for tracking, workspace context, and trace ID for observability.