mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-17 19:03:57 +00:00
Add Agent Computer provider
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>
This commit is contained in:
parent
bf484e7c96
commit
e7d31de44f
17 changed files with 729 additions and 6 deletions
19
examples/agentcomputer/package.json
Normal file
19
examples/agentcomputer/package.json
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "@sandbox-agent/example-agentcomputer",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "tsx src/index.ts",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sandbox-agent/example-shared": "workspace:*",
|
||||
"sandbox-agent": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "latest",
|
||||
"tsx": "latest",
|
||||
"typescript": "latest",
|
||||
"vitest": "^3.0.0"
|
||||
}
|
||||
}
|
||||
19
examples/agentcomputer/src/index.ts
Normal file
19
examples/agentcomputer/src/index.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import { SandboxAgent } from "sandbox-agent";
|
||||
import { agentcomputer } from "sandbox-agent/agentcomputer";
|
||||
|
||||
const client = await SandboxAgent.start({
|
||||
sandbox: agentcomputer(),
|
||||
});
|
||||
|
||||
console.log(`UI: ${client.inspectorUrl}`);
|
||||
|
||||
const health = await client.getHealth();
|
||||
console.log(`Health: ${health.status}`);
|
||||
|
||||
const agents = await client.listAgents();
|
||||
console.log("Agents:", agents.agents.map((agent) => agent.id).join(", "));
|
||||
|
||||
process.once("SIGINT", async () => {
|
||||
await client.destroySandbox();
|
||||
process.exit(0);
|
||||
});
|
||||
27
examples/agentcomputer/tests/agentcomputer.test.ts
Normal file
27
examples/agentcomputer/tests/agentcomputer.test.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { describe, it, expect } from "vitest";
|
||||
import { SandboxAgent } from "sandbox-agent";
|
||||
import { agentcomputer } from "sandbox-agent/agentcomputer";
|
||||
|
||||
const shouldRun = Boolean(process.env.COMPUTER_API_KEY || process.env.AGENTCOMPUTER_API_KEY);
|
||||
const timeoutMs = Number.parseInt(process.env.SANDBOX_TEST_TIMEOUT_MS || "", 10) || 300_000;
|
||||
|
||||
const testFn = shouldRun ? it : it.skip;
|
||||
|
||||
describe("agentcomputer provider", () => {
|
||||
testFn(
|
||||
"starts sandbox-agent and responds to /v1/health",
|
||||
async () => {
|
||||
const sdk = await SandboxAgent.start({
|
||||
sandbox: agentcomputer(),
|
||||
});
|
||||
|
||||
try {
|
||||
const health = await sdk.getHealth();
|
||||
expect(health.status).toBe("ok");
|
||||
} finally {
|
||||
await sdk.destroySandbox();
|
||||
}
|
||||
},
|
||||
timeoutMs,
|
||||
);
|
||||
});
|
||||
17
examples/agentcomputer/tsconfig.json
Normal file
17
examples/agentcomputer/tsconfig.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"lib": ["ES2022", "DOM"],
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"resolveJsonModule": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "**/*.test.ts"]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue