|
3 | 3 | </p> |
4 | 4 |
|
5 | 5 | <p align="center"> |
6 | | - A portable open-source operating system for AI agents.<br/>Near-zero cold starts (~6 ms), up to 32x cheaper than sandboxes.<br/>Powered by WebAssembly and V8 isolates. |
| 6 | + A portable open-source operating system for AI agents.<br/>Near-zero cold starts (~6 ms), up to 32x cheaper than sandboxes.<br/>Powered by WebAssembly and V8 isolates.<br/><br/>Supports Pi, Claude Code*, Codex*, Amp*, and OpenCode*<br/><sub>* coming soon</sub> |
7 | 7 | </p> |
8 | 8 |
|
9 | 9 | <p align="center"> |
10 | | - <a href="https://rivet.dev/docs/agent-os">Documentation</a> | <a href="https://rivet.dev/docs/agent-os/quickstart">Quickstart</a> | <a href="https://rivet.dev/docs/agent-os/versus-sandbox">agentOS vs Sandbox</a> |
| 10 | + <a href="https://rivet.dev/docs/agent-os">Documentation</a> | <a href="https://rivet.dev/docs/agent-os/quickstart">Quickstart</a> |
11 | 11 | </p> |
12 | 12 |
|
13 | 13 |
|
|
19 | 19 | - **Deploy anywhere**: Just an npm package. Works on your laptop, Rivet Cloud, Railway, Vercel, Kubernetes, or any container platform. |
20 | 20 | - **Open source**: Apache 2.0 licensed. Self-host or use [Rivet Cloud](https://rivet.dev/docs/agent-os/deployment) for managed infrastructure. |
21 | 21 |
|
| 22 | +### agentOS vs Sandbox |
| 23 | + |
| 24 | +agentOS is a lightweight VM that runs inside your process. Sandboxes are full Linux environments. agentOS integrates agents into your backend with [host tools](https://rivet.dev/docs/agent-os/tools) and granular permissions. Sandboxes give you a full OS for browsers, native binaries, and dev servers. |
| 25 | + |
| 26 | +You don't have to choose: agentOS works with sandboxes through the [sandbox extension](https://rivet.dev/docs/agent-os/sandbox), spinning up a full sandbox on demand and mounting the sandbox's file system when the workload needs it. |
22 | 27 |
|
23 | 28 | ## Quick start |
24 | 29 |
|
25 | 30 | ```bash |
26 | | -npm install rivetkit @rivet-dev/agent-os-common @rivet-dev/agent-os-pi |
| 31 | +npm install @rivet-dev/agent-os-core @rivet-dev/agent-os-common @rivet-dev/agent-os-pi |
27 | 32 | ``` |
28 | 33 |
|
29 | | -**server.ts** |
30 | | - |
31 | 34 | ```ts |
32 | | -import { agentOs } from "rivetkit/agent-os"; |
33 | | -import { setup } from "rivetkit"; |
| 35 | +import { AgentOs } from "@rivet-dev/agent-os-core"; |
34 | 36 | import common from "@rivet-dev/agent-os-common"; |
35 | 37 | import pi from "@rivet-dev/agent-os-pi"; |
36 | 38 |
|
37 | | -const vm = agentOs({ |
38 | | - options: { software: [common, pi] }, |
39 | | -}); |
40 | | - |
41 | | -export const registry = setup({ use: { vm } }); |
42 | | -registry.start(); |
43 | | -``` |
44 | | - |
45 | | -**client.ts** |
46 | | - |
47 | | -```ts |
48 | | -import { createClient } from "rivetkit/client"; |
49 | | -import type { registry } from "./server"; |
50 | | - |
51 | | -const client = createClient<typeof registry>("http://localhost:6420"); |
52 | | -const agent = client.vm.getOrCreate(["my-agent"]); |
53 | | - |
54 | | -// Subscribe to streaming events |
55 | | -agent.on("sessionEvent", (data) => { |
56 | | - console.log(data.event); |
57 | | -}); |
| 39 | +const vm = await AgentOs.create({ software: [common, pi] }); |
58 | 40 |
|
59 | 41 | // Create a session and send a prompt |
60 | | -const session = await agent.createSession("pi", { |
| 42 | +const { sessionId } = await vm.createSession("pi", { |
61 | 43 | env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY! }, |
62 | 44 | }); |
63 | | -await agent.sendPrompt( |
64 | | - session.sessionId, |
65 | | - "Write a hello world script to /home/user/hello.js", |
66 | | -); |
| 45 | + |
| 46 | +vm.onSessionEvent(sessionId, (event) => { |
| 47 | + console.log(event); |
| 48 | +}); |
| 49 | + |
| 50 | +await vm.prompt(sessionId, "Write a hello world script to /home/user/hello.js"); |
67 | 51 |
|
68 | 52 | // Read the file the agent created |
69 | | -const content = await agent.readFile("/home/user/hello.js"); |
| 53 | +const content = await vm.readFile("/home/user/hello.js"); |
70 | 54 | console.log(new TextDecoder().decode(content)); |
| 55 | + |
| 56 | +vm.closeSession(sessionId); |
| 57 | +await vm.dispose(); |
71 | 58 | ``` |
72 | 59 |
|
73 | 60 | See the [Quickstart guide](https://rivet.dev/docs/agent-os/quickstart) for the full walkthrough. |
|
0 commit comments