Rivet and the Architecture of the Infinite Memory
How a 0.6KB Actor model is eliminating the database round-trip for AI agents and real-time apps.
Every API call to a cloud provider is a dependency you can't control.
- Rivet replaces the traditional database round-trip by unifying compute and storage within a single stateful actor.
- The microscopic actor model allows for zero-millisecond read latency and cold starts in just 20 milliseconds.
- The Gasoline engine ensures durable execution by replaying cached history to resume workflows exactly where they failed.
- AI agents gain persistent memory and agency by living in isolated environments that hibernate and wake instantly.
The Stateless Tax
Modern web architecture is defined by the stateless struggle. A request comes in, the server wakes up, and it immediately faces amnesia. To do any useful work, it must fetch state from a remote database, process the logic, save the result back across the network, and die.
Every interaction pays this latency tax. When building AI agents that require constant context updates or real-time collaborative applications, this database round-trip becomes a severe bottleneck. Developers spend more time orchestrating external state than writing core business logic.
The 0.6KB Sovereign
Rivet flips this model by making the Actor the primary unit of both compute and storage. An actor is a lightweight, stateful process. It holds its memory locally and hibernates when idle.
Instead of a monolithic server juggling thousands of stateless requests, Rivet provisions a dedicated, microscopic server for every single user or session. These actors are remarkably dense. A single instance consumes roughly 0.6KB of memory. They achieve cold starts in 20 milliseconds and offer zero-millisecond read latency because the data is already in memory.
Gasoline: Execution That Never Forgets
At the core of Rivet is a durable workflow engine called Gasoline. When an actor wakes up, it does not start from scratch. It replays its history.
Gasoline uses a coordinate-based location system to track execution progress. Think of it as a Dewey Decimal system for code steps. If a process crashes or a server is restarted, Gasoline rewinds to the exact coordinate of the failure. It fast-forwards through previously completed, cached steps and resumes execution flawlessly.
Guard: Routing Without a Map
Managing millions of tiny, transient actors requires a radically different approach to networking. Rivet uses a gateway called Guard to handle routing and proxying.
Instead of maintaining a massive, globally synchronized map of every actor's location, Guard uses optimistic routing. It assumes its local cache is correct. It tunnels the request directly to the expected node. If it hits a failure, Guard uses that signal to trigger fresh service discovery. This eliminates a massive amount of overhead.
The Agent's Body
AI agents are the killer application for this architecture. A stateless LLM call is just a prompt. An agent is a long-running process with state, memory, and agency.
Rivet gives the agent a body. The state and the compute live in the same isolated environment. The agent can hibernate for days, wake up instantly when a new event occurs, and access its entire memory without querying an external Postgres instance.
Rivet Actors solve this by unifying state and logic in a single actor definition. Instead of coordinating between databases and APIs, state and behavior live together
| Feature | Stateless (Lambda + DB) | Stateful (Rivet Actor) |
|---|---|---|
| Architecture | Request-Response | Actor-Based |
| State Latency | 50-200ms (Network) | 0ms (Local SQLite) |
| Persistence | Manual (SQL/ORM) | Automatic (Hibernation) |
| Scaling | Per-Request | Per-Instance |
Sources: