Skip to main content

Module rpc

Module rpc 

Source
Expand description

RPC JSONL mode: bidirectional command/event protocol over stdin/stdout.

RPC mode enables headless operation of the coding agent via a strict JSONL protocol. Commands arrive on stdin (one JSON object per line), responses and events are emitted on stdout (one JSON object per line). Diagnostics go to stderr.

§Protocol version

This is an unstable 0.x protocol. The schema may change between minor versions without notice. Clients MUST check schema_version in the rpc_ready header.

§Framing

LF (\n) is the only record delimiter. Clients MUST split on \n only and SHOULD strip a trailing \r if present.

§Commands

CommandDescription
promptSend user prompt, stream agent events
continueContinue conversation with additional text
steerQueue steering message during agent operation
follow_upQueue follow-up message for after agent stops
abortCancel current agent operation
set_modelSwitch provider:model
set_thinking_levelSet reasoning/thinking level
compactTrigger manual compaction
session_infoQuery session metadata
quitShut down the RPC session

§Responses and Errors

Every command produces at most one response object. For prompt and continue, success: true means the turn was accepted; subsequent agent output arrives as asynchronous event lines. Errors after acceptance are surfaced as events, not as a second response.

abort cancels the active operation and succeeds immediately when a turn is running. A second abort while idle is a successful no-op.

Structs§

RpcRunner
RPC runner that owns the harness and processes commands.

Constants§

RPC_SCHEMA_VERSION
Re-export the SDK schema version for crate-level access (e.g. tests).

Type Aliases§

RpcCommand
Re-export the SDK command type as the RPC command type.