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
Pass these WebSocket subprotocols in this order:
Subprotocol Purpose 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.
import * as cbor from "cbor-x" ;
import {
CURRENT_VERSION ,
TO_CLIENT_VERSIONED ,
TO_SERVER_VERSIONED ,
} from "rivetkit/inspector/client" ;
const ws = new WebSocket (
`wss://api.rivet.dev/gateway/ ${ actorId } /inspector/connect?protocol_version= ${ CURRENT_VERSION } ` ,
[
"rivet" ,
"rivet_target.actor" ,
`rivet_actor. ${ actorId } ` ,
"rivet_encoding.bare" ,
`rivet_token. ${ apiToken } ` ,
`rivet_inspector_token. ${ inspectorToken } ` ,
] ,
) ;
ws . binaryType = "arraybuffer" ;
ws . onmessage = ( event ) => {
const message = TO_CLIENT_VERSIONED . deserialize (
new Uint8Array (event . data) ,
CURRENT_VERSION ,
) ;
if (message . body . tag === "StateUpdated" ) {
console . log (cbor . decode ( new Uint8Array (message . body . val . state))) ;
}
console . log (message . body) ;
} ;
ws . onopen = () => {
ws . send ( TO_SERVER_VERSIONED . serialize ({
body : { tag : "StateRequest" , val : { id : 1 n } } ,
} , CURRENT_VERSION )) ;
} ;
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.
Replaces the actor state.
Field Type Required Description statedataYes New state encoded as CBOR.
{ "body" : { "tag" : "PatchStateRequest" , "val" : { "state" : { "count" : 2 } } } }
Requests the current state.
Field Type Required Description iduintYes Request identifier.
{ "body" : { "tag" : "StateRequest" , "val" : { "id" : 1 } } }
Requests the current connections.
Field Type Required Description iduintYes Request identifier.
{ "body" : { "tag" : "ConnectionsRequest" , "val" : { "id" : 2 } } }
Calls an actor action.
Field Type Required Description iduintYes Request identifier. namestringYes Action name. argsdataYes Action arguments encoded as CBOR.
{ "body" : { "tag" : "ActionRequest" , "val" : { "id" : 3 , "name" : "increment" , "args" : [ 1 ] } } }
Requests the available action names.
Field Type Required Description iduintYes Request identifier.
{ "body" : { "tag" : "RpcsListRequest" , "val" : { "id" : 4 } } }
Queries traces in a time range.
Field Type Required Description iduintYes Request identifier. startMsuintYes Inclusive start time in Unix milliseconds. endMsuintYes End time in Unix milliseconds. limituintYes Maximum number of records.
{ "body" : { "tag" : "TraceQueryRequest" , "val" : { "id" : 5 , "startMs" : 1735689600000 , "endMs" : 1735689660000 , "limit" : 100 } } }
Requests queue status. The actor limits limit to 200.
Field Type Required Description iduintYes Request identifier. limituintYes Maximum number of message summaries.
{ "body" : { "tag" : "QueueRequest" , "val" : { "id" : 6 , "limit" : 50 } } }
Requests workflow history.
Field Type Required Description iduintYes Request identifier.
{ "body" : { "tag" : "WorkflowHistoryRequest" , "val" : { "id" : 7 } } }
Replays a workflow from an optional history entry.
Field Type Required Description iduintYes Request identifier. entryIdstringNo History entry to replay from. null starts from the beginning.
{ "body" : { "tag" : "WorkflowReplayRequest" , "val" : { "id" : 8 , "entryId" : "step-2" } } }
Requests the SQLite schema.
Field Type Required Description iduintYes Request identifier.
{ "body" : { "tag" : "DatabaseSchemaRequest" , "val" : { "id" : 9 } } }
Requests rows from a SQLite table.
Field Type Required Description iduintYes Request identifier. tablestringYes Table name. limituintYes Maximum rows to return. offsetuintYes Number of rows to skip.
{ "body" : { "tag" : "DatabaseTableRowsRequest" , "val" : { "id" : 10 , "table" : "users" , "limit" : 50 , "offset" : 0 } } }
Requests all schedules.
Field Type Required Description iduintYes Request identifier.
{ "body" : { "tag" : "SchedulesRequest" , "val" : { "id" : 11 } } }
Requests recent fires for one schedule.
Field Type Required Description iduintYes Request identifier. scheduleIdstringYes Schedule identifier. limituintYes Maximum history entries.
{ "body" : { "tag" : "ScheduleHistoryRequest" , "val" : { "id" : 12 , "scheduleId" : "cleanup" , "limit" : 20 } } }
Deletes a schedule.
Field Type Required Description iduintYes Request identifier. scheduleIdstringYes Schedule identifier. kindstringYes Schedule kind: at, cron, or every.
{ "body" : { "tag" : "ScheduleDeleteRequest" , "val" : { "id" : 13 , "scheduleId" : "cleanup" , "kind" : "cron" } } }
Sent when inspection starts. It contains the initial snapshot.
Field Type Required Description connectionsConnection[]Yes Current connections. Each item has string id and CBOR details. statedataNo Current state encoded as CBOR. isStateEnabledbooleanYes Whether the actor uses state. rpcsstring[]Yes Available action names. isDatabaseEnabledbooleanYes Whether SQLite is enabled. queueSizeuintYes Current queued message count. workflowHistorydataNo Workflow history transport data. isWorkflowEnabledbooleanYes Whether workflows are enabled. tabConfigTabConfigEntry[]Yes Inspector tabs. Each item has id, optional label, optional icon, and boolean hidden. schedulesSchedule[]Yes Current 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" : [] } } }
Field Type Required Description riduintYes Matching request identifier. statedataNo State encoded as CBOR. isStateEnabledbooleanYes Whether state is enabled.
{ "body" : { "tag" : "StateResponse" , "val" : { "rid" : 1 , "state" : { "count" : 2 } , "isStateEnabled" : true } } }
Field Type Required Description riduintYes Matching request identifier. connectionsConnection[]Yes Connections with string id and CBOR details.
{ "body" : { "tag" : "ConnectionsResponse" , "val" : { "rid" : 2 , "connections" : [{ "id" : "conn-1" , "details" : { "name" : "Sam" } }] } } }
Field Type Required Description riduintYes Matching request identifier. outputdataYes Action output encoded as CBOR.
{ "body" : { "tag" : "ActionResponse" , "val" : { "rid" : 3 , "output" : 2 } } }
Field Type Required Description riduintYes Matching request identifier. rpcsstring[]Yes Available action names.
{ "body" : { "tag" : "RpcsListResponse" , "val" : { "rid" : 4 , "rpcs" : [ "increment" ] } } }
Field Type Required Description riduintYes Matching request identifier. payloaddataYes Trace range transport payload.
{ "body" : { "tag" : "TraceQueryResponse" , "val" : { "rid" : 5 , "payload" : { "records" : [] } } } }
Field Type Required Description riduintYes Matching request identifier. status.sizeuintYes Current queue size. status.maxSizeuintYes Queue capacity. status.messagesQueueMessageSummary[]Yes Summaries with uint id, string name, and uint createdAtMs. status.truncatedbooleanYes Whether more summaries were available.
{ "body" : { "tag" : "QueueResponse" , "val" : { "rid" : 6 , "status" : { "size" : 1 , "maxSize" : 1000 , "messages" : [{ "id" : 42 , "name" : "email" , "createdAtMs" : 1735689600000 }] , "truncated" : false } } } }
Field Type Required Description riduintYes Matching request identifier. historydataNo Workflow history transport data. isWorkflowEnabledbooleanYes Whether workflows are enabled.
{ "body" : { "tag" : "WorkflowHistoryResponse" , "val" : { "rid" : 7 , "history" : null , "isWorkflowEnabled" : false } } }
Field Type Required Description riduintYes Matching request identifier. historydataNo Updated workflow history transport data. isWorkflowEnabledbooleanYes Whether workflows are enabled.
{ "body" : { "tag" : "WorkflowReplayResponse" , "val" : { "rid" : 8 , "history" : { "entries" : [] } , "isWorkflowEnabled" : true } } }
Field Type Required Description riduintYes Matching request identifier. schemadataYes SQLite schema encoded as CBOR.
{ "body" : { "tag" : "DatabaseSchemaResponse" , "val" : { "rid" : 9 , "schema" : { "tables" : [] } } } }
Field Type Required Description riduintYes Matching request identifier. resultdataYes Rows encoded as CBOR.
{ "body" : { "tag" : "DatabaseTableRowsResponse" , "val" : { "rid" : 10 , "result" : [{ "id" : 1 }] } } }
Field Type Required Description riduintYes Matching request identifier. schedulesSchedule[]Yes Current schedules.
{ "body" : { "tag" : "SchedulesResponse" , "val" : { "rid" : 11 , "schedules" : [] } } }
Field Type Required Description riduintYes Matching request identifier. scheduleIdstringYes Schedule identifier. historyScheduleFire[]Yes Schedule fire history.
{ "body" : { "tag" : "ScheduleHistoryResponse" , "val" : { "rid" : 12 , "scheduleId" : "cleanup" , "history" : [{ "action" : "cleanup" , "scheduledAt" : 1735689600000 , "firedAt" : 1735689600010 , "finishedAt" : 1735689600040 , "result" : "ok" , "error" : null }] } } }
Field Type Required Description riduintYes Matching request identifier. scheduleIdstringYes Schedule identifier. deletedbooleanYes Whether a schedule was deleted.
{ "body" : { "tag" : "ScheduleDeleteResponse" , "val" : { "rid" : 13 , "scheduleId" : "cleanup" , "deleted" : true } } }
Sent when the connection list changes.
Field Type Required Description connectionsConnection[]Yes Current connections.
{ "body" : { "tag" : "ConnectionsUpdated" , "val" : { "connections" : [] } } }
Sent when state changes.
Field Type Required Description statedataYes State encoded as CBOR.
{ "body" : { "tag" : "StateUpdated" , "val" : { "state" : { "count" : 3 } } } }
Sent when the queue size changes.
Field Type Required Description queueSizeuintYes Current queue size.
{ "body" : { "tag" : "QueueUpdated" , "val" : { "queueSize" : 2 } } }
Sent when workflow history changes.
Field Type Required Description historydataYes Workflow history transport data.
{ "body" : { "tag" : "WorkflowHistoryUpdated" , "val" : { "history" : { "entries" : [] } } } }
Sent when schedules change.
Field Type Required Description schedulesSchedule[]Yes Current schedules.
{ "body" : { "tag" : "SchedulesUpdated" , "val" : { "schedules" : [] } } }
Reports an inspector protocol error. This message does not carry a request identifier.
Field Type Required Description messagestringYes Error identifier or description.
{ "body" : { "tag" : "Error" , "val" : { "message" : "inspector.events_dropped" } } }
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.
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.