Skip to content

Commit 02ffde5

Browse files
committed
docs(agentos): add embedded quickstart
1 parent 1bf3280 commit 02ffde5

132 files changed

Lines changed: 491 additions & 632 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ const result = await handle.exec("cat /out.txt");
106106
console.log(result.stdout); // "hi"
107107
```
108108

109-
`@rivet-dev/agentos` runs each VM as a Rivet Actor with built-in persistence, sleep/wake, multiplayer, preview URLs, and orchestration. For direct in-process VM control without the actor runtime, use [`@rivet-dev/agentos-core`](https://agentos-sdk.dev/docs/core) standalone: `AgentOs.create()` boots a VM and returns a handle you call directly.
109+
`@rivet-dev/agentos` runs each VM as a Rivet Actor with built-in persistence, sleep/wake, multiplayer, preview URLs, and orchestration. To embed VM control in an existing Node.js application without the actor runtime, use [`@rivet-dev/agentos-core`](https://agentos-sdk.dev/docs/quickstart-embedded): `AgentOs.create()` boots a VM and returns a handle you call directly.
110110

111111
See the [Quickstart guide](https://agentos-sdk.dev/docs/quickstart) for the full walkthrough. agentOS is in preview and the API is subject to change — questions and issues welcome on [Discord](https://rivet.dev/discord).
112112

docs-internal/design/execution-api-redesign.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ There is no `vm.executions.*` after this change.
382382
- `website/src/content/docs/docs/javascript.mdx`
383383
- `website/src/content/docs/docs/python.mdx`
384384
- `docs/features/typescript.mdx`
385-
- `website/src/content/docs/docs/core.mdx`
385+
- `website/src/content/docs/docs/embedded.mdx`
386386
- Add a "Contexts" section; retarget the TS namespace; replace all `executionId`
387387
/ `createIfMissing` / `detached` call sites with `createContext` / `contextId`
388388
/ `spawn`. Validate with `pnpm --dir website build`.

docs/content/docs/architecture.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ An agent (such as [Pi](https://github.com/mariozechner/pi-coding-agent)) is just
307307

308308
## Orchestration (Rivet Actors)
309309

310-
The `agentOS()` actor (from `@rivet-dev/agentos`) wraps the raw VM in a [Rivet Actor](/agentos/docs/core), which adds durable state, scheduling, and orchestration. This is what gives you persistence, cron, and workflows out of the box. It also registers the [inspector](/agentos/docs/inspector) tabs in the Rivet dashboard, so every actor comes with a live view of its transcript, filesystem, and processes.
310+
The `agentOS()` actor (from `@rivet-dev/agentos`) wraps the raw VM in a [Rivet Actor](/actors/docs/), which adds durable state, scheduling, and orchestration. This is what gives you persistence, cron, and workflows out of the box. It also registers the [inspector](/agentos/docs/inspector) tabs in the Rivet dashboard, so every actor comes with a live view of its transcript, filesystem, and processes.
311311

312312
<svg viewBox="0 0 700 200" role="img" aria-label="A Rivet Actor wraps an agentOS VM and adds durable state, cron scheduling, workflows, and sleep/wake persistence." style="width:100%;height:auto;max-width:680px;display:block;margin:1.5rem auto 0.5rem;">
313313
<rect x="40" y="20" width="620" height="160" rx="14" fill="#faf8f3" stroke="#1b1916" stroke-width="1.5" />

docs/content/docs/crash-course.mdx

Lines changed: 0 additions & 159 deletions
This file was deleted.
Lines changed: 31 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
---
2-
title: "Direct VM API"
3-
description: "Use the direct agentOS VM API to create and control isolated execution environments, or compose it inside a Rivet Actor."
2+
title: "Embedded VMs"
3+
description: "Reference for embedding agentOS VMs in an existing Node.js application without Rivet Actors."
44
skill: true
55
---
66

7-
`@rivet-dev/agentos` ships both the direct `AgentOs` VM API and the `agentOS()`
8-
actor API.
7+
Use the embedded API when you already have a Node.js application and want to
8+
control agentOS VMs directly. You manage VM identity, persistence, and lifecycle
9+
yourself instead of using Rivet Actors.
910

10-
## Direct VM vs actor
11+
To create your first embedded VM, start with the
12+
[embedded quickstart](/agentos/docs/quickstart-embedded).
1113

12-
| | Direct VM | Actor |
14+
## Embedded API vs actor
15+
16+
| | Embedded API | Actor |
1317
|-|---|---|
1418
| Persistence | In-memory by default (pluggable via [mounts](#mounts)) | Persistent filesystem and sessions |
1519
| Distributed state | Manage yourself | Built-in |
@@ -24,29 +28,16 @@ actor API.
2428

2529
- Use [Rivet Actors](/actors/docs/) for persistence,
2630
networking, and orchestration.
27-
- Use `AgentOs.create()` for direct VM control in a Node.js process.
28-
- `agentOS()` returns an ordinary TypeScript Rivet actor definition VM options
31+
- Use `AgentOs.create()` to embed VM control in a Node.js application.
32+
- `agentOS()` returns an ordinary TypeScript Rivet actor definition: VM options
2933
plus normal actor state, actions, events, queues, connection types, and
3034
lifecycle hooks (`onBeforeConnect`).
31-
- AgentOS actions/events merge in automatically; their names are reserved.
32-
- The VM is created lazily on the first AgentOS action after wake, disposed on
33-
sleep so a connection can subscribe before `vmBooted`.
35+
- agentOS actions/events merge in automatically; their names are reserved.
36+
- The VM is created lazily on the first agentOS action after wake, disposed on
37+
sleep, so a connection can subscribe before `vmBooted`.
3438
- Creation input flows through `client.vm.create("key", { input })` and reaches
3539
`createState(c, input)` and `onCreate(c, input)`.
3640

37-
## Install
38-
39-
```bash
40-
npm install @rivet-dev/agentos
41-
```
42-
43-
## Boot a VM
44-
45-
`AgentOs.create()` boots the VM in-process and returns a handle you call
46-
directly — no actor runtime, no client/server split.
47-
48-
<CodeSnippet file="examples/core/vm.ts" region="boot" title="vm.ts" />
49-
5041
## Sidecar process
5142

5243
- Every VM runs inside a **shared sidecar process**, not its own process.
@@ -57,14 +48,14 @@ directly — no actor runtime, no client/server split.
5748
- Automatic for `agentOS()`, `AgentOs.create()`, and Rivet Actors.
5849
- Disposing a VM tears down only that VM; the sidecar is reused for the host
5950
process lifetime.
60-
- Advanced: the direct VM API exposes explicit sidecar handles to isolate a
51+
- Advanced: the embedded API exposes explicit sidecar handles to isolate a
6152
group of VMs in their own process.
6253

63-
<CodeSnippet file="examples/core/advanced.ts" title="advanced.ts" />
54+
<CodeSnippet file="examples/embedded/advanced.ts" title="advanced.ts" />
6455

6556
## Filesystem
6657

67-
<CodeSnippet file="examples/core/vm.ts" region="filesystem" title="vm.ts" />
58+
<CodeSnippet file="examples/embedded/vm.ts" region="filesystem" title="vm.ts" />
6859

6960
## Contexts
7061

@@ -73,7 +64,7 @@ Create one explicitly, then pass its `contextId`; unknown IDs fail instead of
7364
silently creating fresh state. A context pins to the first inline language used,
7465
although JavaScript and TypeScript intentionally share one isolate.
7566

76-
<CodeSnippet file="examples/core/vm.ts" region="contexts" title="vm.ts" />
67+
<CodeSnippet file="examples/embedded/vm.ts" region="contexts" title="vm.ts" />
7768

7869
Contexts live for the VM lifetime. In an actor, sleep disposes the VM and its
7970
contexts, so create a context lazily on the first stateful action after wake
@@ -82,10 +73,10 @@ instead of persisting and blindly reusing its ID.
8273
## Processes
8374

8475
- `process.spawn()` and language `spawn` methods return a numeric `pid`.
85-
- `onProcessOutput(pid, …)` unified stdout/stderr stream.
86-
- `onProcessExit(pid, …)` completion.
76+
- `onProcessOutput(pid, …)`: unified stdout/stderr stream.
77+
- `onProcessExit(pid, …)`: completion.
8778

88-
<CodeSnippet file="examples/core/vm.ts" region="processes" title="vm.ts" />
79+
<CodeSnippet file="examples/embedded/vm.ts" region="processes" title="vm.ts" />
8980

9081
## Agent sessions
9182

@@ -97,54 +88,54 @@ instead of persisting and blindly reusing its ID.
9788
- Durable entries recover via `readHistory`; ephemeral agent/thought deltas do
9889
not.
9990

100-
<CodeSnippet file="examples/core/vm.ts" region="sessions" title="vm.ts" />
91+
<CodeSnippet file="examples/embedded/vm.ts" region="sessions" title="vm.ts" />
10192

10293
## Networking
10394

10495
`httpRequest({ port, path, ... })` reaches a server inside the VM and returns a
10596
bounded, serializable response DTO.
10697

107-
<CodeSnippet file="examples/core/vm.ts" region="networking" title="vm.ts" />
98+
<CodeSnippet file="examples/embedded/vm.ts" region="networking" title="vm.ts" />
10899

109100
## Cron jobs
110101

111102
- Run an `"exec"` command or a `"session"` prompt on a schedule.
112103
- Fired jobs surface through `onCronEvent`.
113104

114-
<CodeSnippet file="examples/core/vm.ts" region="cron" title="vm.ts" />
105+
<CodeSnippet file="examples/embedded/vm.ts" region="cron" title="vm.ts" />
115106

116107
## Mounts
117108

118109
- Configure filesystem backends at boot.
119110
- Native mount plugins (host directories, S3, etc.) are passed via `plugin`,
120111
each with an `id` and a `config`.
121112

122-
<CodeSnippet file="examples/core/mounts.ts" title="mounts.ts" />
113+
<CodeSnippet file="examples/embedded/mounts.ts" title="mounts.ts" />
123114

124115
## Configuration reference
125116

126117
- All VM config is a single flat object passed to `AgentOs.create()`.
127118
- The [`agentOS()` actor](/agentos/docs/quickstart) accepts the same options and layers
128119
persistence, sleep/wake, and preview URLs on top.
129120

130-
<CodeSnippet file="examples/core/config-reference.ts" title="config-reference.ts" />
121+
<CodeSnippet file="examples/embedded/config-reference.ts" title="config-reference.ts" />
131122

132123
See [Mounts](#mounts) and [Software](/agentos/docs/software).
133124

134125
### Session events
135126

136127
- `onSessionEvent` receives a union of exact native ACP `SessionUpdate`,
137128
`RequestPermissionRequest`, and `RequestPermissionResponse` payloads wrapped
138-
with AgentOS durability metadata.
129+
with agentOS durability metadata.
139130
- Register before prompting.
140131
- On reconnect, read durable history after your last sequence and dedup by
141132
`(sessionId, sequence)`.
142133

143-
<CodeSnippet file="examples/core/hooks.ts" title="hooks.ts" />
134+
<CodeSnippet file="examples/embedded/hooks.ts" title="hooks.ts" />
144135

145136
### Timeouts and sleep
146137

147138
- Action timeouts and automatic sleep/wake are [`agentOS()` actor](/agentos/docs/quickstart)
148-
features, not the direct VM API.
149-
- A direct VM stays alive until `dispose()`. See
139+
features, not the embedded API.
140+
- A VM created through the embedded API stays alive until `dispose()`. See
150141
[Persistence & Sleep](/agentos/docs/persistence).

docs/content/docs/filesystem.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ The actor's durable root is handled separately: the sidecar connects directly to
6262

6363
## File operations
6464

65-
These operations are primarily what the agent uses inside the VM, and are also available from the client to seed inputs and read results. For large or read-only inputs (a repo, a dataset), a read-only [host mount](#mounts) is faster than copying files in. Programs that need stdin or live output use exec instead (see the [Direct VM API](/agentos/docs/core)).
65+
These operations are primarily what the agent uses inside the VM, and are also available from the client to seed inputs and read results. For large or read-only inputs (a repo, a dataset), a read-only [host mount](#mounts) is faster than copying files in. Programs that need stdin or live output use exec instead (see the [embedded API](/agentos/docs/embedded)).
6666

6767
### Read and write
6868

docs/content/docs/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ and orchestration built in.
1111
<Card title="Quickstart" href="/agentos/docs/quickstart">
1212
Boot a VM and run your first coding agent.
1313
</Card>
14-
<Card title="Crash Course" href="/agentos/docs/crash-course">
15-
Learn the core agentOS concepts.
14+
<Card title="Quickstart (Embedded)" href="/agentos/docs/quickstart-embedded">
15+
Run agentOS directly inside an existing Node.js application.
1616
</Card>
1717
<Card title="Agents" href="/agentos/docs/agents/pi">
1818
Run Pi, Claude Code, Codex, and OpenCode.

0 commit comments

Comments
 (0)