---
title: "Stream agent execution in real-time"
method: POST
path: "/v2/agents/{key}/stream-task"
tags: ["Agents"]
deprecated: true
---

# Stream agent execution in real-time

`POST /v2/agents/{key}/stream-task`

> **Deprecated.**

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

## Path parameters

- `key` string, required — The key or ID of the agent to invoke

## Request body

- object — Request body for invoking an existing agent (stream-task endpoint). Used to start a new task or continue an existing conversation.
  - `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.
  - `message` object, required — The A2A message to send to the agent (user input or tool results)
    - `messageId` string — Optional A2A message ID in ULID format
    - `role` union, required — Message role (user or tool for continuing executions)
      - 'user' — Message from the end user
      - 'tool' — Message containing tool execution results
    - `parts` union[], required — A2A message parts (text, file, or tool_result only). Note: Tool role messages must only contain tool_result parts.
      - union — Message part that can be provided by users. Use "text" for regular messages, "file" for attachments, or "tool_result" when responding to tool call requests.
        - object — Text content part. Use this to send text messages to the agent.
          - `kind` 'text', required
          - `text` string, required
        - object — File attachment part. Use this to send files (images, documents, etc.) to the agent for processing.
          - `kind` 'file', required
          - `file` union, required
            - object — Binary in base64 format. Check in the model's documentation for the supported mime types for the binary format.
              - …
            - object — File in URI format. Check in the model's documentation for the supported mime types for the URI format
              - …
          - `metadata` object
        - object — Tool execution result part. Use this ONLY when providing results for a pending tool call from the agent. The tool_call_id must match the ID from the agent's tool call request.
          - `kind` 'tool_result', required
          - `tool_call_id` string, required
          - `result` unknown
          - `metadata` object
        - object — Error content part. Generated by the system when an error occurs during agent execution.
          - `kind` 'error', required
          - `error` string, required
          - `code` number
  - `variables` object — Optional variables for template replacement in system prompt, instructions, and messages
  - `identity` object — Information about the identity making the request. If the identity does not exist, it will be created automatically.
    - `id` string, required — Unique identifier for the contact
    - `display_name` string — Display name of the contact
    - `email` string, email — Email address of the contact
    - `metadata` object[] — A hash of key/value pairs containing any other data about the contact
    - `logo_url` string — URL to the contact's avatar or logo
    - `tags` string[] — A list of tags associated with the contact
  - `contact` object — @deprecated Use identity instead. Information about the contact making the request.
    - `id` string, required — Unique identifier for the contact
    - `display_name` string — Display name of the contact
    - `email` string, email — Email address of the contact
    - `metadata` object[] — A hash of key/value pairs containing any other data about the contact
    - `logo_url` string — URL to the contact's avatar or logo
    - `tags` string[] — A list of tags associated with the contact
  - `thread` object — Thread information to group related requests
    - `id` string, required — Unique thread identifier to group related invocations.
    - `tags` string[] — Optional tags to differentiate or categorize threads
  - `memory` object — Memory configuration for the agent execution. Used to associate memory stores with specific entities like users or sessions.
    - `entity_id` string, required — An entity ID used to link memory stores to a specific user, session, or conversation. This ID is used to isolate and retrieve memories specific to the entity across agent executions.
  - `metadata` object — Optional metadata for the agent invocation as key-value pairs that will be included in traces
  - `engine` 'text' | 'jinja' | 'mustache' — Override template engine for this invocation. If not provided, uses the agent default.
  - `configuration` object — Configuration options for the agent invocation
    - `blocking` boolean — Whether to block until the agent task completes. When true, the response will include the full task with messages. When false (default), returns immediately with task ID and status.
  - `stream_timeout_seconds` number — Stream timeout in seconds (1-3600). Default: 1800 (30 minutes)

## Response `200`

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.

## Other responses

- `404` — Agent not found

---

[API](https://skmtc.net/orq-ai/apis/orq-ai-api.md) · [All operations](https://skmtc.net/orq-ai/apis/orq-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/orq-ai/orq-ai-api/versions/1072e5ba28ab/schema)
