Set up sandboxes with an AI agent
A runbook an AI agent follows to set up OpenShell sandboxes, run one agent in a sandbox and report what it saw, with the hard rules it must keep.
Hand this page to your agent
Paste this into your agent:
Read https://cisco-ai-defense.github.io/defenseclaw/docs/sandboxes/for-agents/llms.md and follow it. Ask me before unblocking anything.You are an AI agent. Set up OpenShell sandboxes for the user, run one agent in a sandbox and explain what you see. Sandboxes run on Linux and Apple-silicon Macs only.
Hard rules
- Observe first. Never unblock a site, switch to action mode, change a fail mode, disable a connector or edit
config.yamlby hand without the user's yes to that exact change. - Never print a key or token. Do not pass the user's secrets into a sandbox.
- Stop on a managed computer: exit code
3, or"deployment_mode": "managed_enterprise"indefenseclaw status --json(Managed command availability). - Do not delete or undo a sandbox's work without the user's yes.
Steps
-
Check the platform.
uname -smExpected:
Linux x86_64,Linux aarch64orDarwin arm64. If it differs (Windows, or an Intel Mac): stop. Sandboxes are unsupported there. -
Set up. This installs or checks Docker, OpenShell and the harness images and can take several minutes. Tell the user before you start.
defenseclaw sandbox setupExpected: a list of checks ending without errors. If a step fails, read its message and go to Sandbox troubleshooting. Do not retry in a loop.
-
Check readiness.
defenseclaw sandbox doctorExpected: a list of
✓rows ending with✓ ready for sandboxes. If it differs: report each row without✓and its message (a Host Git row needs git 2.29 or newer; tell the user, do not install it yourself). Repeat step 3 after each fix the user approves, until the last line saysready for sandboxes. -
Start the agent in a sandbox, in the project folder the user names.
sandbox rungives the agent your terminal, and your shell has none, so either ask the user to rundefenseclaw sandbox run claudein their own terminal, or run one task in the background:defenseclaw sandbox run claude --prompt "<the task the user gave>" --detach defenseclaw sandbox logs -f <name>Expected: a banner that names the sandbox, the project folder and the policy. A detached run returns after the banner; its
Asksrow names the sandbox (defenseclaw sandbox approvals --watch --sandbox <name>). If it says`sandbox run` attaches Claude Code to your terminal, and there is none, you left out--prompt. If it saysYour organization doesn't allow sandboxes for your account., stop: the administrator's policy forbids it, and nothing was installed. If the command is refused for another reason, quote the message. -
Read a block. In a second terminal, list what the sandbox allowed and refused.
defenseclaw sandbox activity --sandbox <name>Expected: timestamped lines; a refused site looks like
✗ pastebin.com (paste site) → unblock: defenseclaw sandbox unblock pastebin.com --sandbox <name>. If it differs: quote the lines you see. Do not run the unblock command. Ask the user: "Allow<destination>once, for good, or keep it blocked?" Then run only what they choose (Unblock a destination). -
At the end of the session, list sandboxes.
defenseclaw sandbox listExpected: the session with its phase. If the user wants to keep or drop the work, see End of session. Do not choose for them.
Report
Reply with:
- Platform and the last line of
sandbox doctor. - The command you ran in the sandbox and the project folder.
- Every block: what, why, and the user's decision.
- What the user must still decide (keep, undo or pull the work).
Sandbox troubleshooting
Fix OpenShell sandbox problems on Linux and macOS, from setup and the OpenShell gateway to runs, MicroVM disks and telemetry, starting with sandbox doctor.
How Agent Substrate works
Learn where DefenseClaw runs in an Agent Substrate cluster, how it checks tool calls, model calls and web requests, and how identity and policy fit.