mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 04:03:31 +00:00
Add an Agent Computer provider to the TypeScript SDK, wire in provider-specific inspector URLs, and document the new deploy flow with an example package. Co-authored-by: Codex <noreply@openai.com>
60 lines
1.8 KiB
Text
60 lines
1.8 KiB
Text
---
|
|
title: "Agent Computer"
|
|
description: "Run Sandbox Agent on Agent Computer managed workers."
|
|
---
|
|
|
|
## Prerequisites
|
|
|
|
- `COMPUTER_API_KEY` or `AGENTCOMPUTER_API_KEY`
|
|
- An Agent Computer managed-worker image, or default machine source, that already has your coding agent authenticated
|
|
|
|
The platform image already includes Sandbox Agent, Claude Code, and Codex. Agent credentials still live inside the machine, so make sure your image or workspace bootstrap has already handled agent login.
|
|
|
|
## TypeScript example
|
|
|
|
```bash
|
|
npm install sandbox-agent@0.4.x
|
|
```
|
|
|
|
```typescript
|
|
import { SandboxAgent } from "sandbox-agent";
|
|
import { agentcomputer } from "sandbox-agent/agentcomputer";
|
|
|
|
const sdk = await SandboxAgent.start({
|
|
sandbox: agentcomputer(),
|
|
});
|
|
|
|
try {
|
|
const health = await sdk.getHealth();
|
|
console.log(health.status);
|
|
console.log(sdk.inspectorUrl);
|
|
|
|
const agents = await sdk.listAgents();
|
|
console.log(agents.agents.map((agent) => agent.id));
|
|
} finally {
|
|
await sdk.destroySandbox();
|
|
}
|
|
```
|
|
|
|
The `agentcomputer` provider creates a managed-worker computer, waits until browser access is ready, and routes SDK requests through the machine's authenticated web host. `sdk.inspectorUrl` is already a browser-ready URL, so it opens the built-in Inspector directly.
|
|
|
|
By default, the provider creates:
|
|
|
|
- `runtimeFamily: "managed-worker"`
|
|
- `usePlatformDefault: true`
|
|
|
|
Pass `create` when you want to override the handle, workspace name, or other machine-create settings:
|
|
|
|
```typescript
|
|
const sdk = await SandboxAgent.start({
|
|
sandbox: agentcomputer({
|
|
create: {
|
|
handle: "sandbox-agent-demo",
|
|
workspaceName: "sandbox-agent-demo",
|
|
usePlatformDefault: false,
|
|
},
|
|
}),
|
|
});
|
|
```
|
|
|
|
Set `apiUrl` when you are targeting a self-hosted or local Agent Computer API instead of `https://api.computer.agentcomputer.ai`.
|