Superintelligent Agents in a Sandbox: Run Code Without Live Risk
An AI agent sandbox isolates code execution and file changes from live systems. Learn how to set boundaries, check outputs and promote results safely.

An AI agent sandbox is an isolated runtime where an agent can run code, read copies of files and transform data without any write path to production systems. Results leave the sandbox only after a defined review or a separate check approves them. This lets you test an agent on real work while failed scripts, unexpected behavior and manipulated inputs stay away from the records your business depends on.
Key takeaways
- A sandbox isolates what the agent can reach, including files, network destinations, credentials, processes and time, not only what it can say.
- Give the agent copies or snapshots of data, never standing production credentials.
- Treat sandbox output as a proposal, and define the promotion step that a person or a deterministic check must approve.
- Log every command, file change and tool call so you can reconstruct what happened and why.
- Start with one transformation task and an observable success criterion, then widen access only with evidence.
What an agent sandbox isolates
A sandbox is defined less by the technology behind it and more by what the agent can reach. A container, a virtual machine or a restricted process can each serve as the boundary, but the useful question is which files, hosts, accounts and programs are visible from inside. If the agent can write code, it can also write to any path it is allowed to touch, so the sandbox has to be the outer wall, not a suggestion in the prompt.
The main reason for this discipline is that an agent reads content it did not write. Uploaded spreadsheets, customer emails and web pages can contain text that tries to steer the agent toward actions its owner never intended. The OWASP prompt injection guidance is clear that model-level defenses alone are not enough, so the environment has to limit the damage a manipulated agent can do. A sandbox with no production credentials and no outbound network route turns a successful manipulation into a wasted run instead of an incident.
If you are still getting comfortable with the idea, the sandbox explainer covers the basic vocabulary before you design your own boundary.
Decide what goes inside and what stays outside
Most mistakes happen at the boundary, not in the code. Before any run, write down what the sandbox contains and what it must never contain. A practical starting list looks like this:
- Inside: copies of input files, an empty working folder, a pinned set of interpreters and libraries, and one output folder.
- Outside: production databases, payment and billing systems, customer messaging channels, shared drives with write access and administrator consoles.
- Credentials: none by default. If a read-only token is required, scope it to one resource, make it short-lived and keep it revocable.
- Network: deny by default, then allow only named destinations that the task truly needs.
- Writes: permitted only to the output folder. Any other write attempt should stop the run.
Authorization should follow the same narrowness. Google's OAuth 2.0 documentation describes granting access through scoped tokens, and the same principle applies to any tool the agent calls. Each tool should appear on an explicit allowlist, and that list should be reviewed on a schedule. A useful companion here is the guidance on tool allowlists for AI agents, which argues for starting small and widening only when the evidence supports it.
A step-by-step plan for a file transformation task
File transformation is the most common first use of a sandbox, because the inputs and outputs are easy to inspect. A workable sequence has six steps:
- Snapshot the source files and record a checksum for each one, so you can prove later what the agent received.
- Create an empty working directory inside the sandbox and copy the snapshot into it, never working on the original.
- Give the agent a written task contract that names the input format, the required output format and the stop conditions.
- Let the agent run its transformation, with a step or time budget that ends the run if it loops.
- Run deterministic checks on the output, such as row counts, required columns, value formats and untouched identifier columns.
- Hold the result as a proposal, generate a change report and send it to a reviewer before anything reaches a live system.
The sixth step is where most teams underinvest. The change report should list every altered record by identifier, with the before and after values. A reviewer who can see the diff can approve in minutes, while a reviewer who only sees a new file has to re-derive the work. For a deeper look at the handoff between sandbox and live systems, the staging and production comparison explains why the two environments should stay separate.
How do you check what the agent produced?
A sandbox run that finishes without errors has only proven that the process completed. Correctness needs separate evidence. Start with a set of representative inputs where the right answer is already known, and run the agent against them every time its instructions, tools or model change. OpenAI's evals guide describes this pattern of defining expected behavior before judging a system, and the same logic applies to a transformation agent that must keep identifiers stable and formats consistent.
Observability supplies the rest. OpenTelemetry's primer describes traces, logs and metrics as the basic signals for understanding how a system behaved. For an agent, a trace should show each model call, each tool invocation, each file written and each stop event, linked to one run identifier. When a reviewer asks why a row changed, the answer should be in the trace, not in someone's memory of the session.
Sample sizes matter too. A clean run on a handful of rows does not prove the agent handles the unusual cases in your full export. Include known edge cases in the test set, such as blank fields, duplicate identifiers and values in unexpected units, and treat any unexplained change as a failed check.
Illustrative scenario: cleaning a product catalog export
The following scenario is illustrative and does not describe a specific client. A small online shop wants an agent to standardize size labels and fill missing category codes in a catalog export before the next import. The owner forbids any change to prices and product identifiers.
The team copies the export into the sandbox, along with the category reference table. The agent writes a corrected file and a change report that lists each altered row. A deterministic check confirms that every identifier still exists, that no price column differs from the original, and that every category code appears in the reference table. Two rows fail the category check, so they are flagged for manual review instead of being guessed.
During the run, the agent also attempts to call the storefront API to look up a product image. The network rule blocks the request, the attempt is logged as a stop event, and the run finishes with a warning. The owner reviews the change report, approves the file and runs the import through a separate step that only a named person can trigger. Nothing in the sandbox ever had write access to the store.
How Be Human handles this in a managed setup
Be Human designs the sandbox as part of the agent's operating context rather than as an afterthought. The first engagement defines one useful role, the memory and tools that role needs, the approval boundaries and a success criterion you can observe. The boundary between sandbox and live systems is written down, the tool allowlist is set to the minimum the task requires, and the promotion step is assigned to a named reviewer. Managed operations then include monitoring of run traces, recurring evaluations against known inputs, permission reviews and incident response when a stop condition fires. The aim is not to make the agent more capable in the abstract, but to keep its reach visible and reversible.
Where to start
Pick a task that is repetitive, has clear inputs and outputs, and can be checked without judgment calls. Snapshot the data, write the boundary list, define the checks and decide who approves promotion before the first run. Expand the scope only after several reviewed runs show the same behavior. If you are not sure which task deserves a sandbox first, take the free Be Human AI diagnostic to find the first task worth handing to an agent.
Frequently asked questions
Is a sandbox the same as a staging environment? A sandbox is an isolated place where an agent executes code and changes files, while a staging environment is usually a full copy of a system used to test releases. The two often work together: the sandbox limits what the agent can reach during experiments, and staging checks how a proposed change behaves in a system that resembles production. Each has a different purpose, so it helps to define both before you give an agent any access.
Can an agent in a sandbox still cause harm? Yes, but the harm is usually contained to the sandbox itself, the output folder and whatever the reviewer chooses to approve. The main residual risks are a poor transformation that looks plausible, and an approval that happens without a real review. Deterministic checks, a complete change report and a named human promotion step address both.
Do I need a developer to set up a sandbox? A developer is usually needed to build the isolation layer, but a business owner or operations leader should own the decisions about what the sandbox can reach. Those decisions are documented in plain language: which data is copied, which tools are allowed, which destinations are permitted and who approves the results. Once those rules exist, they can be reviewed on a schedule without rebuilding the environment.
When is it safe to let an agent write to a live system? Write access to a live system is safe only after the agent has passed evaluations on representative inputs, the logs show no unexplained behavior and the promotion step is clearly owned by a person or an approved check. Even then, start with a narrow write permission on one record type and widen it slowly. Treat each expansion as a change to be reviewed, tested and recorded.
Your next step
See where an AI agent fits in your company first.
Take the free Be Human AI diagnostic. A few questions about your work show which task to hand to an agent first, what it needs to know and where a person approves.
Be Human editorial guidance. Examples are illustrative unless explicitly attributed. Sources provide background; implementation choices depend on your workflow.


