Skip to main content
General

Crash Course

Run coding agents inside isolated VMs with full filesystem, process, and network control.

agentOS is in preview and the API is subject to change. If you run into issues, please report them on GitHub or join our Discord.

When to Use agentOS

  • Coding agents: Run any coding agent with full OS access, file editing, shell execution, and tool use.
  • Automated pipelines: CI-like workflows where agents clone repos, fix bugs, run tests, and open PRs.
  • Multi-agent systems: Coordinators dispatching to specialized agents, review pipelines, planning chains.
  • Scheduled maintenance: Cron-based agents that audit code, update dependencies, or generate reports.
  • Collaborative workspaces: Multiple users observing and interacting with the same agent session in realtime.

Minimal Project

After the quickstart, customize your agent with the Registry.

Agents

Sessions & Transcripts

Create agent sessions, send prompts, and stream responses in realtime. Transcripts are persisted automatically across sleep/wake cycles.

See Full Example or Documentation

Approvals

Approve or deny agent tool use with human-in-the-loop patterns or auto-approve for trusted workloads.

See Full Example or Documentation

Bindings

Expose your JavaScript functions to agents as CLI commands inside the VM. Each binding group becomes a binary at /usr/local/bin/agentos-{name}, and each binding becomes a subcommand with flags auto-generated from its Zod input schema. The server below defines a weather binding group with a forecast binding; the client opens a session and prompts the agent, which calls the binding itself as a shell command.

See Full Example or Documentation

Agent-to-Agent

Let one agent call another through a binding. The coder gets a review binding it invokes itself, which bridges into the reviewer’s isolated VM.

See Full Example or Documentation

Multiplayer & Realtime

Connect multiple clients to the same agent VM. All subscribers see session output, process logs, and shell data in realtime.

See Full Example or Documentation

Workflows

Orchestrate multi-step agent tasks with durable workflows that survive crashes and restarts.

import { agentOS, setup } from "@rivet-dev/agentos";
import { actor, queue } from "rivetkit";
import { workflow } from "rivetkit/workflow";
import pi from "./software/pi";

const vm = agentOS({ software: [pi] });

// A durable workflow actor. Its `run` is built with `workflow()`, so every
// `step(...)` is recorded, retried, and resumed: if the process crashes
// mid-run, replay skips completed steps and continues where it left off.
const bugFixer = actor({
  queues: {
    fixBug: queue<{ repo: string; issue: string }>(),
  },
  run: workflow(async (ctx) => {
    await ctx.loop("fix-bug-loop", async (loopCtx) => {
      // Wait durably for the next bug-fix request from the queue.
      const message = await loopCtx.queue.next("wait-fix-bug");
      const { repo, issue } = message.body;

      // The typed client is reached from inside a `step` (the only scope with
      // actor data). Each step re-derives the VM handle from `step.client()`.
      await loopCtx.step("clone-repo", (step) =>
        step
          .client<typeof registry>()
          .vm.getOrCreate("bug-fixer")
          .exec(`git clone ${repo} /home/agentos/repo`),
      );

      await loopCtx.step("fix-bug", async (step) => {
        const agent = step.client<typeof registry>().vm.getOrCreate("bug-fixer");
        const sessionId = await agent.createSession("claude", {
          env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY! },
        });
        await agent.sendPrompt(sessionId, `Fix the bug in issue: ${issue}`);
        await agent.closeSession(sessionId);
      });

      await loopCtx.step("run-tests", (step) =>
        step
          .client<typeof registry>()
          .vm.getOrCreate("bug-fixer")
          .exec("cd /home/agentos/repo && npm test"),
      );
    });
  }),
});

export const registry = setup({ use: { vm, bugFixer } });
registry.start();

Documentation

Operating System

Filesystem

Read, write, and manage files inside the VM. The /home/agentos directory is persisted automatically across sleep/wake cycles.

See Full Example or Documentation

Processes & Shell

Execute commands, spawn long-running processes, and open interactive shells.

See Full Example or Documentation

Networking & Previews

Proxy HTTP requests into VMs with vmFetch. Create preview URLs for port forwarding VM services to shareable public URLs.

See Full Example or Documentation

Cron Jobs

Schedule recurring commands and agent sessions with cron expressions.

See Full Example or Documentation

Sandbox Mounting

agentOS uses a hybrid model: agents run in a lightweight VM by default and mount a full sandbox on demand for heavy workloads like browsers, compilation, and desktop automation. Sandboxes are powered by Sandbox Agent, so you can swap providers without changing agent code. Mount the sandbox as a filesystem and expose its process management as bindings.

import { agentOS, setup } from "@rivet-dev/agentos";
import { createSandboxFs, createSandboxBindings } from "@rivet-dev/agentos-sandbox";
import { SandboxAgent } from "sandbox-agent";
import { docker } from "sandbox-agent/docker";

const sandbox = await SandboxAgent.start({ sandbox: docker() });

const vm = agentOS({
  // Toolkits let the agent control the sandbox
  toolKits: [createSandboxBindings({ client: sandbox })],
  // Mounts let the agent read the sandbox filesystem (optional)
  mounts: [
    { path: "/home/agentos/sandbox", plugin: createSandboxFs({ client: sandbox }) },
  ],
});

export const registry = setup({ use: { vm } });
registry.start();

Documentation