Create a backend factory that reuses an existing VFS Sandbox.
createVfsSandboxFactoryFromSandbox(sandbox: VfsSandbox): BackendFactory| Name | Type | Description |
|---|---|---|
sandbox* | VfsSandbox | An existing VfsSandbox instance (must be initialized) |
const sandbox = await VfsSandbox.create();
const agent = createDeepAgent({
model: new ChatAnthropic({ model: "claude-sonnet-4-20250514" }),
systemPrompt: "You are a coding assistant.",
middlewares: [
createFilesystemMiddleware({
backend: createVfsSandboxFactoryFromSandbox(sandbox),
}),
],
});