The Agentic Primitive

Agent
Orchestration.

LLMs are stateless. Agents need durability. Rivet Actors provide the persistent memory and orchestration logic required to build autonomous AI systems.

reasoning_actor.ts
1import { actor } from "rivetkit";
2
3export const smartAgent = actor({
4 // Persistent memory state
5 state: { history: [], goals: [] },
6
7 actions: {
8 think: async (c, input) => {
9 // Actors hold context in RAM across requests
10 c.state.history.push({ role: 'user', content: input });
11
12 const res = await c.ai.generate(c.state.history);
13
14 // Atomic tool execution
15 const toolOutput = await c.tools.execute(res.calls);
16 c.state.history.push({ role: 'assistant', content: res.text });
17
18 return res.text;
19 }
20 }
21});

Build Agents with Actors

Actors provide long-running processes, in-memory context, and realtime/native protocols for building stateful AI agents.

Agent Actor: uuid-402
Active
State
history: [...] context_window: 12k active_goal: "refactor"
Reasoning
Planning step...
Active Tools:
GIT-WORKSPACE
SHELL-EXEC
CLIENT REQUEST
TOOL RESPONSE

Why Actors for Agents?

Rivet Actors are the fundamental building blocks for agents that need to reason about state over time.

Long-Running Tasks

Agents can 'hibernate' while waiting for external API callbacks or human approval, consuming zero resources.

Realtime

Stream responses and updates in real-time via WebSockets. Agents can broadcast events, progress updates, and intermediate results as they work.

Durable Execution

Actors persist their thought process. If the server restarts, the agent resumes exactly where it left off, mid-thought.

Orchestration

Communicate between agents using low-latency RPC. Agents can 'hand off' state to each other effortlessly. Auto-scaling ensures optimal resource allocation as workloads grow.

Application

Autonomous Coding Agent

Enable agents to operate directly on codebases with real-time feedback loops and durable process context.

  • Real-time Monitoring: Stream shell outputs and linter results directly to the user interface.
  • Durable Tool Loops: Agents can execute complex bash scripts and resume if the task is interrupted.
  • Context Retention: Long-term memory of project structure, preventing repetitive discovery steps.
Task: Fix CVE-2024-81
Sub-processes: 2
MONITORING
SHELLREAL-TIME
$ npm test --grep security-patch
✓ Patch verified (12 tests passed)
LinterWaiting...

Integrates with

LangChain
LlamaIndex
Vercel AI SDK
OpenAI
Anthropic
Hugging Face

Build smarter agents.

Give your AI the stateful foundation it needs to actually solve complex problems.