Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.superserve.ai/llms.txt

Use this file to discover all available pages before exploring further.

The OpenAI Agents SDK is OpenAI’s framework for building agents with tool-use loops. Expose sandbox.commands.run as a function tool so every command the agent generates runs in an isolated VM instead of on your machine.

Setup

npm install @superserve/sdk @openai/agents zod
export SUPERSERVE_API_KEY=ss_live_...

Wire the sandbox into the agent

The highlighted block defines a bash tool backed by the sandbox. Everything else is standard OpenAI Agents SDK usage.
import { Agent, run, tool } from "@openai/agents"
import { Sandbox } from "@superserve/sdk"
import { z } from "zod"

const sandbox = await Sandbox.create({ name: "agent-runtime" })

const bash = tool({
  name: "bash",
  description: "Run a shell command in the sandbox.",
  parameters: z.object({ command: z.string() }),
  execute: async ({ command }) => {
    const result = await sandbox.commands.run(command, { timeoutMs: 60_000 })
    return `${result.stdout}\n${result.stderr}`
  },
})

const agent = new Agent({
  name: "Workspace Assistant",
  instructions: "Use the bash tool to inspect the sandbox before answering.",
  tools: [bash],
})

const result = await run(
  agent,
  "List the files in /tmp and tell me how many there are.",
)
console.log(result.finalOutput)

await sandbox.kill()
Add equivalent tools for file reads/writes the same way; see Run commands and Read & write files.