Skip to content

Commit c75b601

Browse files
refactor(agentos): simplify the VM runtime API
Co-authored-by: Sree Narayanan <sreeaadhi07@gmail.com>
1 parent 63ae3b2 commit c75b601

1,303 files changed

Lines changed: 31453 additions & 274371 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.

‎.claude/skills/gigacode-api-sanity/SKILL.md‎

Lines changed: 0 additions & 52 deletions
This file was deleted.

‎.claude/skills/gigacode-api-sanity/agents/openai.yaml‎

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 22 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,39 @@
11
---
22
name: sanity-check
3-
description: Run the deferred AgentOS E2E smoke test from public npm packages. Use when the user asks to sanity check, smoke test, or verify a release works.
3+
description: Run the deferred agentOS VM smoke test from public npm packages. Use when the user asks to sanity check, smoke test, or verify a release works.
44
---
55

66
# Sanity Check
77

8-
This is a P6/full-validation check. It installs from npm in a fresh project,
9-
boots an AgentOS VM, spawns a Pi agent session, writes a file, reads it back,
10-
and verifies the contents.
8+
This is a full-validation check. Install `@rivet-dev/agentos-core` from npm in
9+
a fresh temporary project, boot one VM, verify filesystem and process execution,
10+
then dispose it cleanly.
1111

12-
## Usage
13-
- `/sanity-check` — run in a temp directory on the host
14-
- `/sanity-check docker` — run inside a `node:22` Docker container
15-
- `/sanity-check <custom instructions>` — extra instructions, such as "use rc.3", "use pnpm", or "test on node 20"
12+
## Test program
1613

17-
## What it tests
18-
19-
1. `npm install` of `@rivet-dev/agentos-core`, `@rivet-dev/agentos-pi`, `@agentos-software/common` from the public npm registry
20-
2. Boot a VM with WASM coreutils (bash, cat, sh, etc.) and the Pi SDK ACP adapter
21-
3. Create a Pi agent session with a real Anthropic API key
22-
4. Send a prompt that uses the **write tool** to create `/tmp/test.txt` with "Hello from Agent OS!" and the **bash tool** to run `cat /tmp/test.txt`
23-
5. Verify the file contents from the host side via `vm.readFile()`
24-
25-
## Requirements
26-
27-
- `ANTHROPIC_API_KEY` must be set in the environment. If not set, load it from `~/misc/env.txt`.
28-
- Node.js 22+ (or Docker with `node:22` image)
29-
30-
## Steps
31-
32-
### 1. Set up the test project
33-
34-
Create a temp directory (e.g. `/tmp/agentos-sanity-XXXX`) with two files:
35-
36-
**package.json:**
37-
```json
38-
{
39-
"name": "agentos-sanity-check",
40-
"private": true,
41-
"type": "module",
42-
"dependencies": {
43-
"@rivet-dev/agentos-core": "*",
44-
"@rivet-dev/agentos-pi": "*",
45-
"@agentos-software/common": "*",
46-
"@mariozechner/pi-coding-agent": "^0.60.0",
47-
"@agentclientprotocol/sdk": "^0.16.1"
48-
}
49-
}
50-
```
51-
52-
If the user specifies a version (e.g. "use rc.3"), pin `@rivet-dev/agentos-core` and `@rivet-dev/agentos-pi` to that version.
53-
54-
**test.mjs:**
5514
```js
5615
import { AgentOs } from "@rivet-dev/agentos-core";
57-
import common from "@agentos-software/common";
58-
import pi from "@rivet-dev/agentos-pi";
59-
60-
const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY;
61-
if (!ANTHROPIC_API_KEY) {
62-
console.error("ANTHROPIC_API_KEY is required");
63-
process.exit(1);
64-
}
65-
66-
console.log("Creating VM with common + pi...");
67-
const vm = await AgentOs.create({ software: [common, pi] });
6816

69-
console.log("Creating PI agent session...");
70-
const { sessionId } = await vm.createSession("pi", {
71-
env: { ANTHROPIC_API_KEY },
72-
});
73-
console.log(`Session created: ${sessionId}`);
74-
75-
vm.onSessionEvent(sessionId, (event) => {
76-
const params = event.params;
77-
if (params?.update?.sessionUpdate === "agent_message_chunk") {
78-
process.stdout.write(params.update.content?.text ?? "");
79-
}
80-
});
81-
82-
console.log("\nSending prompt...");
83-
const response = await vm.prompt(
84-
sessionId,
85-
'Write the text "Hello from Agent OS!" to /tmp/test.txt using the write tool. Then use the bash tool to run `cat /tmp/test.txt` and tell me what it says.',
86-
);
87-
console.log(`\n\nPrompt completed: ${response.stopReason}`);
88-
89-
console.log("\nVerifying file...");
17+
const vm = await AgentOs.create();
9018
try {
91-
const data = await vm.readFile("/tmp/test.txt");
92-
const text = new TextDecoder().decode(data);
93-
console.log(`File contents: "${text.trim()}"`);
94-
if (text.includes("Hello from Agent OS!")) {
95-
console.log("\n✅ E2E TEST PASSED");
96-
} else {
97-
console.log("\n❌ E2E TEST FAILED: wrong content");
98-
process.exit(1);
19+
await vm.filesystem.writeFile("/tmp/test.txt", "Hello from agentOS!\n");
20+
const result = await vm.process.exec("cat /tmp/test.txt");
21+
if (result.exitCode !== 0 || result.stdout !== "Hello from agentOS!\n") {
22+
throw new Error(JSON.stringify(result));
9923
}
100-
} catch (err) {
101-
console.log(`\n❌ E2E TEST FAILED: ${err.message}`);
102-
process.exit(1);
24+
console.log("agentOS smoke passed");
25+
} finally {
26+
await vm.dispose();
10327
}
104-
105-
vm.closeSession(sessionId);
106-
await vm.dispose();
107-
```
108-
109-
### 2. Run the test
110-
111-
**Default (temp dir on host):**
112-
```bash
113-
cd /tmp/agentos-sanity-XXXX
114-
npm install
115-
node test.mjs
11628
```
11729

118-
**Docker mode:**
119-
```bash
120-
docker run --rm \
121-
-e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \
122-
-v /tmp/agentos-sanity-XXXX:/app \
123-
-w /app \
124-
node:22 \
125-
bash -c "npm install && timeout 120 node test.mjs"
126-
```
127-
128-
### 3. Verify results
129-
130-
- LLM response should stream to stdout showing the agent using write and bash tools
131-
- Final output must include `✅ E2E TEST PASSED`
132-
- If it fails, report the error and the stderr output
133-
134-
### 4. Clean up
135-
136-
Remove the temp directory after the test completes.
137-
13830
## Rules
139-
- Always use a fresh temp directory — never run in the repo itself.
140-
- Always install from the public npm registry — never use local links.
141-
- If Docker mode, clean up the container's node_modules via `docker run --rm` before removing the host temp dir.
142-
- Report the installed versions of `@rivet-dev/agentos-core` and `@agentos-software/common` in the output.
31+
32+
- Always use a fresh temporary directory, never the repository.
33+
- Install from the public npm registry without local links.
34+
- Report the installed `@rivet-dev/agentos-core` version.
35+
- Use Node.js 22 or newer.
36+
- Apply a two-minute outer timeout.
37+
- Remove the temporary directory after completion.
38+
- Do not install registry software from npm. Core ships its default immutable
39+
`.aospkg` bundle.

‎.claude/skills/update-acp/SKILL.md‎

Lines changed: 0 additions & 18 deletions
This file was deleted.

‎.github/workflows/ci-nightly.yml‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,20 @@ jobs:
4848
run: echo "RUSTUP_TOOLCHAIN=stable" >> "$GITHUB_ENV"
4949
# Browser support is retained in-tree but disabled during the unified
5050
# native sidecar reactor migration, so it must not gate native CI.
51-
- run: cargo check --workspace --exclude agentos-sidecar-browser --exclude agentos-native-sidecar-browser
52-
- run: cargo clippy --workspace --exclude agentos-sidecar-browser --exclude agentos-native-sidecar-browser --all-targets -- -D warnings
51+
- run: cargo check --workspace --exclude agentos-native-sidecar-browser
52+
- run: cargo clippy --workspace --exclude agentos-native-sidecar-browser --all-targets -- -D warnings
5353
- run: pnpm check-types
5454
- name: Build sidecars once for all TypeScript runtime suites
55-
run: cargo build -p agentos-sidecar -p agentos-native-sidecar
55+
run: cargo build -p agentos-native-sidecar
5656
- run: pnpm test
5757
env:
5858
AGENTOS_E2E_NETWORK: '1'
59-
AGENTOS_SIDECAR_BIN: ${{ github.workspace }}/target/debug/agentos-sidecar
59+
AGENTOS_SIDECAR_BIN: ${{ github.workspace }}/target/debug/agentos-native-sidecar
6060
AGENTOS_NATIVE_SIDECAR_BIN: ${{ github.workspace }}/target/debug/agentos-native-sidecar
6161
- run: pnpm test:nightly
6262
env:
6363
AGENTOS_E2E_NETWORK: '1'
64-
AGENTOS_SIDECAR_BIN: ${{ github.workspace }}/target/debug/agentos-sidecar
64+
AGENTOS_SIDECAR_BIN: ${{ github.workspace }}/target/debug/agentos-native-sidecar
6565
AGENTOS_NATIVE_SIDECAR_BIN: ${{ github.workspace }}/target/debug/agentos-native-sidecar
6666
# These opt-in gates cold-install pinned ecosystem fixtures and exercise
6767
# package-manager workflows inside the VM, so keep them off the cheap PR path.
@@ -75,7 +75,7 @@ jobs:
7575
- run: pnpm --dir packages/runtime-core test:npm-workflows
7676
env:
7777
AGENTOS_NATIVE_SIDECAR_BIN: ${{ github.workspace }}/target/debug/agentos-native-sidecar
78-
- run: cargo test --workspace --exclude agentos-sidecar-browser --exclude agentos-native-sidecar-browser -- --test-threads=1
78+
- run: cargo test --workspace --exclude agentos-native-sidecar-browser -- --test-threads=1
7979
- name: Explicit ignored runtime churn gate
8080
run: cargo test -p agentos-runtime multi_vm_generation_soak_has_no_accounting_or_scheduler_drift --lib -- --ignored --test-threads=1
8181
- name: Explicit ignored multi-VM protocol soak gate

0 commit comments

Comments
 (0)