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 Claude Agent SDK is Anthropic’s framework for building agents with tool-use loops. Expose sandbox.commands.run as an in-process MCP tool so every command the agent generates runs in an isolated VM instead of on your machine.

Setup

npm install @superserve/sdk @anthropic-ai/claude-agent-sdk 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 Claude Agent SDK usage.
import { query, tool, createSdkMcpServer } from "@anthropic-ai/claude-agent-sdk"
import { Sandbox } from "@superserve/sdk"
import { z } from "zod"

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

const bash = tool(
  "bash",
  "Run a shell command in the sandbox.",
  { command: z.string() },
  async ({ command }) => {
    const result = await sandbox.commands.run(command, { timeoutMs: 60_000 })
    return {
      content: [
        { type: "text", text: `${result.stdout}\n${result.stderr}` },
      ],
    }
  },
)

const superserve = createSdkMcpServer({
  name: "superserve",
  version: "1.0.0",
  tools: [bash],
})

for await (const message of query({
  prompt: "List the files in /tmp and tell me how many there are.",
  options: {
    mcpServers: { superserve },
    allowedTools: ["mcp__superserve__bash"],
  },
})) {
  if (message.type === "result" && message.subtype === "success") {
    console.log(message.result)
  }
}

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