Streaming

All Octavus responses stream in real-time using Server-Sent Events (SSE). This enables responsive UX with incremental updates.

Stream Response

When you execute a request, you get an async generator of parsed events:

typescript

Event Types

The stream emits various event types for lifecycle, text, reasoning, and tool interactions.

Lifecycle Events

typescript

Block Events

Track execution progress:

typescript

Text Events

Streaming text content:

typescript

Reasoning Events

Extended reasoning (for supported models like Claude):

typescript

Tool Events

Tool call lifecycle:

typescript

Resource Events

Resource updates:

typescript

Display Modes

Each block/tool specifies how it should appear to users:

ModeDescription
hiddenNot shown to user (background work)
nameShows block/tool name
descriptionShows description text
streamStreams content to chat

Note: Hidden events are filtered before reaching the client SDK. Your frontend only sees user-facing events.

Stream Event Type

typescript

Client Tool Request

When a tool has no server handler registered, the SDK emits a client-tool-request event:

typescript

After the client handles the tools, send a continue request with all results:

typescript

See Client Tools for full client-side implementation.

Error Events

Errors are emitted as structured events with type classification:

typescript

Error Types

TypeDescription
rate_limit_errorToo many requests
authentication_errorInvalid API key
provider_errorLLM provider issue
provider_overloadedProvider at capacity
tool_errorTool execution failed
internal_errorPlatform error

Tool Errors

Tool errors are captured per-tool and don't stop the stream:

typescript

The stream always ends with either finish or error.

For client-side error handling patterns, see Error Handling.