
Live Cursors
- 1k installs
- 18 repo stars
- Updated July 31, 2026
- rivet-dev/skills
Add real-time multiplayer cursor overlays, presence, and collaborative pointers to Rivet-backed web apps without hand-rolling WebSocket state.
About
Guides implementation of live collaborative cursors in Rivet-powered applications: subscribing to peer presence, rendering animated pointer overlays, handling disconnects, and keeping cursor state consistent across tenants and sessions for multiplayer editing or co-browsing experiences.
- Realtime cursor positions
- Multiplayer presence UI
- Rivet sync integration
- Low-latency overlay rendering
- Collaborative SaaS UX
Live Cursors by the numbers
- 1,019 all-time installs (skills.sh)
- +189 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Ranked #374 of 2,245 Frontend Development skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/rivet-dev/skills --skill live-cursorsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1k |
|---|---|
| repo stars | ★ 18 |
| Last updated | July 31, 2026 |
| Repository | rivet-dev/skills ↗ |
What it does
Add real-time multiplayer cursor overlays, presence, and collaborative pointers to Rivet-backed web apps without hand-rolling WebSocket state.
Files
Rivet Actors
Build high-performance, long-lived, in-memory processes on Rivet's actor runtime. Use this skill whenever HTTP endpoints, databases, or queues no longer meet the requirements for AI agents, realtime collaboration, workflow orchestration, or geo-distributed data.
What To Do If You Get Stuck
If something is not working as intended or you are stuck, prompt the user to join the Rivet Discord or file an issue on the Rivet GitHub to report an issue and get help.
Provide the user with a pre-generated report with:
- Symptoms
- If this is happening in local dev, deployed, or both
- The error you're seeing
- Relevant source code related to this
- What you've tried to solve it
- Environment
- RivetKit version
- Runtime (Node, Bun, etc) including version
- If applicable, provider in use (e.g. Vercel, Railway, etc)
- If applicable, HTTP router in use (e.g. Hono, Express, Elysia)
Debugging Actors
Use the inspector HTTP API to examine running actors. These endpoints are accessible through the gateway at /gateway/{actor_id}/inspector/*. Key endpoints:
GET /inspector/summary- full actor snapshot (state, connections, RPCs, queue)GET /inspector/state/PATCH /inspector/state- read/write actor stateGET /inspector/connections- active connectionsGET /inspector/rpcs- available actionsPOST /inspector/action/{name}- execute an action with{"args": [...]}POST /inspector/database/execute- run SQL with{"sql": "...", "args": [...]}or{"sql": "...", "properties": {...}}for reads or mutationsGET /inspector/queue?limit=50- queue statusGET /inspector/traces?startMs=0&endMs=...&limit=1000- trace spans (OTLP JSON)GET /inspector/workflow-history- workflow history and status as JSON (nameRegistry,entries,entryMetadata)POST /inspector/workflow/replay- replay a workflow from a specific step or from the beginning; returns409 actor/workflow_in_flightif the workflow is still runningGET /inspector/database/schema- SQLite tables and views exposed byc.dbGET /inspector/database/rows?table=...&limit=100&offset=0- paged SQLite rows for a table or view
In local dev, no auth token is needed. In production, pass Authorization: Bearer <inspector-token>, where the inspector token is the actor-specific token auto-generated on first start and persisted in the actor's internal KV at key 0x03. The Rivet dashboard retrieves this token automatically; for direct API access, fetch it through the management KV endpoint. See the debugging docs for details.
Citing Sources
When providing information from Rivet documentation, cite the canonical URL so users can learn more. Each reference file includes its canonical URL in the header metadata.
How to cite:
- Use inline links for key concepts: "Use actor keys to uniquely identify instances."
- Add a "Learn more" link after explanations for complex topics
Finding canonical URLs:
The Reference Map below links to reference files. Each file's header contains:
> Canonical URL: https://rivet.dev/docs/actors/actionsUse that canonical URL when citing, not the reference file path.
Examples:
- Actions →
https://rivet.dev/docs/actors/actions - React client →
https://rivet.dev/docs/clients/react - Self-hosting on Kubernetes →
https://rivet.dev/docs/self-hosting/kubernetes
Version Check
Before starting any work, check if the user's project is on the latest version of RivetKit (latest: 2.3.0-rc.12). Look at the rivetkit version in the user's package.json (check both dependencies and devDependencies). If the installed version is older than 2.3.0-rc.12, inform the user and suggest upgrading:
npm install rivetkit@2.3.0-rc.12If the user also uses @rivetkit/react, @rivetkit/next-js, or other @rivetkit/* client packages, suggest upgrading those too. Outdated versions may have known bugs or missing features that cause issues.
First Steps
1. Install RivetKit (latest: 2.3.0-rc.12)
npm install rivetkit@2.3.0-rc.122. Define a registry with setup({ use: { /* actors */ } }). 3. Call registry.start() to start the server. For custom HTTP server integration, use registry.handler() with a router like Hono. For serverless deployments, use registry.serve(). For runner-only mode, use registry.startRunner(). 4. Verify /api/rivet/metadata returns 200 before deploying. 5. Configure Rivet Cloud or self-hosted engine
- You must configure versioning for production builds. This is not needed for local development. See Versions & Upgrades.
6. Integrate clients (see client guides below for JavaScript, React, or Swift) 7. Prompt the user if they want to deploy. If so, go to Deploying Rivet Backends.
For more information, read the quickstart guide relevant to the user's project.
Project Setup
.gitignore
Every RivetKit project should have a .gitignore. Include at minimum:
node_modules/
dist/
.env.dockerignore
Every project with a Dockerfile should have a .dockerignore to keep the image small and avoid leaking secrets:
node_modules/
dist/
.env
.git/Dockerfile
Use this as a base Dockerfile for deploying a RivetKit project. The RIVET_RUNNER_VERSION build arg is only needed when self-hosting or using a custom runner (not needed for Rivet Compute). It lets Rivet track which version of the actor is running and drain old actors on deploy. See https://rivet.dev/docs/actors/versions for details.
FROM node:24-alpine
ARG RIVET_RUNNER_VERSION
ENV RIVET_RUNNER_VERSION=$RIVET_RUNNER_VERSION
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build --if-present
CMD ["node", "dist/index.js"]Build with:
docker build --build-arg RIVET_RUNNER_VERSION=$(date +%s) .Adjust the CMD to match the project's entry point. If the project uses a different output directory or start command, update accordingly.
Error Handling Policy
- Prefer fail-fast behavior by default.
- Avoid
try/catchunless it is required for a real recovery path, cleanup boundary, or to add actionable context. - Never swallow errors. If you add a
catch, you must handle the error explicitly, at minimum by logging it. - When you cannot recover, log context and rethrow.
State vs Vars: Persistence Rules
`c.vars` is ephemeral. Data in c.vars is lost on every restart, crash, upgrade, or sleep/wake cycle. Only use c.vars for non-serializable objects (e.g., physics engines, WebSocket references, event emitters, caches) or truly transient runtime data (e.g., current input direction that doesn't matter after disconnect).
Persistent storage options. Any data that must survive restarts belongs in one of these, NOT in c.vars:
- `c.state` — CBOR-serializable data for small, bounded datasets. Ideal for configuration, counters, small player lists, phase flags, etc. Keep under 128 KB. Do not store unbounded or growing data here (e.g., chat logs, event histories, spawned entity lists that grow without limit). State is read/written as a single blob on every persistence cycle.
- `c.kv` — Key-value store for unbounded data. This is what
c.stateuses under the hood. Supports binary values. Use for larger or variable-size data like user inventories, world chunks, file blobs, or any collection that may grow over time. Keys are scoped to the actor instance. - `c.db` — SQLite database for structured or complex data. Use when you need queries, indexes, joins, aggregations, or relational modeling. Ideal for leaderboards, match histories, player pools, or any data that benefits from SQL.
Common mistake: Storing meaningful game/application data in c.vars instead of persisting it. For example, if users can spawn objects in a physics simulation, the spawn definitions (position, size, type) must be persisted in c.state (or c.kv if unbounded), even though the physics engine handles (non-serializable) live in c.vars. On restart, run() should recreate the runtime objects from the persisted data.
Deploying Rivet Backends
Assume the user is deploying to Rivet Cloud, unless otherwise specified. If user is self-hosting, read the self-hosting guides below.
1. Verify that Rivet Actors are working in local dev 2. Prompt the user to choose a provider to deploy to (see Connect for a list of providers, such as Vercel, Railway, etc) 3. Follow the deploy guide for that given provider. You will need to instruct the user when you need manual intervention.
API Reference
The RivetKit OpenAPI specification is available in the skill directory at openapi.json. This file documents all HTTP endpoints for managing actors.
Misc Notes
- The Rivet domain is rivet.dev, not rivet.gg
TypeScript Caveat: Actor Client Inference
- In multi-file TypeScript projects, bidirectional actor calls can create a circular type dependency when both actors use
c.client<typeof registry>(). - Symptoms usually include
c.statebecomingunknown, actor methods becoming possiblyundefined, orTS2322/TS2722errors after the first cross-actor call. - If an action returns the result of another actor call, prefer an explicit return type annotation on that action instead of relying on inference through
c.client<typeof registry>(). - If explicit return types are not enough, use a narrower client or registry type for only the actors that action needs.
- As a last resort, pass
unknownfor the registry type and be explicit that this gives up type safety at that call site.
Features
- Long-Lived, Stateful Compute: Each unit of compute is like a tiny server that remembers things between requests – no need to re-fetch data from a database or worry about timeouts. Like AWS Lambda, but with memory and no timeouts.
- Blazing-Fast Reads & Writes: State is stored on the same machine as your compute, so reads and writes are ultra-fast. No database round trips, no latency spikes. State is persisted to Rivet for long term storage, so it survives server restarts.
- Realtime: Update state and broadcast changes in realtime with WebSockets. No external pub/sub systems, no polling – just built-in low-latency events.
- Infinitely Scalable: Automatically scale from zero to millions of concurrent actors. Pay only for what you use with instant scaling and no cold starts.
- Fault Tolerant: Built-in error handling and recovery. Actors automatically restart on failure while preserving state integrity and continuing operations.
When to Use Rivet Actors
- AI agents & sandboxes: multi-step toolchains, conversation memory, sandbox orchestration.
- Multiplayer or collaborative apps: CRDT docs, shared cursors, realtime dashboards, chat.
- Workflow automation: background jobs, cron, rate limiters, durable queues, backpressure control.
- Data-intensive backends: geo-distributed or per-tenant databases, in-memory caches, sharded SQL.
- Networking workloads: WebSocket servers, custom protocols, local-first sync, edge fanout.
Minimal Project
Backend
index.ts
import { actor, event, setup } from "rivetkit";
const counter = actor({
state: { count: 0 },
events: {
count: event<number>(),
},
actions: {
increment: (c, amount: number) => {
c.state.count += amount;
c.broadcast("count", c.state.count);
return c.state.count;
},
},
});
export const registry = setup({
use: { counter },
});
registry.start();Client Docs
Use the client SDK that matches your app:
Actor Quick Reference
In-Memory State
Persistent data that survives restarts, crashes, and deployments. State is persisted on Rivet Cloud or Rivet self-hosted, so it survives restarts if the current process crashes or exits.
Static Initial State
import { actor } from "rivetkit";
const counter = actor({
state: { count: 0 },
actions: {
increment: (c) => c.state.count += 1,
},
});
Dynamic Initial State
import { actor } from "rivetkit";
interface CounterState {
count: number;
}
const counter = actor({
createState: (c, input: { start?: number }): CounterState => ({
count: input.start ?? 0,
}),
actions: {
increment: (c) => c.state.count += 1,
},
});Keys
Keys uniquely identify actor instances. Use compound keys (arrays) for hierarchical addressing:
import { actor, setup } from "rivetkit";
import { createClient } from "rivetkit/client";
const chatRoom = actor({
state: { messages: [] as string[] },
actions: {
getRoomInfo: (c) => ({ org: c.key[0], room: c.key[1] }),
},
});
const registry = setup({ use: { chatRoom } });
const client = createClient<typeof registry>("http://localhost:6420");
// Compound key: [org, room]
client.chatRoom.getOrCreate(["org-acme", "general"]);
// Access key inside actor via c.keyDon't build keys with string interpolation like "org:${userId}" when userId contains user data. Use arrays instead to prevent key injection attacks.
Input
Pass initialization data when creating actors. Input is only available in createState and onCreate, so store it in state if you need it later.
import { actor, setup } from "rivetkit";
import { createClient } from "rivetkit/client";
const game = actor({
state: { mode: "" },
createState: (c, input: { mode: string }) => ({
mode: input.mode, // Store input in state for later access
}),
actions: {
getMode: (c) => c.state.mode,
},
});
const registry = setup({ use: { game } });
const client = createClient<typeof registry>("http://localhost:6420");
// Client usage
const gameHandle = client.game.getOrCreate(["game-1"], {
createWithInput: { mode: "ranked" },
});Temporary Variables
Temporary data that doesn't survive restarts. Use for non-serializable objects (event emitters, connections, etc).
Static Initial Vars
import { actor } from "rivetkit";
const counter = actor({
state: { count: 0 },
vars: { lastAccess: 0 },
actions: {
increment: (c) => {
c.vars.lastAccess = Date.now();
return c.state.count += 1;
},
},
});
Dynamic Initial Vars
import { actor } from "rivetkit";
const counter = actor({
state: { count: 0 },
createVars: () => ({
emitter: new EventTarget(),
}),
actions: {
increment: (c) => {
c.vars.emitter.dispatchEvent(new Event("change"));
return c.state.count += 1;
},
},
});Actions
Actions are the primary way clients and other actors communicate with an actor.
import { actor } from "rivetkit";
const counter = actor({
state: { count: 0 },
actions: {
increment: (c, amount: number) => (c.state.count += amount),
getCount: (c) => c.state.count,
},
});Events & Broadcasts
Events enable real-time communication from actors to connected clients.
import { actor, event } from "rivetkit";
const chatRoom = actor({
state: { messages: [] as string[] },
events: {
newMessage: event<{ text: string }>(),
},
actions: {
sendMessage: (c, text: string) => {
// Broadcast to ALL connected clients
c.broadcast("newMessage", { text });
},
},
});Connections
Access the current connection via c.conn or all connected clients via c.conns. Use c.conn.id or c.conn.state to securely identify who is calling an action. c.conn is only available for actions invoked through a connected client; stateless actor-handle calls run without a connection, so guard against that. Connection state is initialized via connState or createConnState, which receives parameters passed by the client on connect.
Static Connection Initial State
import { actor } from "rivetkit";
const chatRoom = actor({
state: {},
connState: { visitorId: 0 },
onConnect: (c, conn) => {
conn.state.visitorId = Math.random();
},
actions: {
whoAmI: (c) => c.conn.state.visitorId,
},
});
Dynamic Connection Initial State
import { actor } from "rivetkit";
const chatRoom = actor({
state: {},
// params passed from client
createConnState: (c, params: { userId: string }) => ({
userId: params.userId,
}),
actions: {
// Access current connection's state and params
whoAmI: (c) => ({
state: c.conn.state,
params: c.conn.params,
}),
// Iterate all connections with c.conns
notifyOthers: (c, text: string) => {
for (const conn of c.conns.values()) {
if (conn !== c.conn) conn.send("notification", { text });
}
},
},
});Queues
Use queues to process durable messages in order inside a run loop.
import { actor, queue } from "rivetkit";
const counter = actor({
state: { value: 0 },
queues: {
increment: queue<{ amount: number }>(),
},
run: async (c) => {
for await (const message of c.queue.iter()) {
c.state.value += message.body.amount;
}
},
});Workflows
Use workflows when your run logic needs durable, replayable multi-step execution.
import { actor, queue } from "rivetkit";
import { workflow } from "rivetkit/workflow";
const worker = actor({
state: { processed: 0 },
queues: {
tasks: queue<{ url: string }>(),
},
run: workflow(async (ctx) => {
await ctx.loop("task-loop", async (loopCtx) => {
const message = await loopCtx.queue.next("wait-task");
await loopCtx.step("process-task", async () => {
await processTask(message.body.url);
loopCtx.state.processed += 1;
});
});
}),
});
async function processTask(url: string): Promise<void> {
const res = await fetch(url, { method: "POST" });
if (!res.ok) throw new Error(`Task failed: ${res.status}`);
}Actor-to-Actor Communication
Actors can call other actors using c.client().
import { actor, setup } from "rivetkit";
const inventory = actor({
state: { stock: 100 },
actions: {
reserve: (c, amount: number) => {
c.state.stock -= amount;
},
},
});
const order = actor({
state: {},
actions: {
process: async (c) => {
const client = c.client<typeof registry>();
await client.inventory.getOrCreate(["main"]).reserve(1);
},
},
});
const registry = setup({ use: { inventory, order } });Scheduling
Schedule actions to run after a delay or at a specific time. Schedules persist across restarts, upgrades, and crashes.
import { actor, event } from "rivetkit";
const reminder = actor({
state: { message: "" },
events: {
reminder: event<{ message: string }>(),
},
actions: {
// Schedule action to run after delay (ms)
setReminder: (c, message: string, delayMs: number) => {
c.state.message = message;
c.schedule.after(delayMs, "sendReminder");
},
// Schedule action to run at specific timestamp
setReminderAt: (c, message: string, timestamp: number) => {
c.state.message = message;
c.schedule.at(timestamp, "sendReminder");
},
sendReminder: (c) => {
c.broadcast("reminder", { message: c.state.message });
},
},
});Destroying Actors
Permanently delete an actor and its state using c.destroy().
import { actor } from "rivetkit";
const userAccount = actor({
state: { email: "", name: "" },
onDestroy: (c) => {
console.log(`Account ${c.state.email} deleted`);
},
actions: {
deleteAccount: (c) => {
c.destroy();
},
},
});Lifecycle Hooks
Actors support hooks for initialization, background processing, connections, networking, and state changes. Use run for long-lived background loops, and use c.aborted or c.abortSignal for graceful shutdown.
import { actor, event, queue } from "rivetkit";
interface RoomState {
users: Record<string, boolean>;
name?: string;
}
interface RoomInput {
roomName: string;
}
interface ConnState {
userId: string;
joinedAt: number;
}
const chatRoom = actor({
events: {
stateChanged: event<RoomState>(),
},
queues: {
work: queue<{ task: string }>(),
},
// State & vars initialization
createState: (c, input: RoomInput): RoomState => ({
users: {},
name: input.roomName,
}),
createVars: () => ({ startTime: Date.now() }),
// Actor lifecycle
onCreate: (c) => console.log("created", c.key),
onDestroy: (c) => console.log("destroyed"),
onWake: (c) => console.log("actor started"),
onSleep: (c) => console.log("actor sleeping"),
run: async (c) => {
for await (const message of c.queue.iter()) {
console.log("processing", message.body.task);
}
},
onStateChange: (c, newState) => c.broadcast("stateChanged", newState),
// Connection lifecycle
createConnState: (c, params): ConnState => ({
userId: (params as { userId: string }).userId,
joinedAt: Date.now(),
}),
onBeforeConnect: (c, params) => {
/* validate auth */
},
onConnect: (c, conn) => console.log("connected:", (conn.state as ConnState).userId),
onDisconnect: (c, conn) => console.log("disconnected:", (conn.state as ConnState).userId),
// Networking
onRequest: (c, req) => new Response(JSON.stringify(c.state)),
onWebSocket: (c, socket) => socket.addEventListener("message", console.log),
// Response transformation
onBeforeActionResponse: <Out>(
c: unknown,
name: string,
args: unknown[],
output: Out,
): Out => output,
actions: {},
});Context Types
When writing helper functions outside the actor definition, use *ContextOf<typeof myActor> to extract the correct context type. Helpers like ActionContextOf, CreateContextOf, ConnContextOf, and ConnInitContextOf are exported from "rivetkit". Do not manually define your own context interface. Always derive it from the actor definition.
import { actor, ActionContextOf } from "rivetkit";
const gameRoom = actor({
state: { players: [] as string[], score: 0 },
actions: {
addPlayer: (c, playerId: string) => {
validatePlayer(c, playerId);
c.state.players.push(playerId);
},
},
});
// Good: derive context type from actor definition
function validatePlayer(c: ActionContextOf<typeof gameRoom>, playerId: string) {
if (c.state.players.includes(playerId)) {
throw new Error("Player already in room");
}
}
// Bad: don't manually define context types like this
// type MyContext = { state: { players: string[] }; ... };Errors
Use UserError to throw errors that are safely returned to clients. Pass metadata to include structured data. Other errors are converted to generic "internal error" for security.
Actor
import { actor, UserError } from "rivetkit";
const user = actor({
state: { username: "" },
actions: {
updateUsername: (c, username: string) => {
if (username.length < 3) {
throw new UserError("Username too short", {
code: "username_too_short",
metadata: { minLength: 3, actual: username.length },
});
}
c.state.username = username;
},
},
});
Client
import { actor, setup, UserError } from "rivetkit";
import { createClient, ActorError } from "rivetkit/client";
const user = actor({
state: { username: "" },
actions: {
updateUsername: (c, username: string) => {
if (username.length < 3) {
throw new UserError("Username too short", {
code: "username_too_short",
metadata: { minLength: 3, actual: username.length },
});
}
c.state.username = username;
},
},
});
const registry = setup({ use: { user } });
const client = createClient<typeof registry>("http://localhost:6420");
try {
await client.user.getOrCreate([]).updateUsername("ab");
} catch (error) {
if (error instanceof ActorError) {
console.log(error.code); // "username_too_short"
console.log(error.metadata); // { minLength: 3, actual: 2 }
}
}Low-Level HTTP & WebSocket Handlers
For custom protocols or integrating libraries that need direct access to HTTP Request/Response or WebSocket connections, use onRequest and onWebSocket.
HTTP Handler Documentation · WebSocket Handler Documentation
Icons & Names
Customize how actors appear in the UI with display names and icons. It's recommended to always provide a name and icon to actors in order to make them easier to distinguish in the dashboard.
import { actor } from "rivetkit";
const chatRoom = actor({
options: {
name: "Chat Room",
icon: "💬", // or FontAwesome: "comments", "chart-line", etc.
},
// ...
});Client Documentation
Find the full client guides here:
Common Patterns
Actors scale naturally through isolated state and message-passing. Structure your applications with these patterns:
Actor Per Entity
Create one actor per user, document, or room. Use compound keys to scope entities:
```ts client.ts import { createClient } from "rivetkit/client"; import type { registry } from "./index";
const client = createClient<typeof registry>("http://localhost:6420");
// Single key: one actor per user client.user.getOrCreate(["user-123"]);
// Compound key: document scoped to an organization client.document.getOrCreate(["org-acme", "doc-456"]);
````
```ts index.ts import { actor, setup } from "rivetkit";
export const user = actor({ state: { name: "" }, actions: {}, });
export const document = actor({ state: { content: "" }, actions: {}, });
export const registry = setup({ use: { user, document } });
registry.start(); ````
Coordinator & Data Actors
Data actors handle core logic (chat rooms, game sessions, user data). Coordinator actors track and manage collections of data actors—think of them as an index.
```ts index.ts import { actor, setup } from "rivetkit";
// Coordinator: tracks chat rooms within an organization export const chatRoomList = actor({ state: { rooms: [] as string[] }, actions: { addRoom: async (c, name: string) => { // Create the chat room actor const client = c.client<typeof registry>(); await client.chatRoom.create([c.key[0], name]); c.state.rooms.push(name); }, listRooms: (c) => c.state.rooms, }, });
// Data actor: handles a single chat room export const chatRoom = actor({ state: { messages: [] as string[] }, actions: { send: (c, msg: string) => { c.state.messages.push(msg); }, }, });
export const registry = setup({ use: { chatRoomList, chatRoom } });
registry.start();
````
```ts client.ts import { createClient } from "rivetkit/client"; import type { registry } from "./index";
const client = createClient<typeof registry>("http://localhost:6420");
// Coordinator per org const coordinator = client.chatRoomList.getOrCreate(["org-acme"]); await coordinator.addRoom("general"); await coordinator.addRoom("random");
// Access chat rooms created by coordinator client.chatRoom.get(["org-acme", "general"]); ````
Run Loop
Use a run loop for continuous background work inside an actor. Process queue messages in order, run logic on intervals, stream AI responses, or coordinate long-running tasks.
import { actor, queue, setup } from "rivetkit";
const counterWorker = actor({
state: { value: 0 },
queues: {
mutate: queue<{ delta: number }>(),
},
run: async (c) => {
for await (const message of c.queue.iter()) {
c.state.value += message.body.delta;
}
},
actions: {
getValue: (c) => c.state.value,
},
});
const registry = setup({ use: { counterWorker } });Workflow Loop
Use this pattern for long-lived, durable workflows that initialize resources, process commands in a loop, then clean up.
import { actor, queue, setup } from "rivetkit";
import { Loop, workflow } from "rivetkit/workflow";
type WorkMessage = { amount: number };
type ControlMessage = { type: "stop"; reason: string };
const worker = actor({
state: {
phase: "idle" as "idle" | "running" | "stopped",
processed: 0,
total: 0,
stopReason: null as string | null,
},
queues: {
work: queue<WorkMessage>(),
control: queue<ControlMessage>(),
},
run: workflow(async (ctx) => {
await ctx.step("setup", async () => {
await fetch("https://api.example.com/workers/init", {
method: "POST",
});
ctx.state.phase = "running";
ctx.state.stopReason = null;
});
const stopReason = await ctx.loop("worker-loop", async (loopCtx) => {
const message = await loopCtx.queue.next("wait-command", {
names: ["work", "control"],
});
if (message.name === "work") {
await loopCtx.step("apply-work", async () => {
await fetch("https://api.example.com/workers/process", {
method: "POST",
body: JSON.stringify({ amount: message.body.amount }),
});
loopCtx.state.processed += 1;
loopCtx.state.total += message.body.amount;
});
return;
}
return Loop.break((message.body as ControlMessage).reason);
});
await ctx.step("teardown", async () => {
await fetch("https://api.example.com/workers/shutdown", {
method: "POST",
});
ctx.state.phase = "stopped";
ctx.state.stopReason = stopReason;
});
}),
});
const registry = setup({ use: { worker } });Actions vs Queues
- Actions are not durable. Use them for realtime reads, ephemeral data, and low-latency communication like player input.
- Queues are durable. Use them to serialize mutations through the run loop, avoiding race conditions with SQLite and other local state. Callers can still wait for a response from queued work.
Authentication, Security, & CORS
- Validate credentials in
onBeforeConnectorcreateConnStateand throw an error to reject unauthorized connections. - Use
c.conn.stateto securely identify users in actions rather than trusting action parameters. - For cross-origin access, validate the request origin in
onBeforeConnect.
Authentication Documentation · CORS Documentation
Versions & Upgrades
When deploying new code, set a version number so Rivet can route new actors to the latest runner and optionally drain old ones. Use a build timestamp, git commit count, or CI build number as the version. It is very important to configure versioning before deploying to production. Without versioning, actors can regress by running on older runner versions, and existing actors will never be forced to migrate to new runners. They will continue running indefinitely on the old runners until they exit.
Anti-Patterns
Never build a "god" actor
Do not put all your logic in a single actor. A god actor serializes every operation through one bottleneck, kills parallelism, and makes the entire system fail as a unit. Split into focused actors per entity.
Never create an actor per request
Actors are long-lived and maintain state across requests. Creating a new actor for every incoming request throws away the core benefit of the model and wastes resources on actor creation and teardown. Use actors for persistent entities and regular functions for stateless work.
Reference Map
Actors
- Access Control
- Actions
- Actor Keys
- Actor Scheduling
- Actor Statuses
- Authentication
- Cloudflare Workers Quickstart
- Communicating Between Actors
- Connections
- Custom Inspector Tabs
- Debugging
- Design Patterns
- Destroying Actors
- Effect.ts Quickstart (Beta)
- Errors
- Fetch and WebSocket Handler
- Helper Types
- Icons & Names
- In-Memory State
- Input Parameters
- Lifecycle
- Limits
- Low-Level HTTP Request Handler
- Low-Level KV Storage
- Low-Level WebSocket Handler
- Metadata
- Next.js Quickstart
- Node.js & Bun Quickstart
- Queues & Run Loops
- React Quickstart
- Realtime
- Rust Quickstart (Beta)
- Scaling & Concurrency
- Sharing and Joining State
- SQLite
- SQLite + Drizzle
- Supabase Functions Quickstart
- Testing
- Troubleshooting
- Types
- Vanilla HTTP API
- Versions & Upgrades
- Workflows
Agent Os
- Agent-to-Agent Communication
- agentOS vs Sandbox
- Authentication
- Benchmarks
- Configuration
- Core Package
- Crash Course
- Cron Jobs
- Deployment
- Embedded LLM Gateway
- Events
- Filesystem
- Limitations
- LLM Credentials
- Multiplayer
- Networking & Previews
- Permissions
- Persistence & Sleep
- Pi
- Processes & Shell
- Queues
- Quickstart
- Sandbox Mounting
- Security & Auth
- Security Model
- Sessions
- Software
- SQLite
- System Prompt
- Tools
- Webhooks
- Workflow Automation
Cli
- CLI
Clients
- Node.js & Bun
- React
- Swift
- SwiftUI
Cookbook
- AI Agent
- AI Agent Workspaces
- Chat Room
- Collaborative Text Editor
- Cron Jobs and Scheduled Tasks
- Database per Tenant
- Deploying Rivet in a VPC or Air-Gapped Network
- Live Cursors and Presence
- Multiplayer Game
Deploy
- Deploy To Amazon Web Services Lambda
- Deploying to AWS ECS
- Deploying to Cloudflare Workers
- Deploying to Freestyle
- Deploying to Google Cloud Run
- Deploying to Hetzner
- Deploying to Kubernetes
- Deploying to Railway
- Deploying to Rivet Compute
- Deploying to Supabase Functions
- Deploying to Vercel
- Deploying to VMs & Bare Metal
General
- Actor Configuration
- Architecture
- Cross-Origin Resource Sharing
- Documentation for LLMs & AI
- Edge Networking
- Endpoints
- Environment Variables
- HTTP Server
- Logging
- Pool Configuration
- Production Checklist
- Registry Configuration
- Runtime Modes
- WASM vs Native SDK
Self Hosting
- Configuration
- Docker Compose
- Docker Container
- File System
- FoundationDB (Enterprise)
- Installing Rivet Engine
- Kubernetes
- Multi-Region
- PostgreSQL
- Production Checklist
- Railway Deployment
- Render Deployment
- TLS & Certificates
{
"name": "live-cursors",
"description": "Live cursors and multiplayer presence with Rivet Actors: per-connection cursor state, realtime updates over events or raw WebSockets, and throttling.",
"skill_url": "/metadata/skills/live-cursors/SKILL.md",
"generated_at": "2026-06-15T20:24:02.560Z",
"references": [
{
"name": "actors/access-control",
"title": "Access Control",
"description": "Authorize actions, queue publishes, and event subscriptions with explicit hooks.",
"canonical_url": "https://rivet.dev/docs/actors/access-control",
"reference_url": "/metadata/skills/live-cursors/reference/actors/access-control.md"
},
{
"name": "actors/actions",
"title": "Actions",
"description": "Actions are how your backend, frontend, or other actors can communicate with actors.",
"canonical_url": "https://rivet.dev/docs/actors/actions",
"reference_url": "/metadata/skills/live-cursors/reference/actors/actions.md"
},
{
"name": "general/actor-configuration",
"title": "Actor Configuration",
"description": "This page documents the configuration options available when defining a RivetKit actor. The actor configuration is passed to the `actor()` function.",
"canonical_url": "https://rivet.dev/docs/general/actor-configuration",
"reference_url": "/metadata/skills/live-cursors/reference/general/actor-configuration.md"
},
{
"name": "actors/keys",
"title": "Actor Keys",
"description": "Actor keys uniquely identify actor instances within each actor type. Keys are used for addressing which specific actor to communicate with.",
"canonical_url": "https://rivet.dev/docs/actors/keys",
"reference_url": "/metadata/skills/live-cursors/reference/actors/keys.md"
},
{
"name": "actors/schedule",
"title": "Actor Scheduling",
"description": "Schedule actor actions in the future with persistent timers that survive restarts and upgrades.",
"canonical_url": "https://rivet.dev/docs/actors/schedule",
"reference_url": "/metadata/skills/live-cursors/reference/actors/schedule.md"
},
{
"name": "actors/statuses",
"title": "Actor Statuses",
"description": "Understand the lifecycle statuses of Rivet Actors, what they mean, how they appear in the API, and how to troubleshoot common issues.",
"canonical_url": "https://rivet.dev/docs/actors/statuses",
"reference_url": "/metadata/skills/live-cursors/reference/actors/statuses.md"
},
{
"name": "agent-os/agent-to-agent",
"title": "Agent-to-Agent Communication",
"description": "Use host tools to let agents communicate with each other.",
"canonical_url": "https://rivet.dev/docs/agent-os/agent-to-agent",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/agent-to-agent.md"
},
{
"name": "agent-os/versus-sandbox",
"title": "agentOS vs Sandbox",
"description": "When to use the lightweight agentOS VM, a full sandbox, or both together.",
"canonical_url": "https://rivet.dev/docs/agent-os/versus-sandbox",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/versus-sandbox.md"
},
{
"name": "cookbook/ai-agent",
"title": "AI Agent",
"description": "Build an AI agent backend with persistent memory: one Rivet Actor per conversation, queued message handling, and streaming LLM responses as realtime events.",
"canonical_url": "https://rivet.dev/cookbook/ai-agent",
"reference_url": "/metadata/skills/live-cursors/reference/cookbook/ai-agent.md"
},
{
"name": "cookbook/ai-agent-workspace",
"title": "AI Agent Workspaces",
"description": "Give every AI agent its own computer: a persistent workspace with a filesystem, processes, shells, networking, and agent sessions on a lightweight in-process OS.",
"canonical_url": "https://rivet.dev/cookbook/ai-agent-workspace",
"reference_url": "/metadata/skills/live-cursors/reference/cookbook/ai-agent-workspace.md"
},
{
"name": "general/architecture",
"title": "Architecture",
"description": "- rivetkit is the typescript library used for both local development & to connect your application to rivet - a rivetkit instance is called a \"runner.\" you can run multiple runners to scale rivetkit horiziotnally. read omre about runners below.",
"canonical_url": "https://rivet.dev/docs/general/architecture",
"reference_url": "/metadata/skills/live-cursors/reference/general/architecture.md"
},
{
"name": "actors/authentication",
"title": "Authentication",
"description": "Secure your actors with authentication and authorization.",
"canonical_url": "https://rivet.dev/docs/actors/authentication",
"reference_url": "/metadata/skills/live-cursors/reference/actors/authentication.md"
},
{
"name": "agent-os/authentication",
"title": "Authentication",
"description": "Authenticate connections to agentOS actors using hooks.",
"canonical_url": "https://rivet.dev/docs/agent-os/authentication",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/authentication.md"
},
{
"name": "agent-os/benchmarks",
"title": "Benchmarks",
"description": "Performance benchmarks comparing agentOS to traditional sandbox providers.",
"canonical_url": "https://rivet.dev/docs/agent-os/benchmarks",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/benchmarks.md"
},
{
"name": "cookbook/chat-room",
"title": "Chat Room",
"description": "Build a realtime chat room backend with Rivet Actors: one actor per room, SQLite-backed message history, and WebSocket broadcast to every connected client.",
"canonical_url": "https://rivet.dev/cookbook/chat-room",
"reference_url": "/metadata/skills/live-cursors/reference/cookbook/chat-room.md"
},
{
"name": "cli",
"title": "CLI",
"description": "Reference for the optional rivet CLI: deploy to Rivet Compute and run local dev for serverless platforms.",
"canonical_url": "https://rivet.dev/docs/cli",
"reference_url": "/metadata/skills/live-cursors/reference/cli.md"
},
{
"name": "actors/quickstart/cloudflare",
"title": "Cloudflare Workers Quickstart",
"description": "Set up a Rivet project locally targeting Cloudflare Workers.",
"canonical_url": "https://rivet.dev/docs/actors/quickstart/cloudflare",
"reference_url": "/metadata/skills/live-cursors/reference/actors/quickstart/cloudflare.md"
},
{
"name": "cookbook/collaborative-text-editor",
"title": "Collaborative Text Editor",
"description": "Build a collaborative text editor backend with Yjs CRDTs and Rivet Actors: per-document actors relay sync and awareness updates and persist snapshots.",
"canonical_url": "https://rivet.dev/cookbook/collaborative-text-editor",
"reference_url": "/metadata/skills/live-cursors/reference/cookbook/collaborative-text-editor.md"
},
{
"name": "actors/communicating-between-actors",
"title": "Communicating Between Actors",
"description": "Learn how actors can call other actors and share data",
"canonical_url": "https://rivet.dev/docs/actors/communicating-between-actors",
"reference_url": "/metadata/skills/live-cursors/reference/actors/communicating-between-actors.md"
},
{
"name": "agent-os/configuration",
"title": "Configuration",
"description": "Configure the agentOS VM options, preview settings, and lifecycle hooks.",
"canonical_url": "https://rivet.dev/docs/agent-os/configuration",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/configuration.md"
},
{
"name": "self-hosting/configuration",
"title": "Configuration",
"description": "Rivet Engine can be configured through environment variables or configuration files.",
"canonical_url": "https://rivet.dev/docs/self-hosting/configuration",
"reference_url": "/metadata/skills/live-cursors/reference/self-hosting/configuration.md"
},
{
"name": "actors/connections",
"title": "Connections",
"description": "Connections represent client connections to your actor. They provide a way to handle client authentication, manage connection-specific data, and control the connection lifecycle.",
"canonical_url": "https://rivet.dev/docs/actors/connections",
"reference_url": "/metadata/skills/live-cursors/reference/actors/connections.md"
},
{
"name": "agent-os/core",
"title": "Core Package",
"description": "Use @rivet-dev/agent-os-core standalone for direct VM control without the Rivet Actor runtime.",
"canonical_url": "https://rivet.dev/docs/agent-os/core",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/core.md"
},
{
"name": "agent-os/crash-course",
"title": "Crash Course",
"description": "Run coding agents inside isolated VMs with full filesystem, process, and network control.",
"canonical_url": "https://rivet.dev/docs/agent-os/crash-course",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/crash-course.md"
},
{
"name": "agent-os/cron",
"title": "Cron Jobs",
"description": "Schedule recurring commands and agent sessions in agentOS VMs.",
"canonical_url": "https://rivet.dev/docs/agent-os/cron",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/cron.md"
},
{
"name": "cookbook/cron-jobs",
"title": "Cron Jobs and Scheduled Tasks",
"description": "Durable cron jobs with Rivet Actors: schedule.after and schedule.at timers survive restarts and crashes, plus re-arming recurring jobs and idempotent handlers.",
"canonical_url": "https://rivet.dev/cookbook/cron-jobs",
"reference_url": "/metadata/skills/live-cursors/reference/cookbook/cron-jobs.md"
},
{
"name": "general/cors",
"title": "Cross-Origin Resource Sharing",
"description": "Cross-Origin Resource Sharing (CORS) controls which origins (domains) can access your actors. When actors are exposed to the public internet, proper origin validation is critical to prevent security breaches and denial of service attacks.",
"canonical_url": "https://rivet.dev/docs/general/cors",
"reference_url": "/metadata/skills/live-cursors/reference/general/cors.md"
},
{
"name": "actors/inspector-tabs",
"title": "Custom Inspector Tabs",
"description": "Ship your own UI tabs alongside a Rivet Actor — embedded directly in the dashboard inspector.",
"canonical_url": "https://rivet.dev/docs/actors/inspector-tabs",
"reference_url": "/metadata/skills/live-cursors/reference/actors/inspector-tabs.md"
},
{
"name": "cookbook/per-tenant-database",
"title": "Database per Tenant",
"description": "Multi-tenant data isolation with one Rivet Actor per tenant: the actor key is the tenant id, so each tenant gets its own isolated dataset and migrations.",
"canonical_url": "https://rivet.dev/cookbook/per-tenant-database",
"reference_url": "/metadata/skills/live-cursors/reference/cookbook/per-tenant-database.md"
},
{
"name": "actors/debugging",
"title": "Debugging",
"description": "Inspect and debug running Rivet Actors, runners, and provider configs using management, runner, and actor inspector HTTP APIs.",
"canonical_url": "https://rivet.dev/docs/actors/debugging",
"reference_url": "/metadata/skills/live-cursors/reference/actors/debugging.md"
},
{
"name": "deploy/aws-lambda",
"title": "Deploy To Amazon Web Services Lambda",
"description": "_AWS Lambda is coming soon_",
"canonical_url": "https://rivet.dev/docs/deploy/aws-lambda",
"reference_url": "/metadata/skills/live-cursors/reference/deploy/aws-lambda.md"
},
{
"name": "cookbook/vpc-air-gapped",
"title": "Deploying Rivet in a VPC or Air-Gapped Network",
"description": "Run Rivet entirely inside your own perimeter: single-binary or Docker Compose install, file system storage with no database infrastructure, and no outbound telemetry by default.",
"canonical_url": "https://rivet.dev/cookbook/vpc-air-gapped",
"reference_url": "/metadata/skills/live-cursors/reference/cookbook/vpc-air-gapped.md"
},
{
"name": "deploy/aws-ecs",
"title": "Deploying to AWS ECS",
"description": "Run your backend on Amazon ECS with Fargate.",
"canonical_url": "https://rivet.dev/docs/deploy/aws-ecs",
"reference_url": "/metadata/skills/live-cursors/reference/deploy/aws-ecs.md"
},
{
"name": "deploy/cloudflare",
"title": "Deploying to Cloudflare Workers",
"description": "Deploy an existing Rivet project to Cloudflare Workers.",
"canonical_url": "https://rivet.dev/docs/deploy/cloudflare",
"reference_url": "/metadata/skills/live-cursors/reference/deploy/cloudflare.md"
},
{
"name": "deploy/freestyle",
"title": "Deploying to Freestyle",
"description": "Deploy RivetKit app to Freestyle.sh, a cloud platform for running AI-generated code with built-in security and scalability.",
"canonical_url": "https://rivet.dev/docs/deploy/freestyle",
"reference_url": "/metadata/skills/live-cursors/reference/deploy/freestyle.md"
},
{
"name": "deploy/gcp-cloud-run",
"title": "Deploying to Google Cloud Run",
"description": "Deploy your RivetKit app to Google Cloud Run.",
"canonical_url": "https://rivet.dev/docs/deploy/gcp-cloud-run",
"reference_url": "/metadata/skills/live-cursors/reference/deploy/gcp-cloud-run.md"
},
{
"name": "deploy/hetzner",
"title": "Deploying to Hetzner",
"description": "Please see the VM & Bare Metal guide.",
"canonical_url": "https://rivet.dev/docs/deploy/hetzner",
"reference_url": "/metadata/skills/live-cursors/reference/deploy/hetzner.md"
},
{
"name": "deploy/kubernetes",
"title": "Deploying to Kubernetes",
"description": "Deploy your RivetKit app to any Kubernetes cluster.",
"canonical_url": "https://rivet.dev/docs/deploy/kubernetes",
"reference_url": "/metadata/skills/live-cursors/reference/deploy/kubernetes.md"
},
{
"name": "deploy/railway",
"title": "Deploying to Railway",
"description": "Deploy your RivetKit app to Railway.",
"canonical_url": "https://rivet.dev/docs/deploy/railway",
"reference_url": "/metadata/skills/live-cursors/reference/deploy/railway.md"
},
{
"name": "deploy/rivet-compute",
"title": "Deploying to Rivet Compute",
"description": "Run your backend on Rivet Compute.",
"canonical_url": "https://rivet.dev/docs/deploy/rivet-compute",
"reference_url": "/metadata/skills/live-cursors/reference/deploy/rivet-compute.md"
},
{
"name": "deploy/supabase",
"title": "Deploying to Supabase Functions",
"description": "Deploy an existing Rivet project to Supabase Edge Functions.",
"canonical_url": "https://rivet.dev/docs/deploy/supabase",
"reference_url": "/metadata/skills/live-cursors/reference/deploy/supabase.md"
},
{
"name": "deploy/vercel",
"title": "Deploying to Vercel",
"description": "Deploy your Next.js Rivet app to Vercel.",
"canonical_url": "https://rivet.dev/docs/deploy/vercel",
"reference_url": "/metadata/skills/live-cursors/reference/deploy/vercel.md"
},
{
"name": "deploy/vm-and-bare-metal",
"title": "Deploying to VMs & Bare Metal",
"description": "Deploy your RivetKit app to any Linux VM or bare metal host.",
"canonical_url": "https://rivet.dev/docs/deploy/vm-and-bare-metal",
"reference_url": "/metadata/skills/live-cursors/reference/deploy/vm-and-bare-metal.md"
},
{
"name": "agent-os/deployment",
"title": "Deployment",
"description": "Choose the right deployment option for agentOS.",
"canonical_url": "https://rivet.dev/docs/agent-os/deployment",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/deployment.md"
},
{
"name": "actors/design-patterns",
"title": "Design Patterns",
"description": "Common patterns and anti-patterns for building scalable actor systems.",
"canonical_url": "https://rivet.dev/docs/actors/design-patterns",
"reference_url": "/metadata/skills/live-cursors/reference/actors/design-patterns.md"
},
{
"name": "actors/destroy",
"title": "Destroying Actors",
"description": "Actors can be permanently destroyed. Common use cases include:",
"canonical_url": "https://rivet.dev/docs/actors/destroy",
"reference_url": "/metadata/skills/live-cursors/reference/actors/destroy.md"
},
{
"name": "self-hosting/docker-compose",
"title": "Docker Compose",
"description": "Deploy Rivet Engine with docker-compose for multi-container setups.",
"canonical_url": "https://rivet.dev/docs/self-hosting/docker-compose",
"reference_url": "/metadata/skills/live-cursors/reference/self-hosting/docker-compose.md"
},
{
"name": "self-hosting/docker-container",
"title": "Docker Container",
"description": "Run Rivet Engine in a single Docker container.",
"canonical_url": "https://rivet.dev/docs/self-hosting/docker-container",
"reference_url": "/metadata/skills/live-cursors/reference/self-hosting/docker-container.md"
},
{
"name": "general/docs-for-llms",
"title": "Documentation for LLMs & AI",
"description": "Rivet provides optimized documentation formats specifically designed for Large Language Models (LLMs) and AI integration tools.",
"canonical_url": "https://rivet.dev/docs/general/docs-for-llms",
"reference_url": "/metadata/skills/live-cursors/reference/general/docs-for-llms.md"
},
{
"name": "general/edge",
"title": "Edge Networking",
"description": "Actors automatically run near your users on your provider's global network.",
"canonical_url": "https://rivet.dev/docs/general/edge",
"reference_url": "/metadata/skills/live-cursors/reference/general/edge.md"
},
{
"name": "actors/quickstart/effect",
"title": "Effect.ts Quickstart (Beta)",
"description": "Build a Rivet Actor with the Effect SDK",
"canonical_url": "https://rivet.dev/docs/actors/quickstart/effect",
"reference_url": "/metadata/skills/live-cursors/reference/actors/quickstart/effect.md"
},
{
"name": "agent-os/llm-gateway",
"title": "Embedded LLM Gateway",
"description": "Route, meter, and manage LLM API calls from agents.",
"canonical_url": "https://rivet.dev/docs/agent-os/llm-gateway",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/llm-gateway.md"
},
{
"name": "general/endpoints",
"title": "Endpoints",
"description": "Configure how your backend connects to Rivet and how clients reach your actors.",
"canonical_url": "https://rivet.dev/docs/general/endpoints",
"reference_url": "/metadata/skills/live-cursors/reference/general/endpoints.md"
},
{
"name": "general/environment-variables",
"title": "Environment Variables",
"description": "This page documents all environment variables that configure RivetKit behavior.",
"canonical_url": "https://rivet.dev/docs/general/environment-variables",
"reference_url": "/metadata/skills/live-cursors/reference/general/environment-variables.md"
},
{
"name": "actors/errors",
"title": "Errors",
"description": "Rivet provides robust error handling with security built in by default. Errors are handled differently based on whether they should be exposed to clients or kept private.",
"canonical_url": "https://rivet.dev/docs/actors/errors",
"reference_url": "/metadata/skills/live-cursors/reference/actors/errors.md"
},
{
"name": "agent-os/events",
"title": "Events",
"description": "Full event catalog with payload shapes for agentOS.",
"canonical_url": "https://rivet.dev/docs/agent-os/events",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/events.md"
},
{
"name": "actors/fetch-and-websocket-handler",
"title": "Fetch and WebSocket Handler",
"description": "These docs have moved to [Low-Level WebSocket Handler](/docs/actors/websocket-handler) and [Low-Level Request Handler](/docs/actors/request-handler).",
"canonical_url": "https://rivet.dev/docs/actors/fetch-and-websocket-handler",
"reference_url": "/metadata/skills/live-cursors/reference/actors/fetch-and-websocket-handler.md"
},
{
"name": "self-hosting/filesystem",
"title": "File System",
"description": "The file system backend stores all data on the local disk. This is suitable for single-node deployments, development, and testing.",
"canonical_url": "https://rivet.dev/docs/self-hosting/filesystem",
"reference_url": "/metadata/skills/live-cursors/reference/self-hosting/filesystem.md"
},
{
"name": "agent-os/filesystem",
"title": "Filesystem",
"description": "Read, write, mount, and manage files inside agentOS.",
"canonical_url": "https://rivet.dev/docs/agent-os/filesystem",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/filesystem.md"
},
{
"name": "self-hosting/foundationdb",
"title": "FoundationDB (Enterprise)",
"description": "FoundationDB is the recommended storage backend for scalable production Rivet deployments.",
"canonical_url": "https://rivet.dev/docs/self-hosting/foundationdb",
"reference_url": "/metadata/skills/live-cursors/reference/self-hosting/foundationdb.md"
},
{
"name": "actors/helper-types",
"title": "Helper Types",
"description": "This page has moved to [Types](/docs/actors/types).",
"canonical_url": "https://rivet.dev/docs/actors/helper-types",
"reference_url": "/metadata/skills/live-cursors/reference/actors/helper-types.md"
},
{
"name": "general/http-server",
"title": "HTTP Server",
"description": "Different ways to run your RivetKit HTTP server.",
"canonical_url": "https://rivet.dev/docs/general/http-server",
"reference_url": "/metadata/skills/live-cursors/reference/general/http-server.md"
},
{
"name": "actors/appearance",
"title": "Icons & Names",
"description": "Customize actors with display names and icons for the Rivet inspector and dashboard.",
"canonical_url": "https://rivet.dev/docs/actors/appearance",
"reference_url": "/metadata/skills/live-cursors/reference/actors/appearance.md"
},
{
"name": "actors/state",
"title": "In-Memory State",
"description": "Actors store state in memory for instant reads and writes. State can be persisted automatically or kept ephemeral.",
"canonical_url": "https://rivet.dev/docs/actors/state",
"reference_url": "/metadata/skills/live-cursors/reference/actors/state.md"
},
{
"name": "actors/input",
"title": "Input Parameters",
"description": "Pass initialization data to actors when creating instances",
"canonical_url": "https://rivet.dev/docs/actors/input",
"reference_url": "/metadata/skills/live-cursors/reference/actors/input.md"
},
{
"name": "self-hosting/install",
"title": "Installing Rivet Engine",
"description": "Install Rivet Engine using Docker, binaries, or a source build.",
"canonical_url": "https://rivet.dev/docs/self-hosting/install",
"reference_url": "/metadata/skills/live-cursors/reference/self-hosting/install.md"
},
{
"name": "self-hosting/kubernetes",
"title": "Kubernetes",
"description": "Deploy production-ready Rivet Engine to Kubernetes with PostgreSQL storage.",
"canonical_url": "https://rivet.dev/docs/self-hosting/kubernetes",
"reference_url": "/metadata/skills/live-cursors/reference/self-hosting/kubernetes.md"
},
{
"name": "actors/lifecycle",
"title": "Lifecycle",
"description": "Learn about actor lifecycle hooks for initialization, state management, and cleanup.",
"canonical_url": "https://rivet.dev/docs/actors/lifecycle",
"reference_url": "/metadata/skills/live-cursors/reference/actors/lifecycle.md"
},
{
"name": "agent-os/limitations",
"title": "Limitations",
"description": "What the agentOS VM does not support, and how to work around it.",
"canonical_url": "https://rivet.dev/docs/agent-os/limitations",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/limitations.md"
},
{
"name": "actors/limits",
"title": "Limits",
"description": "Limits and constraints for Rivet Actors.",
"canonical_url": "https://rivet.dev/docs/actors/limits",
"reference_url": "/metadata/skills/live-cursors/reference/actors/limits.md"
},
{
"name": "cookbook/live-cursors",
"title": "Live Cursors and Presence",
"description": "Live cursors and multiplayer presence with Rivet Actors: per-connection cursor state, realtime updates over events or raw WebSockets, and throttling.",
"canonical_url": "https://rivet.dev/cookbook/live-cursors",
"reference_url": "/metadata/skills/live-cursors/reference/cookbook/live-cursors.md"
},
{
"name": "agent-os/llm-credentials",
"title": "LLM Credentials",
"description": "Pass LLM API keys to agent sessions securely.",
"canonical_url": "https://rivet.dev/docs/agent-os/llm-credentials",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/llm-credentials.md"
},
{
"name": "general/logging",
"title": "Logging",
"description": "Actors provide a built-in way to log complex data to the console.",
"canonical_url": "https://rivet.dev/docs/general/logging",
"reference_url": "/metadata/skills/live-cursors/reference/general/logging.md"
},
{
"name": "actors/request-handler",
"title": "Low-Level HTTP Request Handler",
"description": "Actors can handle HTTP requests through the `onRequest` handler.",
"canonical_url": "https://rivet.dev/docs/actors/request-handler",
"reference_url": "/metadata/skills/live-cursors/reference/actors/request-handler.md"
},
{
"name": "actors/kv",
"title": "Low-Level KV Storage",
"description": "Use the built-in key-value store on ActorContext for durable string and binary data alongside actor state.",
"canonical_url": "https://rivet.dev/docs/actors/kv",
"reference_url": "/metadata/skills/live-cursors/reference/actors/kv.md"
},
{
"name": "actors/websocket-handler",
"title": "Low-Level WebSocket Handler",
"description": "Actors can handle WebSocket connections through the `onWebSocket` handler.",
"canonical_url": "https://rivet.dev/docs/actors/websocket-handler",
"reference_url": "/metadata/skills/live-cursors/reference/actors/websocket-handler.md"
},
{
"name": "actors/metadata",
"title": "Metadata",
"description": "Metadata provides information about the currently running actor.",
"canonical_url": "https://rivet.dev/docs/actors/metadata",
"reference_url": "/metadata/skills/live-cursors/reference/actors/metadata.md"
},
{
"name": "self-hosting/multi-region",
"title": "Multi-Region",
"description": "Rivet Engine supports scaling transparently across multiple regions.",
"canonical_url": "https://rivet.dev/docs/self-hosting/multi-region",
"reference_url": "/metadata/skills/live-cursors/reference/self-hosting/multi-region.md"
},
{
"name": "agent-os/multiplayer",
"title": "Multiplayer",
"description": "Connect multiple clients to the same agentOS actor for collaborative agent workflows.",
"canonical_url": "https://rivet.dev/docs/agent-os/multiplayer",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/multiplayer.md"
},
{
"name": "cookbook/multiplayer-game",
"title": "Multiplayer Game",
"description": "Pragmatic patterns for building multiplayer games: matchmaking, tick loops, realtime state, interest management, and validation.",
"canonical_url": "https://rivet.dev/cookbook/multiplayer-game",
"reference_url": "/metadata/skills/live-cursors/reference/cookbook/multiplayer-game.md"
},
{
"name": "agent-os/networking",
"title": "Networking & Previews",
"description": "Proxy HTTP requests into agentOS VMs and create shareable preview URLs.",
"canonical_url": "https://rivet.dev/docs/agent-os/networking",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/networking.md"
},
{
"name": "actors/quickstart/next-js",
"title": "Next.js Quickstart",
"description": "Get started with Rivet Actors in Next.js",
"canonical_url": "https://rivet.dev/docs/actors/quickstart/next-js",
"reference_url": "/metadata/skills/live-cursors/reference/actors/quickstart/next-js.md"
},
{
"name": "clients/javascript",
"title": "Node.js & Bun",
"description": "Connect JavaScript apps to Rivet Actors.",
"canonical_url": "https://rivet.dev/docs/clients/javascript",
"reference_url": "/metadata/skills/live-cursors/reference/clients/javascript.md"
},
{
"name": "actors/quickstart/backend",
"title": "Node.js & Bun Quickstart",
"description": "Get started with Rivet Actors in Node.js and Bun",
"canonical_url": "https://rivet.dev/docs/actors/quickstart/backend",
"reference_url": "/metadata/skills/live-cursors/reference/actors/quickstart/backend.md"
},
{
"name": "agent-os/permissions",
"title": "Permissions",
"description": "Approve or deny agent tool use with human-in-the-loop or auto-approve patterns.",
"canonical_url": "https://rivet.dev/docs/agent-os/permissions",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/permissions.md"
},
{
"name": "agent-os/persistence",
"title": "Persistence & Sleep",
"description": "How agentOS persists data and manages sleep/wake cycles.",
"canonical_url": "https://rivet.dev/docs/agent-os/persistence",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/persistence.md"
},
{
"name": "agent-os/agents/pi",
"title": "Pi",
"description": "Run the Pi coding agent inside a VM with extensions and custom configuration.",
"canonical_url": "https://rivet.dev/docs/agent-os/agents/pi",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/agents/pi.md"
},
{
"name": "general/pool-configuration",
"title": "Pool Configuration",
"description": "Reference for runner pool configuration, including drain behavior, actor eviction rate limiting, and serverless-specific options.",
"canonical_url": "https://rivet.dev/docs/general/pool-configuration",
"reference_url": "/metadata/skills/live-cursors/reference/general/pool-configuration.md"
},
{
"name": "self-hosting/postgres",
"title": "PostgreSQL",
"description": "Configure PostgreSQL for self-hosted Rivet deployments.",
"canonical_url": "https://rivet.dev/docs/self-hosting/postgres",
"reference_url": "/metadata/skills/live-cursors/reference/self-hosting/postgres.md"
},
{
"name": "agent-os/processes",
"title": "Processes & Shell",
"description": "Execute commands, spawn long-running processes, and open interactive shells in agentOS VMs.",
"canonical_url": "https://rivet.dev/docs/agent-os/processes",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/processes.md"
},
{
"name": "general/production-checklist",
"title": "Production Checklist",
"description": "Checklist for deploying Rivet Actors to production.",
"canonical_url": "https://rivet.dev/docs/general/production-checklist",
"reference_url": "/metadata/skills/live-cursors/reference/general/production-checklist.md"
},
{
"name": "self-hosting/production-checklist",
"title": "Production Checklist",
"description": "Checklist for deploying a self-hosted Rivet Engine to production.",
"canonical_url": "https://rivet.dev/docs/self-hosting/production-checklist",
"reference_url": "/metadata/skills/live-cursors/reference/self-hosting/production-checklist.md"
},
{
"name": "agent-os/queues",
"title": "Queues",
"description": "Serialize agent work with durable queues for backpressure and rate limiting.",
"canonical_url": "https://rivet.dev/docs/agent-os/queues",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/queues.md"
},
{
"name": "actors/queues",
"title": "Queues & Run Loops",
"description": "Use actor-local durable queues for serial run loops and request/response workflows.",
"canonical_url": "https://rivet.dev/docs/actors/queues",
"reference_url": "/metadata/skills/live-cursors/reference/actors/queues.md"
},
{
"name": "agent-os/quickstart",
"title": "Quickstart",
"description": "Set up an agentOS actor, create a session, and run your first coding agent.",
"canonical_url": "https://rivet.dev/docs/agent-os/quickstart",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/quickstart.md"
},
{
"name": "self-hosting/railway",
"title": "Railway Deployment",
"description": "Railway provides a simple platform for deploying Rivet Engine with automatic scaling and managed infrastructure.",
"canonical_url": "https://rivet.dev/docs/self-hosting/railway",
"reference_url": "/metadata/skills/live-cursors/reference/self-hosting/railway.md"
},
{
"name": "clients/react",
"title": "React",
"description": "Connect React apps to Rivet Actors.",
"canonical_url": "https://rivet.dev/docs/clients/react",
"reference_url": "/metadata/skills/live-cursors/reference/clients/react.md"
},
{
"name": "actors/quickstart/react",
"title": "React Quickstart",
"description": "Build realtime React applications with Rivet Actors",
"canonical_url": "https://rivet.dev/docs/actors/quickstart/react",
"reference_url": "/metadata/skills/live-cursors/reference/actors/quickstart/react.md"
},
{
"name": "actors/events",
"title": "Realtime",
"description": "Events enable realtime communication from actors to clients. While clients use actions to send data to actors, events allow actors to push updates to connected clients instantly.",
"canonical_url": "https://rivet.dev/docs/actors/events",
"reference_url": "/metadata/skills/live-cursors/reference/actors/events.md"
},
{
"name": "general/registry-configuration",
"title": "Registry Configuration",
"description": "This page documents the configuration options available when setting up a RivetKit registry. The registry configuration is passed to the `setup()` function.",
"canonical_url": "https://rivet.dev/docs/general/registry-configuration",
"reference_url": "/metadata/skills/live-cursors/reference/general/registry-configuration.md"
},
{
"name": "self-hosting/render",
"title": "Render Deployment",
"description": "Deploy Rivet Engine to Render with managed PostgreSQL and automatic HTTPS, using the experimental PostgreSQL backend.",
"canonical_url": "https://rivet.dev/docs/self-hosting/render",
"reference_url": "/metadata/skills/live-cursors/reference/self-hosting/render.md"
},
{
"name": "general/runtime-modes",
"title": "Runtime Modes",
"description": "RivetKit supports two runtime modes for running your actors:",
"canonical_url": "https://rivet.dev/docs/general/runtime-modes",
"reference_url": "/metadata/skills/live-cursors/reference/general/runtime-modes.md"
},
{
"name": "actors/quickstart/rust",
"title": "Rust Quickstart (Beta)",
"description": "Build a Rivet Actor in Rust",
"canonical_url": "https://rivet.dev/docs/actors/quickstart/rust",
"reference_url": "/metadata/skills/live-cursors/reference/actors/quickstart/rust.md"
},
{
"name": "agent-os/sandbox",
"title": "Sandbox Mounting",
"description": "Extend agentOS with full sandboxes for heavy workloads like browsers, desktop automation, and compilation.",
"canonical_url": "https://rivet.dev/docs/agent-os/sandbox",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/sandbox.md"
},
{
"name": "actors/scaling",
"title": "Scaling & Concurrency",
"description": "This page has moved to [design patterns](/docs/actors/design-patterns).",
"canonical_url": "https://rivet.dev/docs/actors/scaling",
"reference_url": "/metadata/skills/live-cursors/reference/actors/scaling.md"
},
{
"name": "agent-os/security",
"title": "Security & Auth",
"description": "Configure resource limits, network control, authentication, and filesystem isolation for agentOS.",
"canonical_url": "https://rivet.dev/docs/agent-os/security",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/security.md"
},
{
"name": "agent-os/security-model",
"title": "Security Model",
"description": "Trust boundaries, isolation guarantees, and the agentOS threat model.",
"canonical_url": "https://rivet.dev/docs/agent-os/security-model",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/security-model.md"
},
{
"name": "agent-os/sessions",
"title": "Sessions",
"description": "Create agent sessions, send prompts, stream responses, and replay event history.",
"canonical_url": "https://rivet.dev/docs/agent-os/sessions",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/sessions.md"
},
{
"name": "actors/sharing-and-joining-state",
"title": "Sharing and Joining State",
"description": "This page has moved to [design patterns](/docs/actors/design-patterns).",
"canonical_url": "https://rivet.dev/docs/actors/sharing-and-joining-state",
"reference_url": "/metadata/skills/live-cursors/reference/actors/sharing-and-joining-state.md"
},
{
"name": "agent-os/software",
"title": "Software",
"description": "Install software packages and configure the commands available inside agentOS.",
"canonical_url": "https://rivet.dev/docs/agent-os/software",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/software.md"
},
{
"name": "actors/sqlite",
"title": "SQLite",
"description": "Use embedded SQLite in Rivet Actors with raw SQL queries.",
"canonical_url": "https://rivet.dev/docs/actors/sqlite",
"reference_url": "/metadata/skills/live-cursors/reference/actors/sqlite.md"
},
{
"name": "agent-os/sqlite",
"title": "SQLite",
"description": "Give agents access to a persistent SQLite database via host tools.",
"canonical_url": "https://rivet.dev/docs/agent-os/sqlite",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/sqlite.md"
},
{
"name": "actors/sqlite-drizzle",
"title": "SQLite + Drizzle",
"description": "Use Drizzle ORM with embedded SQLite in Rivet Actors.",
"canonical_url": "https://rivet.dev/docs/actors/sqlite-drizzle",
"reference_url": "/metadata/skills/live-cursors/reference/actors/sqlite-drizzle.md"
},
{
"name": "actors/quickstart/supabase",
"title": "Supabase Functions Quickstart",
"description": "Set up a Rivet project locally targeting Supabase Edge Functions.",
"canonical_url": "https://rivet.dev/docs/actors/quickstart/supabase",
"reference_url": "/metadata/skills/live-cursors/reference/actors/quickstart/supabase.md"
},
{
"name": "clients/swift",
"title": "Swift",
"description": "Connect Swift apps to Rivet Actors.",
"canonical_url": "https://rivet.dev/docs/clients/swift",
"reference_url": "/metadata/skills/live-cursors/reference/clients/swift.md"
},
{
"name": "clients/swiftui",
"title": "SwiftUI",
"description": "Build SwiftUI apps with Rivet Actors.",
"canonical_url": "https://rivet.dev/docs/clients/swiftui",
"reference_url": "/metadata/skills/live-cursors/reference/clients/swiftui.md"
},
{
"name": "agent-os/system-prompt",
"title": "System Prompt",
"description": "How agentOS injects context into agent sessions.",
"canonical_url": "https://rivet.dev/docs/agent-os/system-prompt",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/system-prompt.md"
},
{
"name": "actors/testing",
"title": "Testing",
"description": "Rivet provides a straightforward testing framework to build reliable and maintainable applications. This guide covers how to write effective tests for your actor-based services.",
"canonical_url": "https://rivet.dev/docs/actors/testing",
"reference_url": "/metadata/skills/live-cursors/reference/actors/testing.md"
},
{
"name": "self-hosting/tls",
"title": "TLS & Certificates",
"description": "How Rivet validates TLS root certificates.",
"canonical_url": "https://rivet.dev/docs/self-hosting/tls",
"reference_url": "/metadata/skills/live-cursors/reference/self-hosting/tls.md"
},
{
"name": "agent-os/tools",
"title": "Tools",
"description": "Expose custom tools to agents as CLI commands inside the VM.",
"canonical_url": "https://rivet.dev/docs/agent-os/tools",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/tools.md"
},
{
"name": "actors/troubleshooting",
"title": "Troubleshooting",
"description": "Common issues with Rivet Actors and how to resolve them.",
"canonical_url": "https://rivet.dev/docs/actors/troubleshooting",
"reference_url": "/metadata/skills/live-cursors/reference/actors/troubleshooting.md"
},
{
"name": "actors/types",
"title": "Types",
"description": "TypeScript types for working with Rivet Actors. This page covers context types used in lifecycle hooks and actions, as well as helper types for extracting types from actor definitions.",
"canonical_url": "https://rivet.dev/docs/actors/types",
"reference_url": "/metadata/skills/live-cursors/reference/actors/types.md"
},
{
"name": "actors/http-api",
"title": "Vanilla HTTP API",
"description": "Use the low-level HTTP handler to send and receive requests from actors.",
"canonical_url": "https://rivet.dev/docs/actors/http-api",
"reference_url": "/metadata/skills/live-cursors/reference/actors/http-api.md"
},
{
"name": "actors/versions",
"title": "Versions & Upgrades",
"description": "When you deploy new code, Rivet ensures actors are upgraded seamlessly without downtime.",
"canonical_url": "https://rivet.dev/docs/actors/versions",
"reference_url": "/metadata/skills/live-cursors/reference/actors/versions.md"
},
{
"name": "general/wasm-vs-native-sdk",
"title": "WASM vs Native SDK",
"description": "RivetKit runs your actors on a native or a WebAssembly runtime depending on your platform.",
"canonical_url": "https://rivet.dev/docs/general/wasm-vs-native-sdk",
"reference_url": "/metadata/skills/live-cursors/reference/general/wasm-vs-native-sdk.md"
},
{
"name": "agent-os/webhooks",
"title": "Webhooks",
"description": "Trigger agent workflows from external webhooks using Hono and queues.",
"canonical_url": "https://rivet.dev/docs/agent-os/webhooks",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/webhooks.md"
},
{
"name": "agent-os/workflows",
"title": "Workflow Automation",
"description": "Orchestrate multi-step agent tasks with durable workflows.",
"canonical_url": "https://rivet.dev/docs/agent-os/workflows",
"reference_url": "/metadata/skills/live-cursors/reference/agent-os/workflows.md"
},
{
"name": "actors/workflows",
"title": "Workflows",
"description": "Build durable, replayable run loops in Rivet Actors with steps, queue waits, timers, and rollback.",
"canonical_url": "https://rivet.dev/docs/actors/workflows",
"reference_url": "/metadata/skills/live-cursors/reference/actors/workflows.md"
}
]
}{
"openapi": "3.0.0",
"info": {
"version": "2.2.0",
"title": "RivetKit API"
},
"components": {
"schemas": {},
"parameters": {}
},
"paths": {
"/actors": {
"get": {
"parameters": [
{
"schema": {
"type": "string"
},
"required": false,
"name": "name",
"in": "query"
},
{
"schema": {
"type": "string"
},
"required": false,
"name": "actor_ids",
"in": "query"
},
{
"schema": {
"type": "string"
},
"required": false,
"name": "key",
"in": "query"
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"actors": {
"type": "array",
"items": {
"type": "object",
"properties": {
"actor_id": {
"type": "string"
},
"name": {
"type": "string"
},
"key": {
"type": "string"
},
"namespace_id": {
"type": "string"
},
"runner_name_selector": {
"type": "string"
},
"create_ts": {
"type": "number"
},
"connectable_ts": {
"type": "number",
"nullable": true
},
"destroy_ts": {
"type": "number",
"nullable": true
},
"sleep_ts": {
"type": "number",
"nullable": true
},
"start_ts": {
"type": "number",
"nullable": true
},
"error": {
"nullable": true
}
},
"required": [
"actor_id",
"name",
"key",
"namespace_id",
"runner_name_selector",
"create_ts"
]
}
}
},
"required": [
"actors"
]
}
}
}
},
"400": {
"description": "User error"
},
"500": {
"description": "Internal error"
}
}
},
"put": {
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"datacenter": {
"type": "string"
},
"name": {
"type": "string"
},
"key": {
"type": "string"
},
"runner_name_selector": {
"type": "string"
},
"crash_policy": {
"type": "string"
},
"input": {
"type": "string",
"nullable": true
}
},
"required": [
"name",
"key",
"runner_name_selector",
"crash_policy"
]
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"actor": {
"type": "object",
"properties": {
"actor_id": {
"type": "string"
},
"name": {
"type": "string"
},
"key": {
"type": "string"
},
"namespace_id": {
"type": "string"
},
"runner_name_selector": {
"type": "string"
},
"create_ts": {
"type": "number"
},
"connectable_ts": {
"type": "number",
"nullable": true
},
"destroy_ts": {
"type": "number",
"nullable": true
},
"sleep_ts": {
"type": "number",
"nullable": true
},
"start_ts": {
"type": "number",
"nullable": true
},
"error": {
"nullable": true
}
},
"required": [
"actor_id",
"name",
"key",
"namespace_id",
"runner_name_selector",
"create_ts"
]
},
"created": {
"type": "boolean"
}
},
"required": [
"actor",
"created"
]
}
}
}
},
"400": {
"description": "User error"
},
"500": {
"description": "Internal error"
}
}
},
"post": {
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"datacenter": {
"type": "string"
},
"name": {
"type": "string"
},
"runner_name_selector": {
"type": "string"
},
"crash_policy": {
"type": "string"
},
"key": {
"type": "string",
"nullable": true
},
"input": {
"type": "string",
"nullable": true
}
},
"required": [
"name",
"runner_name_selector",
"crash_policy"
]
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"actor": {
"type": "object",
"properties": {
"actor_id": {
"type": "string"
},
"name": {
"type": "string"
},
"key": {
"type": "string"
},
"namespace_id": {
"type": "string"
},
"runner_name_selector": {
"type": "string"
},
"create_ts": {
"type": "number"
},
"connectable_ts": {
"type": "number",
"nullable": true
},
"destroy_ts": {
"type": "number",
"nullable": true
},
"sleep_ts": {
"type": "number",
"nullable": true
},
"start_ts": {
"type": "number",
"nullable": true
},
"error": {
"nullable": true
}
},
"required": [
"actor_id",
"name",
"key",
"namespace_id",
"runner_name_selector",
"create_ts"
]
}
},
"required": [
"actor"
]
}
}
}
},
"400": {
"description": "User error"
},
"500": {
"description": "Internal error"
}
}
}
},
"/actors/names": {
"get": {
"parameters": [
{
"schema": {
"type": "string"
},
"required": true,
"name": "namespace",
"in": "query"
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"names": {
"type": "object",
"additionalProperties": {
"type": "object",
"properties": {
"metadata": {
"type": "object",
"additionalProperties": {
"nullable": true
}
}
},
"required": [
"metadata"
]
}
}
},
"required": [
"names"
]
}
}
}
},
"400": {
"description": "User error"
},
"500": {
"description": "Internal error"
}
}
}
},
"/actors/{actor_id}/kv/keys/{key}": {
"get": {
"parameters": [
{
"schema": {
"type": "string"
},
"required": true,
"name": "actor_id",
"in": "path"
},
{
"schema": {
"type": "string"
},
"required": true,
"name": "key",
"in": "path"
}
],
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"value": {
"type": "string",
"nullable": true
}
},
"required": [
"value"
]
}
}
}
},
"400": {
"description": "User error"
},
"500": {
"description": "Internal error"
}
}
}
},
"/gateway/{actorId}/health": {
"get": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
}
],
"responses": {
"200": {
"description": "Health check",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/gateway/{actorId}/action/{action}": {
"post": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "action",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The name of the action to execute"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"args": {}
},
"required": [
"args"
],
"additionalProperties": false
}
}
}
},
"responses": {
"200": {
"description": "Action executed successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"output": {}
},
"required": [
"output"
],
"additionalProperties": false
}
}
}
},
"400": {
"description": "Invalid action"
},
"500": {
"description": "Internal error"
}
}
}
},
"/gateway/{actorId}/request/{path}": {
"get": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "path",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The HTTP path to forward to the actor"
}
],
"responses": {
"200": {
"description": "Response from actor's raw HTTP handler"
}
}
},
"post": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "path",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The HTTP path to forward to the actor"
}
],
"responses": {
"200": {
"description": "Response from actor's raw HTTP handler"
}
}
},
"put": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "path",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The HTTP path to forward to the actor"
}
],
"responses": {
"200": {
"description": "Response from actor's raw HTTP handler"
}
}
},
"delete": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "path",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The HTTP path to forward to the actor"
}
],
"responses": {
"200": {
"description": "Response from actor's raw HTTP handler"
}
}
},
"patch": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "path",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The HTTP path to forward to the actor"
}
],
"responses": {
"200": {
"description": "Response from actor's raw HTTP handler"
}
}
},
"head": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "path",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The HTTP path to forward to the actor"
}
],
"responses": {
"200": {
"description": "Response from actor's raw HTTP handler"
}
}
},
"options": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "path",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The HTTP path to forward to the actor"
}
],
"responses": {
"200": {
"description": "Response from actor's raw HTTP handler"
}
}
}
},
"/gateway/{actorId}/inspector/state": {
"get": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "Authorization",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Bearer token for inspector authentication. Required in production, optional in development."
}
],
"responses": {
"200": {
"description": "Current actor state",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"state": {}
}
}
}
}
},
"401": {
"description": "Unauthorized"
}
}
},
"patch": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "Authorization",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Bearer token for inspector authentication. Required in production, optional in development."
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"state": {}
},
"required": [
"state"
]
}
}
}
},
"responses": {
"200": {
"description": "State updated",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"ok": {
"type": "boolean"
}
}
}
}
}
},
"401": {
"description": "Unauthorized"
}
}
}
},
"/gateway/{actorId}/inspector/connections": {
"get": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "Authorization",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Bearer token for inspector authentication. Required in production, optional in development."
}
],
"responses": {
"200": {
"description": "Current actor connections",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"connections": {
"type": "array",
"items": {
"type": "object"
}
}
}
}
}
}
},
"401": {
"description": "Unauthorized"
}
}
}
},
"/gateway/{actorId}/inspector/rpcs": {
"get": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "Authorization",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Bearer token for inspector authentication. Required in production, optional in development."
}
],
"responses": {
"200": {
"description": "Available actor actions/RPCs",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"rpcs": {
"type": "object"
}
}
}
}
}
},
"401": {
"description": "Unauthorized"
}
}
}
},
"/gateway/{actorId}/inspector/action/{name}": {
"post": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "name",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The name of the action to execute"
},
{
"name": "Authorization",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Bearer token for inspector authentication. Required in production, optional in development."
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"args": {
"type": "array",
"items": {}
}
}
}
}
}
},
"responses": {
"200": {
"description": "Action executed successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"output": {}
}
}
}
}
},
"401": {
"description": "Unauthorized"
}
}
}
},
"/gateway/{actorId}/inspector/queue": {
"get": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "limit",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"default": 50
},
"description": "Maximum number of queue messages to return"
},
{
"name": "Authorization",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Bearer token for inspector authentication. Required in production, optional in development."
}
],
"responses": {
"200": {
"description": "Queue status",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"size": {
"type": "integer"
},
"maxSize": {
"type": "integer"
},
"truncated": {
"type": "boolean"
},
"messages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"createdAtMs": {
"type": "integer"
}
}
}
}
}
}
}
}
},
"401": {
"description": "Unauthorized"
}
}
}
},
"/gateway/{actorId}/inspector/traces": {
"get": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "startMs",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"default": 0
},
"description": "Start of time range in epoch milliseconds"
},
{
"name": "endMs",
"in": "query",
"required": false,
"schema": {
"type": "integer"
},
"description": "End of time range in epoch milliseconds. Defaults to now."
},
{
"name": "limit",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"default": 1000
},
"description": "Maximum number of spans to return"
},
{
"name": "Authorization",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Bearer token for inspector authentication. Required in production, optional in development."
}
],
"responses": {
"200": {
"description": "Trace spans in OTLP JSON format",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"otlp": {
"type": "object"
},
"clamped": {
"type": "boolean"
}
}
}
}
}
},
"401": {
"description": "Unauthorized"
}
}
}
},
"/gateway/{actorId}/inspector/workflow-history": {
"get": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "Authorization",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Bearer token for inspector authentication. Required in production, optional in development."
}
],
"responses": {
"200": {
"description": "Workflow history and status",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"history": {},
"isWorkflowEnabled": {
"type": "boolean"
}
}
}
}
}
},
"401": {
"description": "Unauthorized"
}
}
}
},
"/gateway/{actorId}/inspector/workflow/replay": {
"post": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "Authorization",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Bearer token for inspector authentication. Required in production, optional in development."
}
],
"requestBody": {
"required": false,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"entryId": {
"type": "string"
}
}
}
}
}
},
"responses": {
"200": {
"description": "Workflow history after scheduling a replay",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"history": {},
"isWorkflowEnabled": {
"type": "boolean"
}
}
}
}
}
},
"401": {
"description": "Unauthorized"
}
}
}
},
"/gateway/{actorId}/inspector/summary": {
"get": {
"parameters": [
{
"name": "actorId",
"in": "path",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the actor to target"
},
{
"name": "Authorization",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Bearer token for inspector authentication. Required in production, optional in development."
}
],
"responses": {
"200": {
"description": "Full actor inspector summary",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"state": {},
"connections": {
"type": "array",
"items": {
"type": "object"
}
},
"rpcs": {
"type": "object"
},
"queueSize": {
"type": "integer"
},
"isStateEnabled": {
"type": "boolean"
},
"isDatabaseEnabled": {
"type": "boolean"
},
"isWorkflowEnabled": {
"type": "boolean"
},
"workflowHistory": {}
}
}
}
}
},
"401": {
"description": "Unauthorized"
}
}
}
}
}
}Access Control
Source: src/content/docs/actors/access-control.mdxCanonical URL: https://rivet.dev/docs/actors/access-control
Description: Authorize actions, queue publishes, and event subscriptions with explicit hooks.
--- Use access control to decide what authenticated clients are allowed to do.
This is authorization, not authentication:
- Use authentication to identify who is calling.
- Use access-control rules to decide what they can do after connecting.
Permission Surfaces
RivetKit authorization is explicit per surface:
onBeforeConnectrejects unauthenticated or malformed connections.- Action handlers (
actions.*) enforce action permissions. queues.<name>.canPublishallows or denies inbound queue publishes.events.<name>.canSubscribeallows or denies event subscriptions.
Fail By Default
Use deny-by-default rules everywhere:
1. Keep onBeforeConnect strict and reject invalid credentials. 2. In each action, explicitly allow expected roles and throw forbidden otherwise. 3. In canPublish and canSubscribe, return true only for allowed roles and end with return false.
import { actor, event, queue, UserError } from "rivetkit";
type ConnParams = {
authToken: string;
};
type ConnState = {
userId: string;
role: "member" | "admin";
};
async function authenticate(
authToken: string,
): Promise<ConnState | null> {
if (authToken === "admin-token") {
return { userId: "admin-1", role: "admin" };
}
if (authToken === "member-token") {
return { userId: "member-1", role: "member" };
}
return null;
}
export const chatRoom = actor({
state: { messages: [] as Array<{ userId: string; text: string }> },
onBeforeConnect: async (_c, params: ConnParams) => {
if (!params.authToken) {
throw new UserError("Forbidden", { code: "forbidden" });
}
const session = await authenticate(params.authToken);
if (!session) {
throw new UserError("Forbidden", { code: "forbidden" });
}
},
createConnState: async (_c, params: ConnParams): Promise<ConnState> => {
const session = await authenticate(params.authToken);
if (!session) {
throw new UserError("Forbidden", { code: "forbidden" });
}
return session;
},
events: {
messages: event<{ userId: string; text: string }>(),
moderationLog: event<{ entry: string }>({
canSubscribe: (c) => {
if (c.conn?.state.role === "admin") {
return true;
}
return false;
},
}),
},
queues: {
moderationJobs: queue<{ action: "ban"; userId: string }>({
canPublish: (c) => {
if (c.conn?.state.role === "admin") {
return true;
}
return false;
},
}),
},
actions: {
sendMessage: (c, text: string) => {
const role = c.conn?.state.role;
const userId = c.conn?.state.userId;
if (!userId || (role !== "member" && role !== "admin")) {
throw new UserError("Forbidden", { code: "forbidden" });
}
const message = { userId, text };
c.state.messages.push(message);
c.broadcast("messages", message);
},
},
});Return Value Contract
canPublish and canSubscribe must return a boolean:
true: allowfalse: deny withforbidden
Returning undefined, null, or any non-boolean throws an internal error.
Notes
canPublishonly applies to queue names defined inqueues.- Incoming queue messages for undefined queues are ignored and the publish succeeds as completed.
canSubscribeonly applies to event names defined inevents.- Broadcasting an event not defined in
eventsstill publishes to subscribers.
_Source doc path: /docs/actors/access-control_
Icons & Names
Source: src/content/docs/actors/appearance.mdxCanonical URL: https://rivet.dev/docs/actors/appearance
Description: Customize actors with display names and icons for the Rivet inspector and dashboard.
---
Icons & Names
Actors can be customized with a display name and icon that appear in the Rivet inspector & dashboard. This helps identify actors at a glance when managing your application.
Configuration
Set the name and icon properties in your actor's options:
import { actor } from "rivetkit";
const chatRoom = actor({
options: {
name: "Chat Room", // Human-friendly display name
icon: "comments", // FontAwesome icon name
},
state: { messages: [] },
actions: {
// ...
}
});Icon Formats
The icon property accepts two formats:
Emoji
Use any emoji character directly:
import { actor } from "rivetkit";
const notificationService = actor({
options: {
name: "Notifications",
icon: "🔔",
},
// ...
});FontAwesome Icons
Use FontAwesome icon names without the "fa" prefix:
import { actor } from "rivetkit";
const gameServer = actor({
options: {
name: "Game Server",
icon: "gamepad",
},
// ...
});
const analyticsWorker = actor({
options: {
name: "Analytics",
icon: "chart-line",
},
// ...
});Default Behavior
If no icon is specified, actors display the default actor icon. If no name is specified, the actor's registry key (e.g., chatRoom, gameServer) is displayed instead.
Examples
Here are some common patterns:
import { actor } from "rivetkit";
// Chat/messaging actors
const chatRoom = actor({
options: { name: "Chat Room", icon: "comments" },
// ...
});
// Game-related actors
const matchmaker = actor({
options: { name: "Matchmaker", icon: "users" },
// ...
});
const gameSession = actor({
options: { name: "Game Session", icon: "gamepad" },
// ...
});
// Data processing actors
const dataProcessor = actor({
options: { name: "Data Processor", icon: "microchip" },
// ...
});
// Using emojis for quick identification
const alertService = actor({
options: { name: "Alerts", icon: "🚨" },
// ...
});Advanced: Run Handler Metadata
For library developers creating reusable run handlers, you can bundle icon and name metadata directly with the run property. This allows libraries to provide sensible defaults without requiring users to configure them manually.
Instead of returning a function from your run handler factory, return an object with name, icon, and run:
import type { RunConfig } from "rivetkit";
type MyOptions = {
mode?: "safe" | "fast";
};
function myCustomRunHandler(_options: MyOptions): RunConfig {
const run: RunConfig["run"] = async (_c) => {
// Your run handler logic...
};
return {
name: "My Custom Handler",
icon: "bolt",
run,
};
}Users can then use this directly:
import { actor } from "rivetkit";
const myCustomRunHandler = (_options: Record<string, unknown>) => ({
name: "My Custom Handler",
icon: "bolt",
run: async () => {},
});
const myActor = actor({
run: myCustomRunHandler({ /* options */ }),
// Picks up "My Custom Handler" name and "bolt" icon in registry metadata
});This run-handler metadata is currently applied through the registry and serverless metadata paths. The native runtime and inspector config read the actor's options.name and options.icon directly, so set those explicitly if you need the name or icon to appear everywhere.
Actor-level options.name and options.icon always take precedence, allowing users to override library defaults:
import { actor } from "rivetkit";
const myCustomRunHandler = (_options: Record<string, unknown>) => ({
name: "My Custom Handler",
icon: "bolt",
run: async () => {},
});
const myActor = actor({
options: {
name: "Custom Name", // Overrides "My Custom Handler"
icon: "rocket", // Overrides "bolt"
},
run: myCustomRunHandler({ /* options */ }),
});The built-in workflow() helper uses this pattern to automatically display the workflow icon for workflow-based actors.
_Source doc path: /docs/actors/appearance_
Fetch and WebSocket Handler
Source: src/content/docs/actors/fetch-and-websocket-handler.mdxCanonical URL: https://rivet.dev/docs/actors/fetch-and-websocket-handler
Description: These docs have moved to Low-Level WebSocket Handler and Low-Level Request Handler.
---
_Source doc path: /docs/actors/fetch-and-websocket-handler_
Helper Types
Source: src/content/docs/actors/helper-types.mdxCanonical URL: https://rivet.dev/docs/actors/helper-types
Description: This page has moved to Types.
---
_Source doc path: /docs/actors/helper-types_
Vanilla HTTP API
Source: src/content/docs/actors/http-api.mdxCanonical URL: https://rivet.dev/docs/actors/http-api
Description: Use the low-level HTTP handler to send and receive requests from actors.
--- TODO
_Source doc path: /docs/actors/http-api_
Scaling & Concurrency
Source: src/content/docs/actors/scaling.mdxCanonical URL: https://rivet.dev/docs/actors/scaling
Description: This page has moved to design patterns.
---
_Source doc path: /docs/actors/scaling_
Sharing and Joining State
Source: src/content/docs/actors/sharing-and-joining-state.mdxCanonical URL: https://rivet.dev/docs/actors/sharing-and-joining-state
Description: This page has moved to design patterns.
---
_Source doc path: /docs/actors/sharing-and-joining-state_
Benchmarks
Source: src/content/docs/agent-os/benchmarks.mdxCanonical URL: https://rivet.dev/docs/agent-os/benchmarks
Description: Performance benchmarks comparing agentOS to traditional sandbox providers.
--- These are the benchmark figures shown on the agentOS page. All numbers are computed from the same data source used by the marketing page. For independent sandbox comparison data, see the ComputeSDK benchmarks.
_Source doc path: /docs/agent-os/benchmarks_