@sandagent/sdk — Run Claude in a Sandbox with Vercel AI SDK Streams
I’m sharing @sandagent/sdk, a TypeScript/JavaScript SDK for running Claude agents in a sandboxed environment (local or cloud) that exposes Vercel AI SDK-compatible streaming.
Key Features
- Run AI agents in a controlled sandbox without exposing API keys
- Stream messages using Vercel AI SDK protocol
- Optional React chat hooks for building UI
- Expose the sandboxed agent as an SDK-compatible model
npm: https://www.npmjs.com/package/@sandagent/sdk
Example Usage
This example demonstrates how to create a sandboxed session and stream messages in a way compatible with the Vercel AI SDK. The React chat hooks can be used to integrate real-time UI components seamlessly.
ts
import { SandAgentClient } from "@sandagent/sdk";
const client = new SandAgentClient({ apiKey: process.env.SANDAGENT_API_KEY });
// Create a sandboxed agent session
const session = await client.createSession("example-session", {
model: "claude-2",
});
// Stream messages
const stream = client.streamMessages(session.id, { prompt: "Hello!" });
for await (const chunk of stream) {
console.log(chunk);
}
Top comments (0)