Invoke Agent (Stream)
Execute an agent with real-time Server-Sent Events (SSE). Reusing id continues the same task/thread.
Invoke an agent with real-time streaming via Server-Sent Events (SSE). Events fire as the agent works, so you can render progress, chunks, tool activity, and the final result in an interactive UI.Documentation Index
Fetch the complete documentation index at: https://docs.xpander.ai/llms.txt
Use this file to discover all available pages before exploring further.
Path Parameters
Request Body
The request body is identical to Invoke Agent (Sync). Onlyinput.text is required.
id from a previous task response to continue the same conversation. Continued turns keep using that same ID.true, files in input.files are not injected into the LLM context window. See Invoke Sync: Processing Files.default or harder. Controls reasoning depth.instructions_override (which adds behavioral instructions), this supplies supplementary facts or context the agent should consider for this run — e.g. relevant background data, the current state of an external system, or a user’s recent activity.low | medium | high | xhigh). See Invoke Sync: Per-Execution LLM Override.Query Parameters
"draft" to test undeployed changes.Response Format
ReturnsContent-Type: text/event-stream. Each SSE line is prefixed with data: and contains a JSON object with this top-level shape:
chunk events, data is a string fragment. For task lifecycle events, data is the task object snapshot at that moment.
id: "<previous-task-id>", the stream keeps emitting that same task_id. Use Get Task for the latest turn state and Get Task Thread or Get Task Thread (Full) for the full message history.Event Types
Events are emitted in this order during a typical invocation:status: "pending". This is emitted for both brand-new threads and follow-up turns on an existing task/thread ID.executing. Contains the updated task object.status, result, and finished_at.deep_planning is enabled on the agent).Basic Example
--no-buffer (or -N) for real-time output.
Real Event Stream
Here’s what the actual SSE output looks like from a live invocation:Consuming the Stream (Node.js)
Consuming the Stream (Python)
Notes
- Use
curl --no-bufferorcurl -Nfor real-time terminal output - The stream ends after the
task_finishedevent — close the connection at that point chunkevents contain raw text fragments; concatenate them for the full responsetool_call_requestandtool_call_resultevents let you show tool usage in your UIthinkandanalyzeevents show the agent’s reasoning (useful for debugging and transparency)- For multi-turn conversations, wait for
task_finishedbefore sending the next message with the sameid - Reusing
idcontinues the same task/thread; it does not mint a new top-level task ID for the follow-up turn - Get Task shows the latest turn state for that ID, while Get Task Thread and Get Task Thread (Full) show the accumulated conversation
See Also
- Invoke Agent (Sync) — blocks until completion
- Invoke Agent (Async) — returns task ID for polling
- Get Thread — retrieve conversation history after streaming
Authorizations
API Key for authentication
Path Parameters
Query Parameters
The agent/workflow version to invoke. default = latest
Body
Pass the id from a previous response to continue a multi-turn conversation with the same agent. Omit for a new conversation.
"02843b37-4d77-48a0-8da7-2c76afe54401"
Per-execution override of the agent's LLM provider (e.g. openai, anthropic). Must match one of GET /llm_providers. Omit to use the agent's configured provider.
Per-execution override of the model name within the chosen provider. Must match a model from GET /llm_providers/{provider}/models. Examples: claude-sonnet-4-6, gpt-5, gemini-2.0-flash. Omit to use the agent's configured model.
Per-execution override of reasoning effort for reasoning-capable models (e.g. GPT-5). low for simple tasks, medium for balanced performance, high for complex reasoning, xhigh for maximum reasoning depth (slower, more expensive). Omit to use the agent's configured reasoning effort.
low, medium, high, xhigh Response
Successful Response

