website/src/content/docs/agent-os/quickstart.mdx
npm install rivetkit @rivet-dev/agent-os-common @rivet-dev/agent-os-pi
const vm = agentOs({ options: { software: [common, pi] }, });
export const registry = setup({ use: { vm } }); registry.start();
```ts @nocheck client.ts
import { createClient } from "rivetkit/client";
import type { registry } from "./server";
const client = createClient<typeof registry>("http://localhost:6420");
const agent = client.vm.getOrCreate(["my-agent"]);
// Subscribe to streaming events
agent.on("sessionEvent", (data) => {
console.log(data.event);
});
// Create a session and send a prompt
const session = await agent.createSession("pi", {
env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY! },
});
await agent.sendPrompt(
session.sessionId,
"Write a hello world script to /home/user/hello.js",
);
// Read the file the agent created
const content = await agent.readFile("/home/user/hello.js");
console.log(new TextDecoder().decode(content));
Start the server:
npx tsx server.ts
Then in a separate terminal, run the client:
npx tsx client.ts
Now that you have a working agent, customize it to fit your needs:
The quickstart above uses rivetkit/agent-os, which includes statefulness, multiplayer, and orchestration out of the box. If you only need direct VM control without those features, you can use the core package (@rivet-dev/agent-os-core) standalone.
See agentOS core documentation for reference.