Skip to main content

Protocol reference (TQA protocol v1)

The frames the runtime, the gateway and clients exchange. The source of truth is the JSON Schema exported from tqa-types, crates/tqa-types/schema/tqa-protocol-v1.json (ADR-0010); this page names every frame, event, error code and type in it, and gate G-09-complete fails when it misses one or names one the schema doesn't have. The design is ARCHITECTURE §9; the HTTP API is crates/tqa-gateway/openapi.json.

Bindings and rules​

  • Runtime link: one WebSocket per sandbox, dialled out by the runtime with its per-run token. Client binding: server-sent events down (GET /conversations/{id}/events?stream=1&protocol=1) and plain POSTs up.
  • seq is assigned by the runtime per conversation and checked contiguous by the gateway; a gap closes the link or stream with seq_gap. On the client binding each event's SSE id: is its seq, and a reconnect with Last-Event-ID (or after=<seq>) replays from PostgreSQL, then continues live: every event exactly once (ADR-0005).
  • Client inputs are exact (unknown fields and malformed values are refused); server frames ignore unknown fields, so additive changes keep older readers working. The runtime link carries a revision (ADR-0026).
  • Frames have a size cap; tool.output is chunked; the stream sends a keep-alive comment every 15 s. Actions carry an idempotency key.
  • Retired frames and codes (ADR-0035 removed approvals) are read only from histories written before it; a runtime that sends one is refused.

Client frames (ClientFrame)​

TypeBindingWhat it does
session.initbothOpen a conversation and ask for replay from last_seq
user.messagebothSend a message (POST /conversations/{id}/messages)
run.cancelbothAsk a run to stop (POST …/runs/{run_id}/cancel)
session.configlink, gateway → runtimeThe conversation's configuration: route, profile, environment, limits, network allow-list, last seq
session.updatelink, gateway → runtimeA new route for the runs that follow
workspace.requestlink, gateway → runtimeA workspace operation (list, read, stat...) the files panel needs
workspace.cancellink, gateway → runtimeCancel a workspace request
screen.sign_outlink, gateway → runtimeSign the desktop's browser out everywhere (ADR-0039)
screen.keep_sign_inlink, gateway → runtimeThe task's "keep the sign-in" switch changed: on (revision 15, ADR-0039 section 6); session.config carries keep_sign_in when on
screen.storedlink, gateway → runtimeWhether the gateway kept an uploaded screenshot

Server frames (ServerFrame)​

TypeBindingWhat it carries
session.readybothThe sandbox's state and queue position; unsequenced, sent before replay and on each change
eventbothOne durable event (below), always with its seq
errorbothA classified failure (ErrorCode, below), with a seq when it concerns one frame
heartbeatlink, runtime → gatewayRun supervisor liveness every 30 s; never stored or sent on
workspace.replylink, runtime → gatewayOne part of a workspace request's answer; never stored
screen.uploadlink, runtime → gatewayA chunk of a screenshot for the gateway's store
screen.sign_out.donelink, runtime → gatewayThe answer to screen.sign_out, once the browser has started again: ok, reason, and ready (the browser back and focused; absent: true)
screen.resetlink, runtime → gatewayA desktop run's end reset is over: ok (the profile emptied) and ready (the browser back and focused; absent: true); kept (absent: false) when the task keeps its sign-in and the profile stayed (revision 15)
message.queueclientThe messages waiting behind the task's run changed
task.titledclientThe model named the task
team.changedclientThe task's agent team changed (ADR-0034)
screen.noticeclientA screen notice the gateway stored (ADR-0039)
host_key.usedclientThe run used a host key, once per run and key (ADR-0037)
host_key.refusedclientThe proxy refused a keyed call; nothing reached the host
permission.requestretiredAn approval request (ADR-0035)

Events (Event, inside event)​

TypeMeaning
message.userThe accepted user message, so history is complete from events alone
run.startedA run begins
context.loadedWhat the run loaded into the model's context: instruction files, skills, skipped skill folders
step.startedA step begins, with its attempt; a retried step supersedes the earlier attempt's output
text.deltaA visible text fragment
reasoning.deltaA reasoning fragment
reasoning.stateOpaque provider reasoning state, kept in stream order (ADR-0027)
tool.callA tool call is prepared
model.completedThe attempt's whole response arrived
tool.startA tool starts
tool.outputAn ordered output chunk, what the person sees
tool.endA tool reaches its end state; a failed call carries its code and, for a refused destination, the target
tool.resultExactly what goes into the model's context, after capping
step.completedEvery call of the step has a result; with the step's duration
compactionOlder turns were replaced by a structured summary
usageToken usage
budget.warningA run budget reached its warning threshold
provider.retryA model attempt failed and another follows after back-off; a text-protocol retry names what was wrong (fallback_problem), never the reply's content
route.fallbackThe run moved to another route after its route failed
decisionA decision the engine made and the loop applied (ADR-0013)
decision.fallbackThe loop set the engine's answer aside for the step
mcp.serverAn MCP server's state for the session (ADR-0011)
workspace.cloneProgress of the first clone of a repository into the workspace
workspace.fullThe workspace ran out of space
environment.changedThe environment's template or capabilities changed
screen.captureA screenshot a computer call took, stored before it is journaled (ADR-0039)
sandbox.stateThe sandbox's lifecycle state changed
run.completedThe run ended successfully
run.cancelledThe run stopped after a cancel
run.failedThe run stopped with a classified failure
run.resumedA journaled run resumed at a complete step
permission.resolvedretired: an approval's answer (ADR-0035)
permission.expiredretired: an approval that expired
run.parkedretired: a run parked for an approval

Error codes (ErrorCode)​

CodeMeaning
unknown_frameA frame kind the receiver doesn't know; resending it unchanged can't help
invalid_frameA malformed frame; correct it first
seq_gapA sequence gap; reconnect and replay
unsupported_protocolAn unsupported protocol version
busyNo capacity now; a later attempt may succeed
egress_deniedThe network allow-list refused the destination
restartingThe gateway is restarting
store_unavailableThe database is briefly unavailable
provider_errorThe model provider failed; it may recover
budgetA run budget is used up
repeated_failureThe same failure repeated; it needs a person
no_progressThe run stopped making progress
fallback_parseOn a route without native tool calls, the reply could not be read as a tool call, even after one retry
ioA disk or read failure
internalAn internal invariant failed
sandbox_failedA sandbox could not start or register
runtime_start_failedThe runtime exited before it registered
action_failedAn accepted action failed to run
workspace_quotaThe workspace is over its quota
state_quotaThe conversation's runtime state is over its bound; an administrator must act
decision_stopA decision engine stopped the run (ADR-0013)
decision_engine_unavailableThe task's decision engine is gone or disabled
decision_engine_budget_spentThe decision engine used its budget for the period
reply_cutThe model's reply hit its output limit while the run's own budget was left
host_keys_unsupportedThe environment's runtime is too old to take host keys; the run goes on without them
approvals_removedWritten only by the upgrade, for a run parked for an approval when ADR-0035 removed them
permission_bindingretired: an approval binding that no longer held (ADR-0008, superseded)

Other types​

The schema's remaining definitions, by area; their fields and bounds are in the schema.

  • Identifiers and positions: ConversationId, RunId, ToolCallId, WorkspaceId, Seq, QueuePosition, QueueReason, ActionHash, AttachmentPath, ErrorTarget.
  • Session configuration: RouteSnapshot, WireProtocol, CacheHint, ReasoningSnapshot, ReasoningItem, ProfileSnapshot, Environment, RunLimits, ComputerLimits, NetworkSnapshot, NetworkEntry, WorkspaceSnapshot, WorkspaceClone, WorkspaceCloneStatus, SandboxBackend, SandboxState, SandboxSummary, SandboxRecovery, PermissionContext.
  • Runs and tools: FinishReason, BudgetKind, CompactionSource, CompactionSummary, ToolStatus, ToolFailure, UploadedFile, LoadedInstruction, LoadedSkill, SkippedSkill, SkillSkipReason, SkillTier, FallbackProblem, ProblemName, ProblemPath, JsonType.
  • Decision engines: DecisionEngineSnapshot, DecisionExposure, DecisionPoint, DecisionChoice, DecisionFallbackReason.
  • MCP servers: McpServer, McpServerState, McpToolFilter, McpTransport.
  • Workspace requests: WorkspaceOp, WorkspaceResult, WorkspaceErrorCode, ListItem, StatItem, EntryKind, ManifestEntry.
  • Host keys: HostKeyGrant, HostKeyScheme, HostKeyOutcome.
  • Agent teams: Brief, LeadBrief, TeamWake, WorkspaceMode.
  • Channels (ADR-0014's amendment of 20 Nov 2026, revision 16): ChannelWake, ChannelId.
  • Computer use: CapturePhase, ScreenEvidence, ScreenNoticeKind, ScreenNoticeReason, ScreenPerson, ScreenRole, ScreenTarget, ScreenEnded, SignOutFailure, StoreRefusal.
  • Retired Git push (ADR-0037 §7): GitPushAuthorization, GitPushFailure, GitPushOperationId, GitPushOperationRequest, GitPushReceipt, GitPushRelayError, GitPushTarget.