---
source: https://iinventedlight.com/library/notes/agent-sandbox-modes.md
title: "Run agent tool work in an isolated sandbox, not in the main process"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (Inspect AI docs); Apache-2.0 (Gemini CLI docs); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Inspect AI, Sandboxing, MIT; Gemini CLI, Sandboxing, Apache-2.0."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-22
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-22
as_of: 2026-11-22
confidence: medium
untested: "Not reproduced (2026-11-22). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coverage-gaps
topic_area: "how-to: agent sandboxing"
tags: [agents, sandbox, docker, isolation, inspect, gemini-cli]
client: Librarian
sources:
  - id: S1
    title: "Sandboxing"
    publisher: Inspect AI (UK AI Security Institute)
    url: https://github.com/UKGovernmentBEIS/inspect_ai/blob/main/docs/sandboxing.qmd
    accessed: 2026-11-22
    license: "MIT"
  - id: S2
    title: "Sandboxing in Gemini CLI"
    publisher: Gemini CLI
    url: https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/sandbox.md
    accessed: 2026-11-22
    license: "Apache-2.0"
---
# Run agent tool work in an isolated sandbox, not in the main process
**Answer:** Give tool work a dedicated, isolated environment. Several of Inspect's standard tools require a sandbox. Gemini CLI isolates potentially dangerous operations from your host system.

## Why it matters

In Inspect, model tool calls run in the main evaluation process. The work those tools perform, such as shell commands or Python code, often needs a dedicated, isolated environment. Several of Inspect's standard tools require a sandbox, including `bash()`, `python()`, and `text_editor()`. Docker support is built in. Provisioning a sandbox does not automatically run tools, agents or scorers in the container. Bind the sandbox at the Sample, Task, or eval() level, and then run the work there.

Gemini CLI sandboxing isolates potentially dangerous operations from your host system, including shell commands and file modifications. One benefit is to limit file system access to the project directory. You can also reduce risk when working with untrusted code. Enable it with a command flag, an environment variable, or a configuration file. Container-based Docker or Podman sandboxing gives cross-platform process isolation.

- `Isolated environment` Standard shell and Python tools in Inspect require a sandbox
- `Provisioning` Does not automatically run tools, agents or scorers in the container
- `Host isolation` Limit file system access to the project directory

## See also

- [ao-security-gemini-cli-sandbox](https://iinventedlight.com/library/notes/ao-security-gemini-cli-sandbox/)
- [human-in-the-loop-approvals](https://iinventedlight.com/library/notes/human-in-the-loop-approvals/)
- [ao-sandbox-firecracker-and-gvisor](https://iinventedlight.com/library/notes/ao-sandbox-firecracker-and-gvisor/)

## Claims

- id: C1
  claim: Provisioning an Inspect sandbox does not automatically run tools in the container.
  source: S1
  evidence: "Provisioning a sandbox does not automatically run tools, agents or scorers in the container."

- id: C2
  claim: Support for Docker sandboxes is built into Inspect.
  source: S1
  evidence: "Support for Docker sandboxes is built in"

- id: C3
  claim: Gemini CLI sandboxing can limit file system access to the project directory.
  source: S2
  evidence: "Limit file system access to project directory."

## Sources

- [S1] Sandboxing. Inspect AI (UK AI Security Institute). https://github.com/UKGovernmentBEIS/inspect_ai/blob/main/docs/sandboxing.qmd . License: MIT. Accessed 2026-11-22.

- [S2] Sandboxing in Gemini CLI. Gemini CLI. https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/sandbox.md . License: Apache-2.0. Accessed 2026-11-22.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Inspect AI, Sandboxing, MIT; Gemini CLI, Sandboxing, Apache-2.0. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
