Skip to main content
General

Quickstart (Hosted)

Create durable agentOS VMs by ID and control them from the RivetKit client or plain HTTP.

Hosted agentOS VMs run as the prebuilt agentOS Rivet Actor, on Rivet Cloud or on your own Rivet control plane. Create a VM by key, then control it from the @rivet-dev/agentos client or plain HTTP. To run VMs inside your own Node.js process instead, see the library quickstart.

Which one should I use?

HostedLibrary
RunsAs a durable instance on Rivet Cloud or a self-hosted Docker imageEmbedded inside your process as a library
LifecycleDurable, sleeps when idle unless a process is running; see actor lifecycleEphemeral, runs until dispose() or process exit
Package@rivet-dev/agentos, or plain HTTP@rivet-dev/agentos-core
VM identityA durable VM you create by key and reach by IDA handle your process owns until dispose()
ConfigurationStored with the VM and versionedPassed to AgentOs.create()
ClientsYour backend, or browsers with a scoped JWTYour backend
Host accessNoneHost functions, host mounts, external sandboxes
PreviewsExpiring preview URLsNone
Best forLong-lived VMs shared across clientsEmbedding VMs in an existing backend

Create a VM

Rivet Cloud

Create a project on Rivet Cloud

Sign up at the Rivet dashboard and create a new project.

Select agentOS as the product to run

When creating the project, choose agentOS as the product.

Point your client at it

Set RIVET_NAMESPACE and RIVET_TOKEN from your project, then create a VM by ID from TypeScript or plain HTTP:

Self-hosting

See Self-Hosting (Hosted) to run hosted VMs on your own infrastructure.

Show me the code

Run Bash Commands

Work With the Filesystem

v1.filesystem.readFile returns raw bytes, which the JSON encoding of the HTTP API cannot carry, so the HTTP example reads the file through a process.

Run a Dev Server & Create Preview URLs

Start a Node.js server in the VM, then expose its port through a signed URL that expires on its own, or revoke it early. A running server keeps the VM awake. Open the preview at /gateway/$VM_ID@$VM_TOKEN/request followed by the returned path, with a token that can reach the VM.

Use the Language Runtimes

Run JavaScript, TypeScript, and Python directly, with npm and pip installs built in.

Schedule Cron Jobs

Install Software

Install tools from the software registry while the VM is running. Packages are verified against their digest before their commands appear on /opt/agentos/bin.

Give Clients Direct Access With JWTs

Keep your admin token on the backend and issue a JWT scoped to one VM. Browsers and other untrusted clients can then call that VM directly, and nothing else.

Next steps