Skip to main content

Chat and streaming

Source-reviewed API reference

This reference was reconciled against current development source on 2026-11-15. Historical public-source links below remain pinned to their stated revision; they are not proof that a public mirror or your installation has caught up. Start with the current operator guide for installation. This is static source review, not a live API compatibility test.

POST /api/chat submits one user-visible turn. Select an existing agent; its configured model and tools determine what the turn can do. A request can incur provider charges and execute granted tools.

Request body​

FieldBehavior
agentIdRegistered agent; explicit selection is recommended
sessionIdSession name, default default
messageNonblank string; a retained attachment permits an attachment-only request
runIdOptional caller-supplied run identifier; absence generates one, not a general idempotency key
attachmentsArray of {name, type, size, encoding, content} records
modelConnectionId, modelOptional exact enabled connection/model overrides
reasoningEffort, thinkingMode, temperaturePer-turn generation preferences, subject to model support; nullable Anthropic mode is distinct from explicit provider default (see selection semantics)
continuityScopeExplicit continuity namespace; workingProject is a compatibility alias
noCallModelLiteral true selects no-model behavior; not an authorization or sandbox control

Normal chat does not accept a workspace-selection/execution-target protocol. A continuity namespace or prose path does not change the tool cwd or execution target. Ordinary main-turn admission is serialized, but busy submissions are rejected rather than implicitly accepted as queued turns; use the explicit inputs below. /stop, /new, and /status bypass that wait so cancellation, reset and status can reach an active turn.

Attachment and request budgets​

The browser defaults to 8 MiB per file, 16 MiB per attachment batch, and 8 files. These are pre-read browser resource budgets, not server admission policy. Deployments can override positive integer values through window.__BURROW_CLIENT_BUDGETS__ before loading the UI bundle.

The server preserves accepted non-image attachment content without the former 200,000-character clipping, and rejects image content above 30,000,000 characters with 413. This is storage/admission behavior, not a guarantee that the whole attachment is injected into model context. Its JSON request reader defaults to 96 MiB total body bytes and 30 seconds for body receipt; BURROW_REQUEST_MAX_BYTES and BURROW_REQUEST_TIMEOUT_MS configure those ceilings. JSON traversal is also bounded. None of these limits proves native PDF/Office parsing from a filename or guarantees that all attachment text reaches the model.

NDJSON protocol​

Send Accept: application/x-ndjson to receive newline-delimited JSON over the POST response. The response uses HTTP 200 and application/x-ndjson; charset=utf-8, with no-cache, no-transform and x-accel-buffering: no. It is not Server-Sent Events.

Each event has type, runId, sessionId, ts and data. Buffer partial network chunks until a complete line is available, parse each JSON line independently and ignore unknown event types safely.

EventMeaning
run.startedAccepted runtime turn and run identifier
route.decidedRoute/session-kind observation
model.started, model.completedModel request/response metadata
model.recoveryNonterminal bounded recovery state for a model request
assistant.deltaProvisional answer text; data.delta, totalChars, modelCall
assistant.thoughtSeparate provisional thought stream; never merge it into the final answer
tool.started, tool.completedTool activity/status and selected presentation fields
verification.completedVerification observation
runtime.noticeRuntime loop warning/block notice
context.compaction.started, .completed, .failedBounded compaction lifecycle/receipt; a safe no-op completes with compressed: false
run.completedTerminal data.response; inspect its application outcome
run.failed, run.cancelled, run.supersededOther terminal outcomes with data.response

The terminal response and persisted transcript are authoritative, not accumulated deltas. Handled model failures and incomplete turns emit run.failed; HTTP 200 still describes the stream transport, not application success. Slash-command turns can produce only a terminal event. Early validation failures can be ordinary JSON errors before streaming starts.

Tool progress is operational evidence, not a content-free telemetry guarantee: projected fields can include command, cwd, paths, query, reason and error. Keep streams private.

Model recovery and receipts​

Current development emits nonterminal model.recovery events with states recovering, resumed, exhausted, blocked, requires_investigation or cancelled. Continue reading for the terminal run event. On a replacement attempt, modelCall identifies a new active provisional answer; discard the abandoned partial answer instead of concatenating attempts.

Terminal responses and retained assistant metadata can include modelFailure (origin, code, retryability, observed upstream HTTP status and optional message) and modelRecovery (version: 1, retryCount, bounded requests). At most 32 request summaries retain attempt limits, original/last failure, safe failover blocker and partial character counts—not raw prompts, provider bodies, thoughts, tool payloads or headers. The original upstream failure remains distinct from a recovery/failover failure.

Defaults are three physical dispatch attempts per request and four extra attempts across the run, with cancellable one/three-second waits. The wrapper does not replay completed tools or the whole turn, and does not promise exactly-once provider billing or resume a broken byte stream. Active/child/task projections remain active while recovery or cancellation drains. See runtime recovery boundaries and troubleshooting.

Generic observed provider-generation error envelopes can now be retried within the same bounds, including unfamiliar codes, unless structured terminal credential/permission/request/quota/billing/context/policy evidence or nontransient numeric status overrides them. Do not interpret a retryable generic code as proof of a transient outage. Unmarked exceptions and normal refusal/incomplete terminals without an error envelope are not made retryable.

Active-run reads also carry scoped descendant ancestry, including root, immediate parent and depth. A child-session filter excludes siblings; context hydration truncation is not status-tree truncation.

Manual compaction​

Send /compact as the ordinary chat message to run the existing compression planner without main-agent inference. It uses normal session admission, so it is not a bypass of busy-session rejection. Originals remain archived; empty or irreducible history produces a reported no-op, not a reset. Manual NDJSON begins before the work; its feedback is retained in visible history but excluded from model input. Inspect the terminal receipt and compressed/reason, not merely a started event. Compression does not guarantee that oversized immutable/current input will fit.

Disconnect and cancellation​

After admission, closing the browser or aborting the client fetch marks the turn detached; it does not automatically cancel execution. A disconnect while still waiting for session admission aborts that queued request instead. Send POST /api/chat/{runId}/cancel with the owning agentId and optional reason for explicit cancellation. Cancellation is a request to stop active work, not rollback of tools already executed. Current source also propagates Stop into compaction database checkout/owned-query cancellation and waits for safe drain or durable fencing before another write-capable owner proceeds. A cancelling run can remain visible during that drain; reset generation checks fence stale writes.

After a disconnect, query GET /api/chat/runs/active with agentId/sessionId, then reload session history. Active-run state is in memory and is not a durable streaming replay cursor. There is no automatic resumption of the same event stream. Avoid blindly reposting a turn, which can run it twice.

Steering an active turn​

POST /api/chat/{runId}/steer submits new user input to a run. Supply its owning agentId, exact sessionId, a nonblank idempotencyKey, and message (or supported image attachment input). GET /api/chat/{runId}/steering?agentId=...&sessionId=... reads the durable submissions and their status. Both routes use the normal API authentication boundary.

StatusMeaning
pendingStored, waiting for a runtime boundary
deliveredHanded into the model continuation and recorded for prompt replay
follow_upRun stopped accepting input before delivery; not automatically sent as a new turn

A successful POST confirms storage, not delivery or completion of the requested work. Poll steering status and inspect the resulting transcript. Inputs are delivered at runtime boundaries; steering does not undo a tool already executed. Reuse an idempotency key only for an identical retry: changed payloads return 409 steering_idempotency_conflict. A reset generation mismatch returns 409 chat_run_session_reset; an unknown run returns 404 chat_run_not_found. Stopping the run or recovering after the server no longer has it active can leave input marked follow_up; review it before explicitly sending a new turn to avoid duplicated work.

Explicit inputs while chat is busy​

Ordinary POST /api/chat now rejects a busy main session, or a session with queued/held/running main inputs, with 409 chat_session_busy_use_explicit_intent. That is not acceptance. Choose explicitly between steering the existing run, queueing a new turn, or asking a side question.

MethodPathResult
GET/api/chat/inputs?agentId=...&sessionId=...{ok, generation, inputs} for the current reset generation, in acceptance order
POST/api/chat/inputs202 {ok, input} for durable acceptance or an identical retry
POST/api/chat/inputs/{inputId}/cancelCurrent input state; a running cancellation can remain running with cancelRequested: true
POST/api/chat/inputs/{inputId}/resumeSelected input plus all held main inputs changed to queued

Submission needs intent: "queue_next" or "side_question", a nonblank idempotencyKey, and message or supported attachment input. Supply agentId, sessionId, and the current generation from GET. Actions use the input UUID, not its generated run ID. The key binds normalized payload and generation: identical retries return the original input/snapshot; changed payloads return chat_input_idempotency_conflict. A stale generation returns chat_input_generation_conflict; reread before acting rather than silently retrying after reset.

  • Queue next: durable FIFO new main turns, dispatched independently of the browser. Completion or failure allows the next eligible item; owner loss records interrupted work rather than automatically repeating side effects.
  • Side question: additionally requires the exact active main targetRunId. It answers from a frozen bounded snapshot in one tool-free model call; no commands, fresh inspection, or interruption of the main run. Historical attachment contents are not replayed. Snapshot context is not fresh verification. Side answers do not automatically enter main context/continuity.
  • Promote deliberately: edit the desired instruction and submit a new queue input or live steer with promotedFrom set to a succeeded side-question input UUID from the same agent/session/generation. This records provenance; it does not copy the answer automatically.

Statuses are queued, held, running, succeeded, failed, cancelled, and interrupted. Acceptance is not completion: poll the retained result/error. Input responses include submitted message and attachment contents; protect them. Side snapshot responses expose only metadata, not the captured raw transcript/profile. Active-run projections distinguish lane: main|side_question and optional inputId.

Stop of the main run, /stop even when idle, or cancellation of a running queue turn holds current and future main queue entries. Resuming a held item releases all held entries in FIFO order; it does not restart cancelled work. Cancelling a queued/held item cancels that item; cancelling a side question does not hold the main queue. /new/reset advances generation and fences old work/results.

Endpoint inventory​

Methods are significant. Braced segments are placeholders; URL-encode identifiers. See the contract and conventions for artifact limitations.

MethodPathPurpose
POST/api/chatRun one chat turn
GET/api/chat/runs/activeList active chat runs
POST/api/chat/{runId}/cancelCancel a chat run
POST/api/chat/{runId}/steerSubmit idempotent steering input
GET/api/chat/{runId}/steeringRead durable steering input/status

Source review​

Reconciled on 2026-11-08 against Backend commit 6b682eae6cd0dc6efa79e173b7d819fb219443b3; static source inspection only, with no live API or provider calls.

27 October delta review​

Changed contracts checked statically against Backend 32ff99dfc0317635f5c7aa53b4c9ec18266d4c09 on 2026-10-27. This does not recertify unchanged historical sections or report live API/provider tests.

28 October development delta​

Changed behavior above was checked statically against Backend a04acb16b0eab2a910c3ef0fb452622df81a05cb on 2026-10-28. This is not a live provider, database or collector test, nor a revalidation of unchanged historical sections. See source coverage.

29 October development delta​

Changed contracts above were checked statically against Backend 4057b50a5d5a9b14d36bb3b70f35781c4b29a9b9 on 2026-10-29. This is not a runtime, provider or collector test, nor a revalidation of unchanged historical sections. See source coverage.

Structured terminal results​

Normal terminal summaries/results include chatResultVersion: 2 and terminalStatus (completed, failed, cancelled, or superseded). Transport-error/cancellation envelopes without a result carry these at the response root. The terminal event agrees with the outcome; stop/stale-generation precedence remains unchanged.

modelFailure and modelRecovery are runtime metadata, not assistant prose. Failed assistant rows contain only genuine partial text from the last physical attempt, or empty content when none exists, and are display-only (entersPrompt:false). Empty metadata-bearing failures remain visible in Chat, Archive and recovery reads; abandoned attempts and private thought are not concatenated into answers. Consumers must read structured metadata rather than infer errors from an answer prefix.

Only the backend compatibility projection interprets old [model_error: …] text, and only for unversioned assistant rows with producer evidence (decision:model_failed or kind:subagent-model-error). Literal matching text alone is not failure evidence; raw legacy exports remain unchanged.

Provider explanations and pending Forge deliveries​

Checked 14 November 2026: optional modelFailure.message preserves an actual diagnostic explanation from upstream, runtime-internal or unknown failures, credential-redacted before a 2,048-character limit. Configured protected values are sanitized while their boundary scope is still available; later projections retain the sanitized message rather than rereading raw exception text. Classification and retry eligibility do not depend on this prose. Known credentials and recognizable secret patterns are removed, but arbitrary unlabeled secrets cannot be exhaustively inferred; review before sharing. Missing explanations use generic UI fallback. Terminal streaming, persisted/reloaded assistant metadata, child results and side-question ChatInput.result preserve the field. Side-question results also carry chatResultVersion:2 and terminalStatus.

GET /api/chat/runs/active?agentId=...&sessionId=... can include pendingForgeDeliveries for that exact destination. The Chat client refreshes while delivery is pending and once when it settles, including after a cancelled model run. A pending job is not an active model run, and this does not refresh unrelated idle conversations. See native Forge delivery.

Delete a group channel​

Checked 9 November 2026: DELETE /api/group-channels/{channelId} returns 200 {"ok":true,"id":"<channelId>"} on success, 404 group_channel_not_found for an absent room, or 400 group_channel_id_invalid for an invalid ID (including . and ..). It cancels active room replies, removes metadata and deletes only the shared group-channel transcript identity. Individual/participant sessions remain.

Admission, shared transcript appends and deletion share a per-room serialized boundary in the UI server. A send admitted after deletion cannot launch replies or recreate its history. Database failure leaves metadata in place for retry, although active replies have already been cancelled. Scheduled jobs are not removed; subsequent integration-routed deliveries to the missing room fail. The native scheduler has no group-channel destination field. This is a destructive room action, not closing a browser tab or resetting one participant's session.

Registered slash commands and complete attachments​

Checked 12 November 2026: Only registered slash-command names are intercepted. Unknown slash text, malformed non-command slash text and absolute paths remain ordinary chat input; arguments to known commands are still validated. Accepted attachment text/data URLs retain the original payload instead of silently clipping it to the context-preview budget. This does not bypass request or configured upload limits.

15 November full static review​

Rechecked the documented route family and its current implementation boundaries against Backend 29ca7b6cec378700503a587703adc1d82e9d6f6d. Historical source links and earlier receipts above remain historical. This pass inspected source and contracts; it did not execute API calls, application tests or model/provider work.