[{"data":1,"prerenderedAt":1360},["ShallowReactive",2],{"blog-post-ai-agent-sandbox":3,"related-posts-ai-agent-sandbox":1333,"decoder-links-ai-agent-sandbox":1356,"hero-size-ai-agent-sandbox":1357},{"id":4,"title":5,"author":6,"body":11,"bottomCta":1301,"category":1302,"date":1303,"definedTerm":1301,"description":1304,"extension":1305,"featured":1306,"hideToc":1306,"image":1307,"imageAlt":1308,"imageHeight":1309,"imageWidth":1310,"itemList":1301,"lang":1301,"lead":1301,"meta":1311,"navigation":1312,"noindex":1306,"path":1313,"primaryHub":1301,"readingTime":1314,"redirected":1306,"relatedSlugs":1315,"seo":1319,"seoTitle":1320,"stem":1321,"subtitle":1322,"tags":1323,"updatedDate":1303,"__hash__":1332},"blog/blog/ai-agent-sandbox.md","AI Agent Sandbox: What It Isolates and How to Choose One",{"name":7,"role":8,"avatar":9,"bio":10},"Shabnam Katoch","Growth Head","/img/avatars/shabnam-profile.jpeg","Shabnam leads growth at BetterClaw and has spent the past three years building organic distribution for AI-native products. She writes about no-code agent builders, content strategy, and what it actually takes to grow without an ads budget.",{"type":12,"value":13,"toc":1275},"minimark",[14,23,67,76,84,87,94,99,102,178,181,189,197,204,208,211,392,395,398,456,459,467,473,477,480,485,512,515,541,544,763,789,796,800,810,852,855,909,933,937,947,951,958,964,968,971,1032,1034,1041,1045,1048,1060,1068,1074,1078,1081,1113,1120,1128,1134,1138,1141,1158,1161,1167,1171,1179,1186,1193,1197,1200,1207,1211,1215,1218,1222,1225,1229,1232,1236,1243,1247,1250,1254,1257,1261,1264,1268,1271],[15,16,17,18,22],"p",{},"An ",[19,20,21],"strong",{},"AI agent sandbox"," is an isolated place where an agent can run code, use tools and browse without reaching your real files, credentials or production systems. It limits the damage from a bad command or a prompt injection. It does not limit what the agent can do with the accounts you connect, so you still need scoped permissions and approvals.",[24,25,26,39],"table",{},[27,28,29],"thead",{},[30,31,32,36],"tr",{},[33,34,35],"th",{},"If your agent...",[33,37,38],{},"Start with",[40,41,42,51,59],"tbody",{},[30,43,44,48],{},[45,46,47],"td",{},"Writes code on your laptop",[45,49,50],{},"Its built-in sandbox, credential files denied, a domain allowlist",[30,52,53,56],{},[45,54,55],{},"Runs code you didn't write",[45,57,58],{},"A separate kernel: gVisor, Kata or a microVM",[30,60,61,64],{},[45,62,63],{},"Sends email, edits a CRM or takes payments",[45,65,66],{},"Test accounts, then writes held for your approval",[15,68,69,70,75],{},"Checked on Claude Code 2.1.334 and Codex CLI 0.173.0. For the wider threat list, see our guide to ",[71,72,74],"a",{"href":73},"/blog/ai-agent-security-guide","AI agent security risks",".",[15,77,78,79,83],{},"Picture this: you ask an agent to clear out old build files, and it runs ",[80,81,82],"code",{},"rm -rf"," one folder too high.",[15,85,86],{},"Or a web page it reads tells it to email your customer list to a stranger.",[15,88,89,93],{},[90,91,92],"em",{},"Would a sandbox have stopped either?"," The first, yes. The second, usually not.",[95,96,98],"h2",{"id":97},"what-an-ai-agent-sandbox-isolates-five-layers","What an AI agent sandbox isolates: five layers",[15,100,101],{},"A sandbox isn't one switch. It's five controls, and each tool covers a different mix.",[24,103,104,117],{},[27,105,106],{},[30,107,108,111,114],{},[33,109,110],{},"Layer",[33,112,113],{},"What goes wrong without it",[33,115,116],{},"Typical control",[40,118,119,134,145,156,167],{},[30,120,121,124,131],{},[45,122,123],{},"Files",[45,125,126,127,130],{},"The agent reads ",[80,128,129],{},"~/.ssh"," or deletes the repo",[45,132,133],{},"Mount one working directory; deny reads on credential paths",[30,135,136,139,142],{},[45,137,138],{},"Network egress",[45,140,141],{},"It sends your data out or downloads a payload",[45,143,144],{},"A proxy with a domain allowlist, or no network",[30,146,147,150,153],{},[45,148,149],{},"Secrets",[45,151,152],{},"Keys sit in env vars or files it can print",[45,154,155],{},"Inject per task; short-lived, scoped tokens",[30,157,158,161,164],{},[45,159,160],{},"Host kernel and processes",[45,162,163],{},"A container escape, or a crypto-miner on your host",[45,165,166],{},"gVisor, Kata or a microVM instead of a shared kernel",[30,168,169,172,175],{},[45,170,171],{},"Side effects in real systems",[45,173,174],{},"Emails sent, records changed, money moved",[45,176,177],{},"Test accounts and writes held for approval (not a sandbox feature)",[15,179,180],{},"The layers lean on each other: Claude Code's docs warn that without network limits, \"a compromised agent could exfiltrate sensitive files like SSH keys.\"",[182,183,184],"blockquote",{},[15,185,186],{},[90,187,188],{},"A sandbox decides what an agent can reach. It doesn't decide what the agent does with the access you hand it.",[15,190,191,192,196],{},"The first four live where the agent runs. The fifth lives in the systems it touches, where the ",[71,193,195],{"href":194},"/blog/confused-deputy-ai-agents","confused deputy problem"," bites: an agent using your access on someone else's behalf.",[15,198,199],{},[200,201],"img",{"alt":202,"src":203},"What an AI agent sandbox isolates: files, network egress, secrets and the host kernel where the agent runs, and side effects in the systems it touches","/img/blog/ai-agent-sandbox-layers.jpg",[95,205,207],{"id":206},"ai-agent-sandbox-options-from-lightest-to-strongest","AI agent sandbox options, from lightest to strongest",[15,209,210],{},"Setup times are our estimates; claims and prices are each project's own.",[24,212,213,232],{},[27,214,215],{},[30,216,217,220,223,226,229],{},[33,218,219],{},"Option",[33,221,222],{},"What it isolates",[33,224,225],{},"Setup",[33,227,228],{},"Cost",[33,230,231],{},"Good for",[40,233,234,251,267,288,304,320,339,356,376],{},[30,235,236,239,242,245,248],{},[45,237,238],{},"Your laptop, no sandbox",[45,240,241],{},"Nothing",[45,243,244],{},"None",[45,246,247],{},"$0",[45,249,250],{},"Throwaway experiments",[30,252,253,256,259,262,264],{},[45,254,255],{},"Docker or a dev container",[45,257,258],{},"Namespaces on the shared host kernel",[45,260,261],{},"Minutes",[45,263,247],{},[45,265,266],{},"Code you trust",[30,268,269,276,279,282,285],{},[45,270,271,272,275],{},"gVisor (",[80,273,274],{},"runsc",")",[45,277,278],{},"A userspace \"application kernel\" in front of yours",[45,280,281],{},"About an hour",[45,283,284],{},"$0, open source",[45,286,287],{},"Untrusted code on Linux",[30,289,290,293,296,299,301],{},[45,291,292],{},"Kata Containers",[45,294,295],{},"A lightweight VM, with its own kernel, per workload",[45,297,298],{},"Hours",[45,300,284],{},[45,302,303],{},"Clusters that need VM isolation",[30,305,306,309,312,315,317],{},[45,307,308],{},"Firecracker",[45,310,311],{},"KVM microVMs that \"Boot in \u003C125ms\" (vendor claim)",[45,313,314],{},"Days, to build on",[45,316,284],{},[45,318,319],{},"Your own sandbox service",[30,321,322,328,331,333,336],{},[45,323,324,325,275],{},"Docker Sandboxes (",[80,326,327],{},"sbx",[45,329,330],{},"A microVM per sandbox, with its own kernel",[45,332,261],{},[45,334,335],{},"Local $0; cloud pay as you go",[45,337,338],{},"Coding agents on your machine",[30,340,341,344,347,350,353],{},[45,342,343],{},"E2B or Daytona (hosted)",[45,345,346],{},"A sandbox per session (E2B uses Firecracker)",[45,348,349],{},"Minutes, via an API",[45,351,352],{},"E2B Pro $150 a month plus per-second usage (Hobby $0, one-time $100 credit); Daytona $0.0504 per vCPU hour plus memory",[45,354,355],{},"Apps running model-written code",[30,357,358,361,368,371,373],{},[45,359,360],{},"Kubernetes agent-sandbox",[45,362,363,364,367],{},"A ",[80,365,366],{},"Sandbox"," resource; gVisor or Kata do the isolating",[45,369,370],{},"Hours, on a cluster",[45,372,284],{},[45,374,375],{},"Teams on Kubernetes",[30,377,378,381,384,387,389],{},[45,379,380],{},"A VM per agent, or a managed host",[45,382,383],{},"A whole machine per agent",[45,385,386],{},"Varies",[45,388,386],{},[45,390,391],{},"Long-running business agents",[15,393,394],{},"Checked: 2 December 2026",[15,396,397],{},"The cheapest step up from plain Docker is a runtime swap; Docker documents gVisor and Kata as alternatives to runc. With gVisor installed:",[399,400,405],"pre",{"className":401,"code":402,"language":403,"meta":404,"style":404},"language-bash shiki shiki-themes github-light","sudo runsc install\nsudo systemctl restart docker\ndocker run --runtime=runsc --rm hello-world\n","bash","",[80,406,407,423,437],{"__ignoreMap":404},[408,409,412,416,420],"span",{"class":410,"line":411},"line",1,[408,413,415],{"class":414},"s7eDp","sudo",[408,417,419],{"class":418},"sYBdl"," runsc",[408,421,422],{"class":418}," install\n",[408,424,426,428,431,434],{"class":410,"line":425},2,[408,427,415],{"class":414},[408,429,430],{"class":418}," systemctl",[408,432,433],{"class":418}," restart",[408,435,436],{"class":418}," docker\n",[408,438,440,443,446,450,453],{"class":410,"line":439},3,[408,441,442],{"class":414},"docker",[408,444,445],{"class":418}," run",[408,447,449],{"class":448},"sYu0t"," --runtime=runsc",[408,451,452],{"class":448}," --rm",[408,454,455],{"class":418}," hello-world\n",[15,457,458],{},"The catch, per gVisor's docs: \"reduced application compatibility and higher per-system call overhead.\" Docker Sandboxes is a separate product: \"The primary trust boundary is the microVM,\" and outbound traffic needs a matching policy rule.",[15,460,461,462,466],{},"Running Hermes Agent in plain Docker? Our ",[71,463,465],{"href":464},"/blog/hermes-agent-docker-install","Hermes Agent Docker guide"," covers that setup.",[15,468,469],{},[200,470],{"alt":471,"src":472},"AI agent sandbox options from lightest to strongest: laptop, Docker, gVisor, Kata, Docker Sandboxes, Firecracker and a VM per agent","/img/blog/ai-agent-sandbox-options.jpg",[95,474,476],{"id":475},"coding-agents-have-built-in-sandboxes","Coding agents have built-in sandboxes",[15,478,479],{},"Most sandbox searches are about coding agents. The two biggest ship their own: Codex starts sandboxed, Claude Code doesn't.",[481,482,484],"h3",{"id":483},"claude-code-off-until-you-turn-it-on","Claude Code: off until you turn it on",[15,486,487,488,491,492,495,496,499,500,503,504,507,508,511],{},"Run ",[80,489,490],{},"/sandbox"," in a session, or set ",[80,493,494],{},"sandbox.enabled"," to ",[80,497,498],{},"true"," in ",[80,501,502],{},"~/.claude/settings.json",". It uses Seatbelt on macOS and ",[80,505,506],{},"bubblewrap"," plus ",[80,509,510],{},"socat"," on Linux and WSL2; on native Windows, \"Claude Code runs commands unsandboxed.\"",[15,513,514],{},"Know its edges:",[516,517,518,522,532,535],"ul",{},[519,520,521],"li",{},"It wraps shell commands only: \"Claude's file tools, MCP servers, and hooks run outside it.\"",[519,523,524,525,527,528,531],{},"Reads cover \"most of the machine, including credential files such as ",[80,526,129],{}," and ",[80,529,530],{},"~/.aws/credentials",",\" and \"There is no built-in credential deny list.\"",[519,533,534],{},"Network goes through a local proxy, and your allowed domains \"start empty.\"",[519,536,537,538,75],{},"If the sandbox can't start, commands run unsandboxed unless you set ",[80,539,540],{},"failIfUnavailable",[15,542,543],{},"A tighter user-level setup:",[399,545,549],{"className":546,"code":547,"language":548,"meta":404,"style":404},"language-json shiki shiki-themes github-light","{\n  \"sandbox\": {\n    \"enabled\": true,\n    \"failIfUnavailable\": true,\n    \"allowUnsandboxedCommands\": false,\n    \"network\": {\n      \"allowedDomains\": [\"registry.npmjs.org\"],\n      \"strictAllowlist\": true\n    },\n    \"credentials\": {\n      \"files\": [\n        { \"path\": \"~/.ssh\", \"mode\": \"deny\" },\n        { \"path\": \"~/.aws/credentials\", \"mode\": \"deny\" }\n      ],\n      \"envVars\": [{ \"name\": \"GITHUB_TOKEN\", \"mode\": \"deny\" }]\n    }\n  }\n}\n","json",[80,550,551,557,565,578,590,603,611,626,637,643,651,660,688,711,717,745,751,757],{"__ignoreMap":404},[408,552,553],{"class":410,"line":411},[408,554,556],{"class":555},"sgsFI","{\n",[408,558,559,562],{"class":410,"line":425},[408,560,561],{"class":448},"  \"sandbox\"",[408,563,564],{"class":555},": {\n",[408,566,567,570,573,575],{"class":410,"line":439},[408,568,569],{"class":448},"    \"enabled\"",[408,571,572],{"class":555},": ",[408,574,498],{"class":448},[408,576,577],{"class":555},",\n",[408,579,581,584,586,588],{"class":410,"line":580},4,[408,582,583],{"class":448},"    \"failIfUnavailable\"",[408,585,572],{"class":555},[408,587,498],{"class":448},[408,589,577],{"class":555},[408,591,593,596,598,601],{"class":410,"line":592},5,[408,594,595],{"class":448},"    \"allowUnsandboxedCommands\"",[408,597,572],{"class":555},[408,599,600],{"class":448},"false",[408,602,577],{"class":555},[408,604,606,609],{"class":410,"line":605},6,[408,607,608],{"class":448},"    \"network\"",[408,610,564],{"class":555},[408,612,614,617,620,623],{"class":410,"line":613},7,[408,615,616],{"class":448},"      \"allowedDomains\"",[408,618,619],{"class":555},": [",[408,621,622],{"class":418},"\"registry.npmjs.org\"",[408,624,625],{"class":555},"],\n",[408,627,629,632,634],{"class":410,"line":628},8,[408,630,631],{"class":448},"      \"strictAllowlist\"",[408,633,572],{"class":555},[408,635,636],{"class":448},"true\n",[408,638,640],{"class":410,"line":639},9,[408,641,642],{"class":555},"    },\n",[408,644,646,649],{"class":410,"line":645},10,[408,647,648],{"class":448},"    \"credentials\"",[408,650,564],{"class":555},[408,652,654,657],{"class":410,"line":653},11,[408,655,656],{"class":448},"      \"files\"",[408,658,659],{"class":555},": [\n",[408,661,663,666,669,671,674,677,680,682,685],{"class":410,"line":662},12,[408,664,665],{"class":555},"        { ",[408,667,668],{"class":448},"\"path\"",[408,670,572],{"class":555},[408,672,673],{"class":418},"\"~/.ssh\"",[408,675,676],{"class":555},", ",[408,678,679],{"class":448},"\"mode\"",[408,681,572],{"class":555},[408,683,684],{"class":418},"\"deny\"",[408,686,687],{"class":555}," },\n",[408,689,691,693,695,697,700,702,704,706,708],{"class":410,"line":690},13,[408,692,665],{"class":555},[408,694,668],{"class":448},[408,696,572],{"class":555},[408,698,699],{"class":418},"\"~/.aws/credentials\"",[408,701,676],{"class":555},[408,703,679],{"class":448},[408,705,572],{"class":555},[408,707,684],{"class":418},[408,709,710],{"class":555}," }\n",[408,712,714],{"class":410,"line":713},14,[408,715,716],{"class":555},"      ],\n",[408,718,720,723,726,729,731,734,736,738,740,742],{"class":410,"line":719},15,[408,721,722],{"class":448},"      \"envVars\"",[408,724,725],{"class":555},": [{ ",[408,727,728],{"class":448},"\"name\"",[408,730,572],{"class":555},[408,732,733],{"class":418},"\"GITHUB_TOKEN\"",[408,735,676],{"class":555},[408,737,679],{"class":448},[408,739,572],{"class":555},[408,741,684],{"class":418},[408,743,744],{"class":555}," }]\n",[408,746,748],{"class":410,"line":747},16,[408,749,750],{"class":555},"    }\n",[408,752,754],{"class":410,"line":753},17,[408,755,756],{"class":555},"  }\n",[408,758,760],{"class":410,"line":759},18,[408,761,762],{"class":555},"}\n",[15,764,765,768,769,772,773,776,777,780,781,784,785,788],{},[80,766,767],{},"allowUnsandboxedCommands: false"," blocks retries outside the sandbox, ",[80,770,771],{},"strictAllowlist"," refuses unlisted hosts, and ",[80,774,775],{},"filesystem.denyRead"," covers other paths. Keep ",[80,778,779],{},"excludedCommands"," empty: those commands skip the sandbox. Test it by asking Claude, not the ",[80,782,783],{},"!"," prompt, to run ",[80,786,787],{},"touch ~/sandbox-probe","; it should fail.",[15,790,791,792,795],{},"To cover file tools and MCP servers too, run the whole process in Anthropic's sandbox runtime (",[80,793,794],{},"srt claude",", a beta), a dev container or a VM.",[481,797,799],{"id":798},"codex-sandboxed-by-default","Codex: sandboxed by default",[15,801,802,803,507,806,809],{},"The Codex CLI starts with network off and writes limited to the workspace, enforced by Seatbelt on macOS, ",[80,804,805],{},"bwrap",[80,807,808],{},"seccomp"," on Linux and MXC on Windows:",[399,811,813],{"className":401,"code":812,"language":403,"meta":404,"style":404},"codex --sandbox read-only --ask-for-approval on-request        # read, don't write\ncodex --sandbox workspace-write --ask-for-approval on-request  # the \"Auto\" preset\n",[80,814,815,836],{"__ignoreMap":404},[408,816,817,820,823,826,829,832],{"class":410,"line":411},[408,818,819],{"class":414},"codex",[408,821,822],{"class":448}," --sandbox",[408,824,825],{"class":418}," read-only",[408,827,828],{"class":448}," --ask-for-approval",[408,830,831],{"class":418}," on-request",[408,833,835],{"class":834},"sAwPA","        # read, don't write\n",[408,837,838,840,842,845,847,849],{"class":410,"line":425},[408,839,819],{"class":414},[408,841,822],{"class":448},[408,843,844],{"class":418}," workspace-write",[408,846,828],{"class":448},[408,848,831],{"class":418},[408,850,851],{"class":834},"  # the \"Auto\" preset\n",[15,853,854],{},"Current values (older guides still show retired ones):",[516,856,857,873,890,903],{},[519,858,859,862,863,676,866,869,870,75],{},[80,860,861],{},"--sandbox"," takes ",[80,864,865],{},"read-only",[80,867,868],{},"workspace-write"," or ",[80,871,872],{},"danger-full-access",[519,874,875,878,879,869,882,885,886,889],{},[80,876,877],{},"--ask-for-approval"," takes only ",[80,880,881],{},"on-request",[80,883,884],{},"never",". ",[80,887,888],{},"untrusted"," is retired, and an old config with it \"can prevent either client from starting.\"",[519,891,892,895,896,899,900,902],{},[80,893,894],{},"--full-auto"," is in neither the CLI reference nor the 0.173.0 flag code. ",[80,897,898],{},"--approve-for-me"," pairs ",[80,901,868],{}," with a reviewer agent that vets approval requests.",[519,904,905,908],{},[80,906,907],{},"--yolo"," drops the sandbox and approvals: \"Only use inside an externally hardened environment.\"",[15,910,911,912,915,916,919,920,923,924,927,928,932],{},"Network stays off unless you set ",[80,913,914],{},"network_access = true","; then add ",[80,917,918],{},"features.network_proxy"," with domain rules, or outbound access is unrestricted. ",[80,921,922],{},"codex sandbox linux"," (or ",[80,925,926],{},"macos",") shows what the sandbox blocks, and our ",[71,929,931],{"href":930},"/tools/agent-error-decoder/chatgpt-patch-rejected-read-only-sandbox","read-only sandbox error decoder"," covers \"patch rejected: writing is blocked by read-only sandbox\".",[481,934,936],{"id":935},"gemini-cli","Gemini CLI",[15,938,939,940,869,943,946],{},"Turn it on with ",[80,941,942],{},"-s",[80,944,945],{},"GEMINI_SANDBOX","; it can use Seatbelt, Docker or Podman, gVisor, LXC or a Windows sandbox, and its default macOS profile still allows network access.",[481,948,950],{"id":949},"any-agent-a-worktree-and-a-diff","Any agent: a worktree and a diff",[15,952,953,954,957],{},"Give the agent a disposable git worktree and read the diff before merging. Claude Code makes one with ",[80,955,956],{},"claude --worktree \u003Cname>","; Codex's docs say to treat its changes \"like any other PR.\"",[15,959,960],{},[200,961],{"alt":962,"src":963},"Claude Code and Codex CLI sandboxes side by side: default state, what each wraps, network defaults and the current flags","/img/blog/ai-agent-sandbox-coding-agents.jpg",[95,965,967],{"id":966},"business-agents-need-a-different-kind-of-sandbox","Business agents need a different kind of sandbox",[15,969,970],{},"An email, CRM or payments agent can sit in the tightest microVM and still email the wrong customer. The risk lives in the other system, so test against a fake copy.",[24,972,973,986],{},[27,974,975],{},[30,976,977,980,983],{},[33,978,979],{},"System",[33,981,982],{},"Test version",[33,984,985],{},"What you get",[40,987,988,999,1010,1021],{},[30,989,990,993,996],{},[45,991,992],{},"Gmail or Google Workspace",[45,994,995],{},"A separate Google account as a test inbox",[45,997,998],{},"Real mail, no real customers (we found no Gmail sandbox)",[30,1000,1001,1004,1007],{},[45,1002,1003],{},"HubSpot",[45,1005,1006],{},"Developer test accounts",[45,1008,1009],{},"Up to 10 at $0, \"without affecting any real HubSpot data\"",[30,1011,1012,1015,1018],{},[45,1013,1014],{},"Stripe",[45,1016,1017],{},"A sandbox",[45,1019,1020],{},"Payments that \"aren't processed by card networks or payment providers\"",[30,1022,1023,1026,1029],{},[45,1024,1025],{},"Anything that sends, deletes or pays",[45,1027,1028],{},"Reads allowed, writes held",[45,1030,1031],{},"Approval before the write runs",[15,1033,394],{},[15,1035,1036,1037,1040],{},"HubSpot test accounts only send marketing email to users you've added, and standard sandboxes need Enterprise. Stripe's CLI makes an anonymous sandbox with working API keys (",[80,1038,1039],{},"stripe sandbox create","), no account needed.",[95,1042,1044],{"id":1043},"test-in-three-stages-before-real-data","Test in three stages before real data",[15,1046,1047],{},"Test two things separately: can the agent do the job, and what happens when it does? Stage one answers the first safely.",[1049,1050,1051,1054,1057],"ol",{},[519,1052,1053],{},"Replay past tasks against test accounts, with every write logged instead of sent.",[519,1055,1056],{},"Point it at real data with every send, update and payment held for approval.",[519,1058,1059],{},"Give it a small slice of real traffic, with logs on and a kill switch you've tried.",[15,1061,1062,1063,1067],{},"Widen only when stage three stays boring. Our guide on ",[71,1064,1066],{"href":1065},"/blog/how-to-test-an-ai-agent","how to test an AI agent"," covers the full method.",[15,1069,1070],{},[200,1071],{"alt":1072,"src":1073},"Business agent testing: a test inbox, HubSpot test account and Stripe sandbox, then three stages from replayed tasks to a small slice of real traffic","/img/blog/ai-agent-sandbox-test-stages.jpg",[95,1075,1077],{"id":1076},"what-an-ai-agent-sandbox-wont-protect-you-from","What an AI agent sandbox won't protect you from",[15,1079,1080],{},"These go straight through the box:",[516,1082,1083,1089,1095,1101,1107],{},[519,1084,1085,1088],{},[19,1086,1087],{},"The confused deputy."," Your Gmail or CRM access, used for someone else because a message or web page asked.",[519,1090,1091,1094],{},[19,1092,1093],{},"Broad OAuth scopes and keys."," If the connection can delete mail, a sandboxed agent can delete mail.",[519,1096,1097,1100],{},[19,1098,1099],{},"Approvals typed in the same chat."," If the person asking can reply \"approved\" there, the approval proves little.",[519,1102,1103,1106],{},[19,1104,1105],{},"Tools outside the box."," Claude Code's file tools and MCP servers run outside its sandbox, and Codex's network proxy \"does not filter web search, app or connector tool calls, MCP server connections.\"",[519,1108,1109,1112],{},[19,1110,1111],{},"Access passed in on purpose."," Docker Sandboxes forwards your SSH agent by default, so \"any process inside the sandbox can ask the forwarded agent to authenticate or sign data.\"",[182,1114,1115],{},[15,1116,1117],{},[90,1118,1119],{},"Anthropic's guide to sandbox environments: \"Any approach that allows network egress can still leak data the agent can read.\"",[15,1121,1122,1123,1127],{},"Self-hosting OpenClaw? Our ",[71,1124,1126],{"href":1125},"/blog/openclaw-security-checklist","OpenClaw security checklist"," covers the host side.",[15,1129,1130],{},[200,1131],{"alt":1132,"src":1133},"What an AI agent sandbox won't stop: a contained command inside the box, while connected accounts, allowed domains and in-chat approvals pass straight through","/img/blog/ai-agent-sandbox-limits.jpg",[95,1135,1137],{"id":1136},"how-betterclaw-isolates-agents","How BetterClaw isolates agents",[15,1139,1140],{},"Here's our own setup, gaps included:",[516,1142,1143,1146,1149,1152,1155],{},[519,1144,1145],{},"Each BetterClaw agent runs on its own machine (a Fly.io Machine) with its own storage bucket and a storage key scoped to that bucket, no public IP and no inbound ports; it dials out to BetterClaw.",[519,1147,1148],{},"Agents have open outbound internet access (they need it for browsing and APIs); there's no per-agent outbound allowlist today.",[519,1150,1151],{},"Agents in the same Project share that Project's computer and files; separate Projects are sealed from each other.",[519,1153,1154],{},"Connector and MCP credentials stay with BetterClaw; the agent calls the tools, it never sees those credentials. Workspace secrets an agent fetches with a secret tool are returned to it so it can use them.",[519,1156,1157],{},"In a workflow, any step can be set to ask you first before it runs.",[15,1159,1160],{},"For side effects, the control is yours to add: a workflow step that asks first sends nothing until someone decides, and an unanswered request expires after 24 hours. If you need an egress allowlist, we don't offer one today.",[15,1162,1163],{},[200,1164],{"alt":1165,"src":1166},"How BetterClaw isolates agents: a machine and storage bucket per agent, a shared Project computer for teammates, no inbound ports and open outbound internet","/img/blog/ai-agent-sandbox-betterclaw.jpg",[95,1168,1170],{"id":1169},"ai-agent-sandbox-checklist-copyable","AI agent sandbox checklist (copyable)",[399,1172,1177],{"className":1173,"code":1175,"language":1176,"meta":404},[1174],"language-text","[ ] Working directory only; nothing else writable\n[ ] Credential paths (~/.ssh, ~/.aws) denied for reads\n[ ] Network through an allowlist, or off\n[ ] Secrets injected per task: scoped and short-lived\n[ ] Separate kernel (gVisor, Kata, microVM) for untrusted code\n[ ] Test accounts for email, CRM and payments\n[ ] Writes held for approval\n[ ] Disposable worktree, diff reviewed before merge\n[ ] Logs kept for every tool call\n[ ] A kill switch you have actually tried\n","text",[80,1178,1175],{"__ignoreMap":404},[15,1180,1181,1182,75],{},"If an OpenClaw container breaks after you tighten it, start with our ",[71,1183,1185],{"href":1184},"/blog/openclaw-docker-troubleshooting","OpenClaw Docker troubleshooting guide",[182,1187,1188],{},[15,1189,1190],{},[90,1191,1192],{},"The sandbox is for the command you didn't see coming. The approval step is for the email you did.",[95,1194,1196],{"id":1195},"let-betterclaw-run-the-machine","Let BetterClaw run the machine",[15,1198,1199],{},"Rather not build this stack? BetterClaw runs each agent on its own machine with no inbound ports (teammates in a Project share one), and any workflow step can ask before it acts. Outbound stays open, so keep the checklist's approvals.",[15,1201,1202,1203],{},"Plans start at $19 a month, BYOK with zero markup on LLM inference. Your first workspace gets a 7-day trial: BetterClaw charges your card $5 to verify it, refunds it right away and bills the plan when the trial ends unless you cancel. ",[71,1204,1206],{"href":1205},"/pricing","Start a 7-day trial · BYOK",[95,1208,1210],{"id":1209},"frequently-asked-questions","Frequently Asked Questions",[481,1212,1214],{"id":1213},"what-is-an-ai-agent-sandbox","What is an AI agent sandbox?",[15,1216,1217],{},"An isolated environment where an agent runs code, uses tools and browses without reaching your real files, credentials or production systems. It limits damage from bad commands and prompt injection, not misuse of accounts you connect.",[481,1219,1221],{"id":1220},"how-do-you-properly-sandbox-an-ai-agent","How do you properly sandbox an AI agent?",[15,1223,1224],{},"Cover five layers: files limited to a working directory, network through an allowlist, scoped secrets per task, a separate kernel for untrusted code, and writes held for approval. Then test in stages before real data.",[481,1226,1228],{"id":1227},"do-i-need-a-sandbox-for-an-ai-agent","Do I need a sandbox for an AI agent?",[15,1230,1231],{},"If it runs code, installs packages or browses, yes. If it only handles email or CRM records, test accounts and approval steps matter more, because the risk sits in those systems.",[481,1233,1235],{"id":1234},"is-docker-enough-to-sandbox-an-ai-agent","Is Docker enough to sandbox an AI agent?",[15,1237,1238,1239,1242],{},"For code you trust, usually. A container shares the host kernel, so a kernel or runtime bug can become an escape. For untrusted or model-written code, add gVisor (",[80,1240,1241],{},"docker run --runtime=runsc","), Kata or a microVM.",[481,1244,1246],{"id":1245},"how-do-i-sandbox-claude-code","How do I sandbox Claude Code?",[15,1248,1249],{},"Run /sandbox or set sandbox.enabled to true in ~/.claude/settings.json. It wraps shell commands only, and by default commands can still read ~/.ssh, so deny credential files under sandbox.credentials and set failIfUnavailable.",[481,1251,1253],{"id":1252},"can-an-ai-agent-break-out-of-a-sandbox","Can an AI agent break out of a sandbox?",[15,1255,1256],{},"Yes, through real bugs: in November 2025 runc, Docker's default runtime, fixed three flaws that could lead to a container escape (CVE-2025-31133, CVE-2025-52565, CVE-2025-52881). A separate kernel lowers that risk; the bigger leak is access you hand the agent.",[481,1258,1260],{"id":1259},"can-a-sandboxed-agent-still-leak-data","Can a sandboxed agent still leak data?",[15,1262,1263],{},"Yes. Anything it can read can leave through an allowed domain; Claude Code's docs warn that broad entries such as github.com can create paths for exfiltration. It can also email or post what it read through connected accounts.",[481,1265,1267],{"id":1266},"whats-the-difference-between-a-sandbox-and-a-staging-environment","What's the difference between a sandbox and a staging environment?",[15,1269,1270],{},"A sandbox is where the agent runs: its files, network and kernel. Staging is the systems it acts on, like a test inbox or a Stripe sandbox. A perfect sandbox still sends real email if it's wired to your real inbox.",[1272,1273,1274],"style",{},"html pre.shiki code .s7eDp, html code.shiki .s7eDp{--shiki-default:#6F42C1}html pre.shiki code .sYBdl, html code.shiki .sYBdl{--shiki-default:#032F62}html pre.shiki code .sYu0t, html code.shiki .sYu0t{--shiki-default:#005CC5}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .sgsFI, html code.shiki .sgsFI{--shiki-default:#24292E}html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}",{"title":404,"searchDepth":425,"depth":425,"links":1276},[1277,1278,1279,1285,1286,1287,1288,1289,1290,1291],{"id":97,"depth":425,"text":98},{"id":206,"depth":425,"text":207},{"id":475,"depth":425,"text":476,"children":1280},[1281,1282,1283,1284],{"id":483,"depth":439,"text":484},{"id":798,"depth":439,"text":799},{"id":935,"depth":439,"text":936},{"id":949,"depth":439,"text":950},{"id":966,"depth":425,"text":967},{"id":1043,"depth":425,"text":1044},{"id":1076,"depth":425,"text":1077},{"id":1136,"depth":425,"text":1137},{"id":1169,"depth":425,"text":1170},{"id":1195,"depth":425,"text":1196},{"id":1209,"depth":425,"text":1210,"children":1292},[1293,1294,1295,1296,1297,1298,1299,1300],{"id":1213,"depth":439,"text":1214},{"id":1220,"depth":439,"text":1221},{"id":1227,"depth":439,"text":1228},{"id":1234,"depth":439,"text":1235},{"id":1245,"depth":439,"text":1246},{"id":1252,"depth":439,"text":1253},{"id":1259,"depth":439,"text":1260},{"id":1266,"depth":439,"text":1267},null,"Security","2026-12-03","What an AI agent sandbox isolates (files, network, secrets, writes), Docker vs gVisor vs microVMs, and a staged test before an agent touches real data.","md",false,"/img/blog/ai-agent-sandbox.jpg","AI agent sandbox: the four layers it isolates where the agent runs, and the connected accounts no sandbox covers",512,1024,{},true,"/blog/ai-agent-sandbox","10 min read",[1316,1317,1318],"confused-deputy-ai-agents","how-to-test-an-ai-agent","openclaw-security-checklist",{"title":5,"description":1304},"AI Agent Sandbox: What It Is and How to Set One Up","blog/ai-agent-sandbox","Five layers, the options from Docker to microVMs, the exact Claude Code and Codex switches, and the part no sandbox covers.",[1324,1325,1326,1327,1328,1329,1330,1331],"ai agent sandbox","agent sandbox","sandbox for ai agents","how to sandbox ai coding agent","claude code sandbox","codex sandbox","ai agent isolation","docker sandbox ai agent","ZFpwDXlu08X5WI3aqAicIrYZyPAx7DFMUd6QXHcEEcg",[1334,1341,1348],{"stem":1335,"title":1336,"description":1337,"date":1303,"image":1338,"category":1302,"redirected":1306,"author":1339,"readingTime":1340},"blog/confused-deputy-ai-agents","The Confused Deputy Problem in AI Agents (and How to Stop It)","Confused deputy attacks explained: how a trusted AI agent is tricked into misusing its own access, from chat approvals to MCP OAuth, and fixes that hold.","/img/blog/confused-deputy-ai-agents.jpg",{"name":7,"role":8,"avatar":9,"bio":10},"9 min read",{"stem":1342,"title":1343,"description":1344,"date":1303,"image":1345,"category":1346,"redirected":1306,"author":1347,"readingTime":1340},"blog/how-to-test-an-ai-agent","How to Test an AI Agent (Before It Touches Real Data)","Test an AI agent in 3 stages: replay past tasks, run with writes held, then a small live slice. Outcome checks, repeat runs, chatbot tests, a checklist.","/img/blog/how-to-test-an-ai-agent.jpg","Guides",{"name":7,"role":8,"avatar":9,"bio":10},{"stem":1349,"title":1350,"description":1351,"date":1352,"image":1353,"category":1302,"redirected":1306,"author":1354,"readingTime":1355},"blog/openclaw-security-checklist","OpenClaw Security Checklist: 10 Things Most Users Skip (And Attackers Don't)","Is OpenClaw safe on your computer? Only once it is hardened: 30,000+ gateways were found exposed. 10 exact commands to lock down ports, keys and skills.","2026-03-12","/img/blog/openclaw-security-checklist.jpg",{"name":7,"role":8,"avatar":9,"bio":10},"14 min read",[],{"width":1358,"height":1359},1536,768,1796294314296]