Skip to main content
Inspector

Inspector Connect

Open the Inspector WebSocket used for live actor inspection.

The inspector API powers the Rivet dashboard and is subject to change without notice. Do not build production integrations on it.

The inspector connection exposes the same live data used by the Rivet dashboard. {actor} is an actor ID. See Actor Routing.

GET wss://api.rivet.dev/gateway/{actor}/inspector/connect?protocol_version=6

Handshake

Pass these WebSocket subprotocols in this order:

SubprotocolPurpose
rivetSelects the Rivet WebSocket protocol.
rivet_target.actorRoutes the connection to an actor.
rivet_actor.{actor}Identifies the actor.
rivet_encoding.bareSelects BARE binary messages.
rivet_token.{token}Authenticates the gateway request.
rivet_inspector_token.{token}Authenticates access to the inspector.

Each actor stores its inspector token in its KV storage under the single byte 0x03. Read it through the control plane with GET /actors/{actor_id}/kv/keys/Aw==?namespace={namespace} using a namespace token, then base64-decode the response value before adding it to rivet_inspector_token.<token>.

Set protocol_version=6 for the message shapes on this page. Supported values are 1 through 6. Omitting the parameter selects the legacy version 5 framing, which embeds a version in every message.

Message envelope

Messages are binary BARE frames, not JSON text. Import the versioned codecs from rivetkit/inspector/client as shown above. The decoded envelope is { body: { tag, val } }. Fields with type data contain CBOR bytes. Decode those bytes with a CBOR codec. The JSON examples below show the decoded logical shape, with CBOR values expanded for readability. Unsigned integers decode to JavaScript bigint.

Most requests have a client-selected id. Their response uses the same value as rid. PatchStateRequest has no response.

Client to actor messages

PatchStateRequest

Replaces the actor state.

FieldTypeRequiredDescription
statedataYesNew state encoded as CBOR.
{ "body": { "tag": "PatchStateRequest", "val": { "state": { "count": 2 } } } }

StateRequest

Requests the current state.

FieldTypeRequiredDescription
iduintYesRequest identifier.
{ "body": { "tag": "StateRequest", "val": { "id": 1 } } }

ConnectionsRequest

Requests the current connections.

FieldTypeRequiredDescription
iduintYesRequest identifier.
{ "body": { "tag": "ConnectionsRequest", "val": { "id": 2 } } }

ActionRequest

Calls an actor action.

FieldTypeRequiredDescription
iduintYesRequest identifier.
namestringYesAction name.
argsdataYesAction arguments encoded as CBOR.
{ "body": { "tag": "ActionRequest", "val": { "id": 3, "name": "increment", "args": [1] } } }

RpcsListRequest

Requests the available action names.

FieldTypeRequiredDescription
iduintYesRequest identifier.
{ "body": { "tag": "RpcsListRequest", "val": { "id": 4 } } }

TraceQueryRequest

Queries traces in a time range.

FieldTypeRequiredDescription
iduintYesRequest identifier.
startMsuintYesInclusive start time in Unix milliseconds.
endMsuintYesEnd time in Unix milliseconds.
limituintYesMaximum number of records.
{ "body": { "tag": "TraceQueryRequest", "val": { "id": 5, "startMs": 1735689600000, "endMs": 1735689660000, "limit": 100 } } }

QueueRequest

Requests queue status. The actor limits limit to 200.

FieldTypeRequiredDescription
iduintYesRequest identifier.
limituintYesMaximum number of message summaries.
{ "body": { "tag": "QueueRequest", "val": { "id": 6, "limit": 50 } } }

WorkflowHistoryRequest

Requests workflow history.

FieldTypeRequiredDescription
iduintYesRequest identifier.
{ "body": { "tag": "WorkflowHistoryRequest", "val": { "id": 7 } } }

WorkflowReplayRequest

Replays a workflow from an optional history entry.

FieldTypeRequiredDescription
iduintYesRequest identifier.
entryIdstringNoHistory entry to replay from. null starts from the beginning.
{ "body": { "tag": "WorkflowReplayRequest", "val": { "id": 8, "entryId": "step-2" } } }

DatabaseSchemaRequest

Requests the SQLite schema.

FieldTypeRequiredDescription
iduintYesRequest identifier.
{ "body": { "tag": "DatabaseSchemaRequest", "val": { "id": 9 } } }

DatabaseTableRowsRequest

Requests rows from a SQLite table.

FieldTypeRequiredDescription
iduintYesRequest identifier.
tablestringYesTable name.
limituintYesMaximum rows to return.
offsetuintYesNumber of rows to skip.
{ "body": { "tag": "DatabaseTableRowsRequest", "val": { "id": 10, "table": "users", "limit": 50, "offset": 0 } } }

SchedulesRequest

Requests all schedules.

FieldTypeRequiredDescription
iduintYesRequest identifier.
{ "body": { "tag": "SchedulesRequest", "val": { "id": 11 } } }

ScheduleHistoryRequest

Requests recent fires for one schedule.

FieldTypeRequiredDescription
iduintYesRequest identifier.
scheduleIdstringYesSchedule identifier.
limituintYesMaximum history entries.
{ "body": { "tag": "ScheduleHistoryRequest", "val": { "id": 12, "scheduleId": "cleanup", "limit": 20 } } }

ScheduleDeleteRequest

Deletes a schedule.

FieldTypeRequiredDescription
iduintYesRequest identifier.
scheduleIdstringYesSchedule identifier.
kindstringYesSchedule kind: at, cron, or every.
{ "body": { "tag": "ScheduleDeleteRequest", "val": { "id": 13, "scheduleId": "cleanup", "kind": "cron" } } }

Actor to client messages

Init

Sent when inspection starts. It contains the initial snapshot.

FieldTypeRequiredDescription
connectionsConnection[]YesCurrent connections. Each item has string id and CBOR details.
statedataNoCurrent state encoded as CBOR.
isStateEnabledbooleanYesWhether the actor uses state.
rpcsstring[]YesAvailable action names.
isDatabaseEnabledbooleanYesWhether SQLite is enabled.
queueSizeuintYesCurrent queued message count.
workflowHistorydataNoWorkflow history transport data.
isWorkflowEnabledbooleanYesWhether workflows are enabled.
tabConfigTabConfigEntry[]YesInspector tabs. Each item has id, optional label, optional icon, and boolean hidden.
schedulesSchedule[]YesCurrent schedules.
{ "body": { "tag": "Init", "val": { "connections": [], "state": { "count": 1 }, "isStateEnabled": true, "rpcs": ["increment"], "isDatabaseEnabled": true, "queueSize": 0, "workflowHistory": null, "isWorkflowEnabled": false, "tabConfig": [{ "id": "state", "label": null, "icon": null, "hidden": false }], "schedules": [] } } }

StateResponse

FieldTypeRequiredDescription
riduintYesMatching request identifier.
statedataNoState encoded as CBOR.
isStateEnabledbooleanYesWhether state is enabled.
{ "body": { "tag": "StateResponse", "val": { "rid": 1, "state": { "count": 2 }, "isStateEnabled": true } } }

ConnectionsResponse

FieldTypeRequiredDescription
riduintYesMatching request identifier.
connectionsConnection[]YesConnections with string id and CBOR details.
{ "body": { "tag": "ConnectionsResponse", "val": { "rid": 2, "connections": [{ "id": "conn-1", "details": { "name": "Sam" } }] } } }

ActionResponse

FieldTypeRequiredDescription
riduintYesMatching request identifier.
outputdataYesAction output encoded as CBOR.
{ "body": { "tag": "ActionResponse", "val": { "rid": 3, "output": 2 } } }

RpcsListResponse

FieldTypeRequiredDescription
riduintYesMatching request identifier.
rpcsstring[]YesAvailable action names.
{ "body": { "tag": "RpcsListResponse", "val": { "rid": 4, "rpcs": ["increment"] } } }

TraceQueryResponse

FieldTypeRequiredDescription
riduintYesMatching request identifier.
payloaddataYesTrace range transport payload.
{ "body": { "tag": "TraceQueryResponse", "val": { "rid": 5, "payload": { "records": [] } } } }

QueueResponse

FieldTypeRequiredDescription
riduintYesMatching request identifier.
status.sizeuintYesCurrent queue size.
status.maxSizeuintYesQueue capacity.
status.messagesQueueMessageSummary[]YesSummaries with uint id, string name, and uint createdAtMs.
status.truncatedbooleanYesWhether more summaries were available.
{ "body": { "tag": "QueueResponse", "val": { "rid": 6, "status": { "size": 1, "maxSize": 1000, "messages": [{ "id": 42, "name": "email", "createdAtMs": 1735689600000 }], "truncated": false } } } }

WorkflowHistoryResponse

FieldTypeRequiredDescription
riduintYesMatching request identifier.
historydataNoWorkflow history transport data.
isWorkflowEnabledbooleanYesWhether workflows are enabled.
{ "body": { "tag": "WorkflowHistoryResponse", "val": { "rid": 7, "history": null, "isWorkflowEnabled": false } } }

WorkflowReplayResponse

FieldTypeRequiredDescription
riduintYesMatching request identifier.
historydataNoUpdated workflow history transport data.
isWorkflowEnabledbooleanYesWhether workflows are enabled.
{ "body": { "tag": "WorkflowReplayResponse", "val": { "rid": 8, "history": { "entries": [] }, "isWorkflowEnabled": true } } }

DatabaseSchemaResponse

FieldTypeRequiredDescription
riduintYesMatching request identifier.
schemadataYesSQLite schema encoded as CBOR.
{ "body": { "tag": "DatabaseSchemaResponse", "val": { "rid": 9, "schema": { "tables": [] } } } }

DatabaseTableRowsResponse

FieldTypeRequiredDescription
riduintYesMatching request identifier.
resultdataYesRows encoded as CBOR.
{ "body": { "tag": "DatabaseTableRowsResponse", "val": { "rid": 10, "result": [{ "id": 1 }] } } }

SchedulesResponse

FieldTypeRequiredDescription
riduintYesMatching request identifier.
schedulesSchedule[]YesCurrent schedules.
{ "body": { "tag": "SchedulesResponse", "val": { "rid": 11, "schedules": [] } } }

ScheduleHistoryResponse

FieldTypeRequiredDescription
riduintYesMatching request identifier.
scheduleIdstringYesSchedule identifier.
historyScheduleFire[]YesSchedule fire history.
{ "body": { "tag": "ScheduleHistoryResponse", "val": { "rid": 12, "scheduleId": "cleanup", "history": [{ "action": "cleanup", "scheduledAt": 1735689600000, "firedAt": 1735689600010, "finishedAt": 1735689600040, "result": "ok", "error": null }] } } }

ScheduleDeleteResponse

FieldTypeRequiredDescription
riduintYesMatching request identifier.
scheduleIdstringYesSchedule identifier.
deletedbooleanYesWhether a schedule was deleted.
{ "body": { "tag": "ScheduleDeleteResponse", "val": { "rid": 13, "scheduleId": "cleanup", "deleted": true } } }

ConnectionsUpdated

Sent when the connection list changes.

FieldTypeRequiredDescription
connectionsConnection[]YesCurrent connections.
{ "body": { "tag": "ConnectionsUpdated", "val": { "connections": [] } } }

StateUpdated

Sent when state changes.

FieldTypeRequiredDescription
statedataYesState encoded as CBOR.
{ "body": { "tag": "StateUpdated", "val": { "state": { "count": 3 } } } }

QueueUpdated

Sent when the queue size changes.

FieldTypeRequiredDescription
queueSizeuintYesCurrent queue size.
{ "body": { "tag": "QueueUpdated", "val": { "queueSize": 2 } } }

WorkflowHistoryUpdated

Sent when workflow history changes.

FieldTypeRequiredDescription
historydataYesWorkflow history transport data.
{ "body": { "tag": "WorkflowHistoryUpdated", "val": { "history": { "entries": [] } } } }

SchedulesUpdated

Sent when schedules change.

FieldTypeRequiredDescription
schedulesSchedule[]YesCurrent schedules.
{ "body": { "tag": "SchedulesUpdated", "val": { "schedules": [] } } }

Error

Reports an inspector protocol error. This message does not carry a request identifier.

FieldTypeRequiredDescription
messagestringYesError identifier or description.
{ "body": { "tag": "Error", "val": { "message": "inspector.events_dropped" } } }

Shared structures

Schedule contains id, optional name, kind, action, CBOR args, nextRunAt, optional lastRunAt, optional expression, optional timezone, optional intervalMs, and optional maxHistory. All time and interval values are unsigned integers in milliseconds.

ScheduleFire contains action, scheduledAt, firedAt, optional finishedAt, result, and optional error. An error contains group, code, message, and optional CBOR metadata.

Close behavior

An invalid or unsupported protocol_version closes the socket with code 1002 and reason inspector.invalid_protocol_version. A missing or invalid inspector token closes it with code 1008 and reason inspector.unauthorized. Other established-connection errors can arrive as Error messages.