Skip to main content

The primitive for
stateful workloads.

One Actor per agent, per session, per user. State, storage, and networking included.

Actors in action.

One primitive that adapts to agents, workflows, collaboration, and more.

backend.ts
const agent = actor({
  // In-memory, persisted state for the actor
  state: { messages: [] },

  // Long-running actor process
  run: async (c) => {
    // Process incoming messages from the queue
    for await (const msg of c.queue.iter()) {
      c.state.messages.push({ role: "user", content: msg.body.text });
      const response = streamText({ model: openai("gpt-5"), messages: c.state.messages });

      // Stream realtime events to all connected clients
      for await (const delta of response.textStream) {
        c.broadcast("token", delta);
      }

      c.state.messages.push({ role: "assistant", content: await response.text });
    }
  },
});
client.ts
const agent = client.agent.getOrCreate("agent-123").connect();
agent.on("token", delta => process.stdout.write(delta));
await agent.queue.send("hello!");
Rivet Actor/ AI Agent

Each agent runs as its own actor with persistent context, memory, and the ability to schedule tool calls.

How Actors Compare

Rivet Actors vs. traditional infrastructure.

Cold Start

Time to first request

lower is better
Rivet Actor~20ms
Kubernetes Pod~6s
Virtual Machine~30s

Memory Per Instance

Overhead per instance

lower is better
Rivet Actor~0.6KB
Kubernetes Pod~50MB
Virtual Machine~512MB

Read Latency

State read latency

lower is better
Rivet Actor0ms
Redis~1ms
Postgres~5ms

Idle Cost

Cost when not in use

lower is better
Rivet Actor$0
Virtual Machine~$5/mo
Kubernetes Cluster~$85/mo

Horizontal Scale

Maximum capacity

higher is better
Rivet ActorsInfinite
Kubernetes~5k nodes
Postgres1 primary

Multi-Region

Deploy actors close to your users

lower is better
RivetGlobal edge network
Traditional Deployment1 region
Rivet Inspector Dashboard

Built-In Observability

Debugging and monitoring for actors and agents, from local development to production at scale.

SQLite Viewer

Browse and query SQLite databases in real-time across actors and agent sessions

Workflow State

Inspect workflow progress, steps, and retries as they execute

Event Monitoring

Track every state change, action, and agent event as it happens in real-time

REPL

Debug actors and agent sessions by calling actions, subscribing to events, and interacting directly with your code

Frequently asked questions

What is a Rivet Actor?
A Rivet Actor is a long-lived unit of compute that keeps its own state between requests. It is like a serverless function with memory and no timeouts. The common pattern is one actor per agent, per session, or per user, with state, storage, and networking included. See the Rivet Actors docs for details.
How are Rivet Actors different from serverless functions?
Serverless functions are stateless and short-lived, so every invocation re-fetches data from a database and long-running work hits timeouts. A Rivet Actor remembers state between requests, holds WebSocket connections, and runs as long as it has work to do. It still sleeps when idle, so you keep the scale-to-zero economics of serverless.
Do I need a separate database for actor state?
No. State lives on the same machine as your compute, so reads and writes are fast with no database round trips. Use in-memory state for small values and each actor's built-in SQLite database for large, relational, or queryable data. State is persisted, so it survives restarts, crashes, and deployments. You can still connect to an external database when you need one.
How do Rivet Actors compare to Cloudflare Durable Objects?
Cloudflare Durable Objects provide stateful serverless computing tied to the Cloudflare platform. Rivet Actors give you the same actor model capabilities as open source software that works with your existing infrastructure, so you can deploy on Kubernetes, AWS, a VPS, or Rivet Cloud without vendor lock-in. See the full Rivet vs Cloudflare Durable Objects comparison.
What happens when an actor is idle?
Actors automatically sleep after a period of inactivity to free up resources. Their state is persisted, and they wake on demand when a request, message, or scheduled alarm arrives. Sleeping actors consume no compute, which makes Rivet Actors cost-efficient for bursty workloads. See the lifecycle docs for how sleeping works.
How do Rivet Actors scale?
The core pattern is one actor per entity in your system: a user, a document, a chat room, or an agent. Each actor is small and independent, so the system scales from zero to millions of concurrent actors automatically, with instant scaling and no cold starts.
Do Rivet Actors support WebSockets and realtime updates?
Yes. Realtime is built in. Clients call actions to send data to an actor, and the actor pushes updates back over WebSockets with events, either to specific connections or broadcast to all of them. There is no external pub/sub system or polling to manage.
What languages and frameworks can I use?
Rivet Actors are written in TypeScript or JavaScript and run on Node.js, Bun, and Deno, with a Rust SDK available in preview. Quickstarts cover backend, React, Next.js, and Rust apps. Client libraries are available for JavaScript, React, and Swift.

Infrastructure for
the agentic era.

Build with agents, build for agents, and run it where your data lives.