Skip to main content
Agent Manager streams responses using Server-Sent Events (SSE), so your application can render the agent’s answer incrementally as tokens arrive rather than waiting for the full response. The same stream also exposes the agent’s internal reasoning and tool activity, giving you full visibility into how the agent is working.

How streaming works

When you call the stream endpoint, the server holds the connection open and pushes a sequence of AgentStreamEvent objects as newline-delimited SSE messages. Each event has a discriminator field (event) that tells you what kind of data it carries:
The request body is identical to a synchronous run. The only difference is the endpoint path and the Accept header.

Event structure

Every SSE message contains a single AgentStreamEvent:
string
required
The event type. See the table below for all possible values.
string
The payload for this event. For delta events this is a text fragment; for tool events it is a JSON string.
number
Unix timestamp (milliseconds) when the event was emitted by the server.

Event types

REASONING_DELTA events expose the agent’s “inner thoughts” — the chain-of-thought reasoning it produces before deciding which tool to call. You can render these separately (for example, in a collapsible “Thinking…” section) to show users how the agent reached its conclusion.

Consuming the stream in TypeScript

The example below uses the EventSource API (or a polyfill that supports POST with a body) to consume the stream and separate reasoning from content:
The built-in UI at http://localhost:5173 already implements this pattern. It renders reasoning steps in a collapsible panel, streams final answer tokens with Markdown formatting, and shows HITL approval controls when a run reaches PAUSED status.

Multimodal input

For agents that support vision, you can include image attachments in the request body alongside your message. Images must be base64-encoded or referenced by a publicly accessible URL.

Request body with media

string
required
The MIME type of the attachment, such as image/png or image/jpeg.
string
required
Base64-encoded binary content of the file, or an HTTP/HTTPS URL pointing to the image.
You can include multiple media items in a single request:
Not all agents are configured with vision-capable models. Sending media to a text-only agent will result in an error. Check the agent’s configuration or use procurator_assistant to ask which agents support multimodal input.

Full streaming example

The following end-to-end example opens a stream, collects reasoning and content separately, and prints them to the console:

Built-in chat UI

The Agent Manager UI (http://localhost:5173) provides a production-ready chat interface with:

Live streaming

Tokens render incrementally as they arrive. Reasoning steps appear in a collapsible “Thinking…” panel above the final answer.

Markdown rendering

Responses are rendered with full Markdown support: tables, code blocks with syntax highlighting, and lists.

Multimodal input

Drag and drop image files directly into the chat input. The UI handles base64 encoding automatically.

HITL controls

When a run is paused for approval, the UI displays a visual indicator with “Approve” and “Reject” buttons.