Skip to content
Zachary BENSALEM edited this page Aug 15, 2026 · 1 revision

API

Purpose

Prime Agent exposes its runtime over three wire surfaces, each aimed at a different client and transport:

  • The web HTTP API: browser-facing routes that talk NDJSON and SSE. This is the surface the Qredence web UI uses.
  • The daemon Unix-socket protocol: a headless background service protocol for creating, attaching to, and administering persistent sessions.
  • The RPC mode: a headless stdio protocol for driving a single in-process session from a script.

Each surface is independent: the web HTTP API runs the agent in-process through PrimeBridge, the daemon keeps sessions alive in background workers, and RPC runs one session over stdin/stdout. There is no single shared wire format across all three; choose the one that matches the deployment.

Wire surfaces

Surface Transport Client Where it lives
Web HTTP API HTTP over 127.0.0.1 (NDJSON + SSE) Browser / web/app web/app/src/routes/api/ routes over web/server/src/handlers/
Daemon protocol Unix socket (JSONL) TUI, CLI, DaemonAgentConnection packages/coding-agent/src/modes/daemon/daemon-protocol.ts
RPC mode stdio (JSON on stdin, JSON responses/events on stdout) Scripts / headless automation packages/coding-agent/src/modes/rpc/

Web HTTP API

The web HTTP API is the interface the standalone Qredence web chat UI talks to. Routes are thin TanStack Start wrappers over web/server handlers, and the browser only uses HTTP (NDJSON for streaming turns, SSE for out-of-turn pushes). The full endpoint table, request/response shapes, NDJSON framing, and SSE semantics are on the Web API page.

Daemon protocol

The daemon protocol is a versioned JSONL wire protocol for the headless background service. It handles session creation, attach/detach, prompt and steer, bash execution, cron and heartbeats, model and thinking-level control, and administration. It is the protocol used by the TUI and CLI when they attach to a running daemon. The protocol mechanics, version negotiation, capability gating, and compatibility maps are on the Daemon protocol page; the daemon architecture lives in Daemon.

RPC mode

RPC mode runs a single headless session with JSON commands on stdin and JSON responses plus events on stdout. It is a lightweight alternative to the daemon for one-shot and scripted operation, and it is the mode used by the owned-session worker for print/json/ephemeral runs. The command and response shapes are defined in packages/coding-agent/src/modes/rpc/rpc-types.ts, and the loop in packages/coding-agent/src/modes/rpc/rpc-mode.ts.

Related pages

Clone this wiki locally