Karta is streaming-first. A turn is not a single batched response; it’s a sequence of typed events. The HTTP API, the CLI, and the SDK all speak the same model, and non-streaming callers just accumulate the stream into a final message. This buys you progressive rendering, long turns without timeouts, granular permission prompts, and one uniform model across every entry point.Documentation Index
Fetch the complete documentation index at: https://docs.karta.sh/llms.txt
Use this file to discover all available pages before exploring further.
The event shape
Every event has the same envelope:Event types
Each type below is anevent.type value. The headings double as anchors
(e.g. #input_required).
text
An assistant text chunk. The text is indata.part.text (Claude SDK shape);
the SDK’s event.text accessor normalizes that for you.
tool_use
The agent invoked a tool. Payload:tool_name, tool_input, tool_use_id.
reasoning
An extended-thinking / reasoning block, when the model is configured to emit it.step_start
An agentic step began. Payload includes astep_index and a description.
step_finish
An agentic step completed, with its result.input_required
The turn is paused awaiting an approval decision (tool use, file write, …). Payload:request_id, kind, tool, message, and options. Resolve it with
approve_once, approve_session, or deny. See
Inputs.
error
An agent or harness error. Payload:message and an error type/code. In
streaming mode, errors arrive as an event rather than an HTTP status — for
example a rejected BYOK key surfaces here mid-stream.
done
The turn is complete. Payload carriesusage
(input_tokens, output_tokens, total_tokens) and the assembled message.
A
system type also exists for harness-internal messages; it’s typically
hidden by CLI policy. Hide any types you don’t want surfaced with
cli.hidden_event_types.On the wire (SSE)
Over HTTP, events are Server-Sent Events framed as:Accumulating to a final message
Non-streaming callers (send / send_sync, or "stream": false over HTTP)
get the same turn assembled into a single Response — text plus the user and
assistant messages plus usage. Internally a TurnAccumulator folds the event
stream down; the typed model is the primitive, and request/response is just the
accumulated form of it.
Messages API
Send and stream over HTTP, with full SSE framing.
Consumer adapters
The same stream, re-shaped into OpenAI and Anthropic wire formats.