Sandboxes
A sandbox is the environment where an agent reads files and runs commands. Configure one to use the built-in agent or an AI workflow step.
Configure a sandbox
Install a provider and pass its factory as sandboxes in your existing project configuration.
For local development:
bun add @sixb/sandboxes-local
import { createSixb } from "@sixb/core"
import { LocalSandboxFactory } from "@sixb/sandboxes-local"
export const sixb = createSixb({
// ...your existing providers and models
sandboxes: new LocalSandboxFactory(),
})
By default, each agent run gets a fresh environment that is removed when the run ends. Opt in to conversation continuity to retain files between runs. Files returned as agent attachments are saved separately.
Each command the agent runs has 2 minutes, and up to 10 when the agent expects a longer build or
test suite. The provider's session lifetime still applies: on Vercel, set sessionTimeoutMs to
cover your longest run, since Vercel's default session lasts 5 minutes.
Providers
Choose a provider for your environment. Each card opens the package README for installation, setup, and configuration.
Run tools on your development machine.
@sixb/sandboxes-localRun tools in containers on Apple silicon Macs.
@sixb/sandboxes-apple-containerRun tools in isolated microVMs on your own host.
@sixb/sandboxes-smolvmRun tools in managed, hosted sandboxes.
@sixb/sandboxes-vercelRun tools in Azure Container Apps sandboxes. Available in preview.
@sixb/sandboxes-azureFilesystem and network isolation depend on the provider. The local provider can run without isolation when OS sandboxing is unavailable. Check the provider's requirements and isolation behavior before using it in production.
Every provider here adds the agent's credentials where its commands can't read them: they reach
the Sixb API as the run without ever holding its token. Vercel and the local provider keep the token
outside the sandbox. smolvm, Apple Container and Azure keep it inside the VM, in a file only root
reads, while the agent's commands run as an unprivileged user. A custom provider must keep it out of
the commands' reach too, by setting supportsRequestCredentials; createSixb fails at startup
otherwise.
Configure the environment
Use a persistence-capable provider such as Vercel for conversations that keep files between runs.
A static recipe takes source and optional setup; use params and resolve for a per-thread recipe:
import { param } from "@sixb/core"
import { VercelSandboxFactory } from "@sixb/sandboxes-vercel"
import { Client } from "./ontology/client"
// Pass this factory as the sandboxes option to createSixb.
const sandboxes = new VercelSandboxFactory({
params: { clientId: param("string"), branch: param("string") },
resolve: async ({ params, sixb }) => {
const client = await sixb.objects(Client).get(params.clientId)
const repositoryUrl = client?.properties.repositoryUrl
if (typeof repositoryUrl !== "string" || !repositoryUrl.trim()) {
throw new Error("Client repository is unavailable.")
}
return {
source: { type: "git", url: repositoryUrl, revision: params.branch },
}
},
})
resolve runs with current execution permissions on every run, including resume. source accepts
credential-free HTTPS Git URLs; omit it for a source-free environment. setup commands run only
when creating a fresh sandbox. The repository and initial revision cannot change on resume.
An AI workflow step can apply a static recipe too: pass a factory as its sandbox to get a fresh
checkout on every run, destroyed when the run ends. See
Work in a repository.
For bound conversations and steps with their own sandbox, Sixb always allows what the agent
needs: the Sixb API, the source origin and the origins auth issues credentials for. Omitting
network allows only those. A restricted policy lists what the project adds, such as the
package registry setup installs from; all allows everything. none is rejected: the agent
cannot reach the Sixb API. Guest-readable env is not a safe place for credentials.
The agent's web_fetch follows the declared network
too: a restricted one limits it to the origins it lists. Without network, it reads any URL.
For direct factory use, create() applies static source/setup. An explicit environment replaces
both, including {} to skip them. Dynamic recipes require execution-resolved configuration.
Repository authentication
For private GitHub repositories, authenticate with a GitHub App:
- Create a GitHub App (Settings → Developer settings → GitHub Apps); it needs no webhook. Grant the repository permissions Contents: Read and write, Pull requests: Read and write, and Metadata: Read. Read-only access needs only Contents: Read.
- Install the App on the repository.
- Note the App ID from the App's settings page.
- Generate a private key and put its contents in an environment variable. Newlines escaped as
\nare accepted.
Then configure host-side authentication on the Vercel factory:
import { githubApp } from "@sixb/connector-github/sandbox"
import { VercelSandboxFactory } from "@sixb/sandboxes-vercel"
const factory = new VercelSandboxFactory({
source: { type: "git", url: "https://github.com/acme/app.git" },
auth: githubApp({
appId: process.env.GITHUB_APP_ID!,
privateKey: process.env.GITHUB_APP_PRIVATE_KEY!,
}),
})
Access defaults to read; set source.access: "write" to also push and use the GitHub API for that
repository, for example to open pull requests. A missing permission fails the run: the cause of
the error reported to onError names the permissions to
grant.
git push -u origin HEAD && gh pr create --fill
Write access lets the agent push to any branch of the repository and, through the API, merge pull requests or delete branches. Protect the default branch with branch protection or rulesets, for example by requiring a reviewed pull request, so that the agent's work reaches it only through review.
Public repositories can omit auth. Managed credentials are not written into guest files: use
git and GitHub API clients such as gh normally. Commits are attributed to the App's bot
account. GH_TOKEN and GITHUB_TOKEN in the sandbox hold a placeholder, because these clients
require a token; the real token never enters the sandbox.
Write access needs auth. createSixb fails at startup when a factory's static source asks
for write access without it. A source returned by resolve is checked the same way when each run
starts.
Sixb refreshes access for each run and revokes it during normal cleanup. A worker crash cannot
guarantee immediate revocation.
Keep files across conversation runs
Opt in when creating a thread:
const thread = await sixb.agent.threads.create({
title: "Improve the client portal",
sandbox: { clientId: "acme", branch: "feature/portal" },
})
Use sandbox: {} for a static recipe; omit sandbox for a fresh environment per run.
From a chat, pass the params as newThreadSandbox to AgentPanel; see
Start a conversation in a sandbox.
Parameters are immutable, validated against the factory schema, and must not contain secrets.
Thread responses expose them as sandboxParams; sandboxState describes the current sandbox.
A continued conversation keeps the parameters
and starts with a fresh sandbox.
The first run prepares the environment; subsequent runs resume files and uncommitted edits. Sixb saves before finalization. If the provider confirms saved state is lost, Sixb creates a fresh sandbox, repeats setup and tells the agent its earlier local files were not recovered. Conversation history and published attachments remain available.
Uncertain state or failed recovery blocks further runs. Use the chat recovery control or
sixb.agent.threads.recreateSandbox(thread.id, { expectedSandboxName: thread.sandboxState.name }).
Recreation does not recover edits or delete the previous environment.
Files remain subject to provider retention; workflows remain ephemeral.
On a provider that keeps files, such as Vercel, a sub-agent keeps its sandbox while it pauses, and Sixb deletes it once the sub-agent ends. The sandbox of a paused sub-agent that never continues is left to provider retention.