Skip to main content
Karta is streaming-first. A turn is a sequence of typed events. The native session API, the CLI, the Python SDK, the widget, and the OpenAI-compatible adapters all use that model, then shape it for the surface you called. Use the native event stream when you want the fullest Karta contract. Use an adapter stream when you need a client library that already speaks another wire format.

Choose the stream

Non-streaming calls still run through the same turn. Karta accumulates the stream and returns the final response object.

Native event envelope

Native session streams use Server-Sent Events. The SSE event: name matches the event object’s type.
In the SDK, iterate over the same event objects:

Native event types

The native stream is the most detailed stream. Event payloads vary by harness, but these event types are the public contract you should branch on.

text

An agent text chunk. The text is at event.data['part']['text'] (the Claude SDK shape).

tool_use

The agent invoked a tool. Common payload fields include the tool name, input, status, result, and tool-use id.

reasoning

An extended-thinking / reasoning block, when the model is configured to emit it.

step_start

An agent step began. Payload includes a step_index and a description.

step_finish

An agent step completed, with its result.

input_required

The turn is paused awaiting an approval decision (tool use, file write, and similar requests). Payload includes request_id, kind, tool, target, message, and options. Resolve it with approve_once, approve_session, or deny. See Inputs.

error

An agent, model, or policy error. Payload includes a human-readable message and may include a machine-readable code. In streaming mode, mid-turn failures arrive as events rather than replacing the stream with a new HTTP response.

done

The turn is complete. Payload carries usage (input_tokens, output_tokens, total_tokens) and the assembled message. When the effective model that ran the turn is known, the payload also carries model (the resolved model id, e.g. claude-sonnet-5); it is omitted when unknown.

Native API example

Create or resume a session, then stream a message:

Managed Agents stream

The Managed Agents adapter is the full-fidelity browser and widget stream. It maps native events into stable UI event names: Approvals arrive as session.status_idle with stop_reason: "requires_action", plus the request_id, tool, target, and options needed to render a decision UI.

Responses stream

The OpenAI-compatible Responses adapter emits the portable Responses sequence:
Use previous_response_id to continue the same Karta session through the Responses API.

Messages API

Send and stream over HTTP, with full SSE framing.

Consumer adapters

The same stream, re-shaped into OpenAI and Anthropic wire formats.