Skip to content

Commit 618d86b

Browse files
Merge pull request #61 from diggerhq/improve-readme
Improve README with agent SDK example and architecture overview
2 parents 0dc7df6 + 9b90209 commit 618d86b

File tree

1 file changed

+86
-5
lines changed

1 file changed

+86
-5
lines changed

README.md

Lines changed: 86 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[![npm](https://img.shields.io/npm/v/@opencomputer/sdk)](https://www.npmjs.com/package/@opencomputer/sdk)
2+
[![PyPI](https://img.shields.io/pypi/v/opencomputer-sdk)](https://pypi.org/project/opencomputer-sdk/)
3+
[![GitHub stars](https://img.shields.io/github/stars/diggerhq/opencomputer)](https://github.com/diggerhq/opencomputer)
4+
15
# OpenComputer
26

37
Long-running cloud infrastructure for AI agents. Real computers, not sandboxes.
@@ -12,7 +16,7 @@ Think of it as the compute equivalent of a laptop that sleeps when you close the
1216
- **Checkpoints** - Instant snapshots. Fork or restore to any point. Break something, roll back in a second.
1317
- **Preview URLs** - Expose ports externally with auth (Clerk) and custom domains. Give every environment a live URL.
1418
- **Per-tenant package control** - Manage and hot-swap software versions inside running VMs. Every tenant gets exactly the stack they need.
15-
- **Claude agent SDK** - optimised for claude agent sdk workloads, higher level primitives available to achieve streaming.
19+
- **Claude Agent SDK** - Optimised for Claude Agent SDK workloads, with higher-level primitives for streaming.
1620

1721
## Quick start
1822

@@ -58,10 +62,87 @@ console.log(output.stdout); // hello
5862
await sandbox.kill();
5963
```
6064

61-
## Documentation
65+
### Agent SDK
66+
67+
Run a full Claude agent session inside the VM with real-time event streaming:
68+
69+
```typescript
70+
import { Sandbox } from '@opencomputer/sdk';
71+
72+
const sandbox = await Sandbox.create({
73+
template: 'default',
74+
apiKey: 'YOUR_API_KEY',
75+
envs: { ANTHROPIC_API_KEY: 'YOUR_ANTHROPIC_KEY' },
76+
});
77+
78+
// Start a Claude agent session inside the sandbox
79+
const session = await sandbox.agent.start({
80+
prompt: 'Create a todo app with React',
81+
systemPrompt: 'You are a senior fullstack developer...',
82+
maxTurns: 30,
83+
cwd: '/workspace',
84+
onEvent: (event) => {
85+
switch (event.type) {
86+
case 'assistant':
87+
console.log('Agent:', event.message?.content);
88+
break;
89+
case 'turn_complete':
90+
console.log('Done!');
91+
break;
92+
case 'error':
93+
console.error(event.message);
94+
break;
95+
}
96+
},
97+
});
98+
99+
// Get a live preview URL
100+
const preview = await sandbox.createPreviewURL({ port: 80 });
101+
console.log('Preview:', preview);
102+
```
103+
104+
## How it works
105+
106+
OpenComputer gives each agent a full Linux VM (not a container). The agent loop runs *inside* the VM alongside the filesystem and preview server — no network hops between your agent and the code it's writing.
107+
108+
```
109+
┌─────────────────────────────────┐
110+
│ OpenComputer VM │
111+
│ │
112+
│ ┌───────────────────────────┐ │
113+
│ │ Claude Agent SDK │ │
114+
│ │ (agent loop + tools) │ │
115+
│ └─────────┬─────────────────┘ │
116+
│ │ │
117+
│ ┌─────────▼──┐ ┌───────────┐ │
118+
│ │ Filesystem │ │ Preview │ │
119+
│ │ /workspace │ │ Server │ │
120+
│ └────────────┘ └───────────┘ │
121+
│ │
122+
│ Hibernates when idle │
123+
│ Wakes in seconds │
124+
└─────────────────────────────────┘
125+
```
126+
127+
VMs hibernate instead of dying. State survives across sessions without manual snapshot/restore. No more re-installing node_modules because the container timed out.
128+
129+
## Why not containers?
130+
131+
| | Ephemeral sandboxes | OpenComputer |
132+
| -------------- | -------------------------------- | ----------------------------------- |
133+
| Persistence | Starts from scratch every time | Hibernates and resumes |
134+
| Runtime | Containers with time limits | Full VMs, no timeouts |
135+
| Agent loop | Runs externally, talks over network | Runs inside the VM |
136+
| File I/O | Network round-trips | Local, instant |
137+
| State | Lost on timeout | Survives across sessions |
138+
139+
## Guides
62140

63-
https://docs.opencomputer.dev/
141+
- [Building an Open Lovable - part 1](https://opencomputer.dev/guides/building-open-lovable-part-1) — Build a Lovable clone using Claude Agent SDK and OpenComputer
64142

65-
## Website
143+
## Links
66144

67-
https://opencomputer.dev/
145+
- [Documentation](https://docs.opencomputer.dev/)
146+
- [Website](https://opencomputer.dev/)
147+
- [Guides](https://opencomputer.dev/guides)
148+
- [Talk to founders](https://cal.com/team/digger/opencomputer-founder-chat)

0 commit comments

Comments
 (0)