AgentOS import migration
Move from the deprecated agentos() import to the AgentOS-backed Local provider.
AgentOS now powers the Local provider under the hood. It is no longer a separate provider choice.
The old import remains as a compatibility alias and creates a sandbox whose provider is local.
New code should import local() directly:
- import { agentos } from "@opencoredev/sandbox-sdk/agentos";
+ import { local } from "@opencoredev/sandbox-sdk/local";
- await using sandbox = await createSandbox({ provider: agentos() });
+ await using sandbox = await createSandbox({ provider: local() });Native options still live under the same agentOs key, and sandbox.raw.vm still exposes the
current AgentOs instance. No behavioral migration is required beyond the import and factory name.
Run an AI SDK agent
Use the Local provider for new AI SDK agents; the deprecated agentos() alias resolves to the same runtime.
This provider works with AI SDK ToolLoopAgent through the normalized sandbox session. Pass the language model from your existing AI SDK provider or AI Gateway setup.
import { ToolLoopAgent, type LanguageModel } from "ai";import { createSandbox } from "@opencoredev/sandbox-sdk";import { createSandboxToolApproval, createSandboxTools, toAISandboxSession,} from "@opencoredev/sandbox-sdk/ai";import { local } from "@opencoredev/sandbox-sdk/local";export async function runSandboxAgent(model: LanguageModel) { await using sandbox = await createSandbox({ provider: local(), }); const aiSandbox = toAISandboxSession(sandbox); const agent = new ToolLoopAgent({ model, instructions: `Work only in the provided sandbox.\n\n${aiSandbox.description}`, tools: createSandboxTools(), toolApproval: createSandboxToolApproval(), }); return await agent.generate({ prompt: "Inspect the repository, run its tests, and summarize the result.", experimental_sandbox: aiSandbox, });}See the AI SDK guide for approval flows, direct session access, and HarnessAgent alternatives.
Continue with the Local provider guide for security defaults, deployment guidance, ports and snapshots.