Skip to main content
POST
/
v2
/
agents
/
stream-run
Run agent with streaming response
curl --request POST \
  --url https://api.orq.ai/v2/agents/stream-run \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "key": "<string>",
  "task_id": "<string>",
  "model": "<string>",
  "fallback_models": [
    "<string>"
  ],
  "role": "<string>",
  "instructions": "<string>",
  "message": {
    "messageId": "<string>",
    "role": "user",
    "parts": [
      {
        "kind": "text",
        "text": "<string>"
      }
    ]
  },
  "variables": {},
  "contact": {
    "id": "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
    "display_name": "Jane Doe",
    "email": "jane.doe@example.com",
    "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>"
  },
  "path": "Default",
  "description": "<string>",
  "system_prompt": "<string>",
  "memory_stores": [],
  "knowledge_bases": [],
  "team_of_agents": [],
  "settings": {
    "tools": [],
    "tool_approval_required": "none",
    "max_iterations": 100,
    "max_execution_time": 300,
    "evaluators": [
      {
        "id": "<string>",
        "sample_rate": 50,
        "execute_on": "input"
      }
    ],
    "guardrails": [
      {
        "id": "<string>",
        "sample_rate": 50,
        "execute_on": "input"
      }
    ]
  },
  "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.

Body

application/json
key
string
required

A unique identifier for the agent. This key must be unique within the same workspace and cannot be reused. When executing the agent, this key determines if the agent already exists. If the agent version differs, a new version is created at the end of the execution, except for the task. All agent parameters are evaluated to decide if a new version is needed.

Minimum length: 1
model
required

Model configuration for this execution. Can override the agent manifest defaults if the agent already exists.

A model ID string (e.g., openai/gpt-4o or anthropic/claude-haiku-4-5-20251001). The agent can be run with a wide range of models with different capabilities, performance characteristics, and price points. Only models that support tool calling (function_calling) can be used to run agents. See (supported models)[/docs/proxy/supported-models] documentation for the complete list of available models.

role
string
required

Specifies the agent's function and area of expertise.

Minimum length: 1
instructions
string
required

Provides context and purpose for the agent. Combined with the system prompt template to generate the agent's instructions.

Minimum length: 1
message
object
required

The A2A format message containing the task for the agent to perform.

path
string
required

Entity storage path in the format: project/folder/subfolder/...

The first element identifies the project, followed by nested folders (auto-created as needed).

With project-based API keys, the first element is treated as a folder name, as the project is predetermined by the API key.

Example:

"Default"

settings
object
required
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.

fallback_models
(string | Fallback Model Configuration · object)[]

Optional array of fallback models used when the primary model fails. Fallbacks are attempted in order. All models must support tool calling.

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.

description
string

A brief summary of the agent's purpose.

Minimum length: 1
system_prompt
string

A custom system prompt template for the agent. If omitted, the default template is used.

Minimum length: 1
memory_stores
string[]

Array of memory store identifiers that are accessible to the agent. Accepts both memory store IDs and keys.

knowledge_bases
object[]

Knowledge base configurations for the agent to access

team_of_agents
object[]

The agents that are accessible to this orchestrator. The main agent can hand off to these agents to perform tasks.

metadata
object

Optional metadata for the agent run 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. Delivers real-time agent execution events including message fragments, tool invocations, intermediate results, and completion status. Stream terminates with [DONE] sentinel upon completion.

data
object
required
  • Option 1
  • Option 2
  • Option 3
  • Option 4
  • Option 5
  • Option 6
  • Option 7
  • Option 8
  • Option 9
  • Option 10
  • Option 11
  • Option 12
  • Option 13
  • Option 14
  • Option 15
  • Option 16
  • Option 17