Adios
BlogGuide

Guide

What Is an AI Sandbox? How Agents Run Code with Boundaries

An AI sandbox gives agent-generated code a controlled place to run. Learn how isolation works, what persists, and how execution connects to a real project.

Adios team8 min read

An AI sandbox is an execution environment that limits what code generated or selected by an AI agent can access and consume. Its job is to put boundaries around execution: files, processes, network access, credentials, and resources. The word sandbox alone does not tell you how those boundaries are enforced.

Why AI agents need an execution boundary

A coding agent can suggest a change without running anything. The risk changes when it installs a package, executes a test, opens an uploaded file, or starts a server. Those actions run programs with the permissions of the environment around them. A test command can execute dependency scripts; a data analysis task can open files the user never intended to share.

Consider an agent asked to fix a failing application. It reads the project, changes a module, installs dependencies, and runs the suite. Giving that process your normal development environment also gives it whatever that environment can reach: mounted directories, credentials, network services, and possibly production systems. An execution boundary lets you give the task a smaller set of capabilities.

The aim is to make the permitted actions explicit. A sandbox can still run incorrect code, contact an allowed endpoint, or misuse a credential deliberately supplied to it. Treat generated code and its dependencies as inputs to check, then design the environment around the consequences of executing them.

How an AI sandbox fits into an agent run

A typical run starts with a project or a set of inputs. The agent proposes code or a command, an execution tool runs it in the configured environment, and the tool returns evidence such as output, an exit code, or a generated file. The agent can then use that evidence to make another change.

For an application, the result may include a preview server. For a data task, it might be a chart. For a code review, it might be a test failure with the relevant logs. The useful contract includes what went in, what ran, what came out, and what should survive when execution stops.

The execution loop
  1. 01Prepare

    Select source, input files, dependencies, and permissions.

  2. 02Execute

    Run the task within the configured runtime limits.

  3. 03Inspect

    Read output, exit status, file changes, and preview behavior.

  4. 04Keep or clean up

    Save the useful artifacts and stop resources you no longer need.

Review and deployment are separate decisions after the execution loop. A passing command does not make the resulting application ready for production.

Containers, gVisor, and microVMs enforce different boundaries

Sandbox describes a purpose, rather than one implementation. Ordinary Linux containers use namespaces and other kernel controls to separate processes while sharing the host kernel. Docker's security guidance covers namespaces, control groups, capabilities, and the risk of access to the Docker daemon. The mounts, privileges, and interfaces you expose remain part of the boundary.

gVisor adds an application kernel in userspace that implements a Linux-like interface. It mediates application interactions with the host and aims to reduce exposure to host kernel vulnerabilities. That extra layer also makes application compatibility and workload performance things to evaluate.

A microVM runs a guest kernel behind a virtual machine boundary. Firecracker is one implementation: its design describes Linux guests, KVM, a small device model, and a jailer for production use. The surrounding platform still has to configure storage, networking, identity, and the lifecycle of each environment.

Execution isolation approaches and what to evaluate
ApproachBoundaryQuestions to ask
Linux containerProcesses separated through host kernel controls; the kernel is shared.Which mounts, capabilities, resource limits, and daemon interfaces are available?
gVisorAn application kernel mediates the application's system interface.Does the workload work correctly, and how do filesystem and networking performance compare?
MicroVMA guest kernel runs behind a virtualization boundary.How are images, networking, host hardening, and environment cleanup operated?

Isolation and persistence are separate choices

A sandbox does not have to be disposable. Isolation describes the boundary around execution; persistence describes what remains afterward. You can run a short task against durable source, keep an environment alive between turns, or discard its files as soon as the result is collected.

Be precise about what persists. A saved repository is different from an installed dependency cache, a mounted data volume, or the memory of a running process. Stopping an environment may preserve some of these and lose others. A long session duration is not a substitute for backups or version control.

For coding agents, a useful arrangement is a durable workspace with an execution lifecycle of its own. The team can keep reviewing the source after a preview stops, then rebuild from the recorded inputs. For one-off calculations, retaining the input reference and output artifact may be enough.

What a sandbox does not solve on its own

Runtime isolation does not decide whether an agent's requested action is appropriate. If an environment can reach an external service and holds a credential accepted by that service, code inside it may be able to use that access. Protecting the host and limiting application permissions are related but distinct jobs.

gVisor's security model explicitly distinguishes resources outside the sandbox from resources made available inside it. Apply that distinction when deciding which files, network destinations, and credentials to expose. Passing sensitive data into an isolated environment is still a decision to make that data available to the task.

The same applies to production actions. An agent may produce a valid build and still introduce a broken permission check or an expensive database query. Keep application review and release authorization in the workflow; execution isolation cannot establish that the feature is correct.

Match the environment to the task

A coding assistant needs project files, build tools, and a way to inspect changes. An app-building agent also needs a preview process and a reachable route. A data-analysis agent needs access to the relevant input and a way to return an artifact. These tasks can share execution infrastructure without needing identical permissions or retention rules.

Running customer-supplied scripts is another case. The code may be intentionally hostile, and one customer's job must not consume another customer's allowance or access their data. Assess that trust model explicitly before treating a convenient development workspace as an arbitrary-code execution service.

Measure the complete task path when comparing options. A runtime startup figure leaves out source hydration, dependency installation, queueing, application startup, and health checks. The time until your agent can use a result is often the more useful measurement.

Different agent tasks need different execution contracts
TaskUseful outputDesign decision
Coding and repairA source diff plus test resultsWhich repository and credentials may the agent access?
Application prototypingA running preview and its sourceWho can open the preview, and what data does it use?
Data analysisA report, chart, or transformed fileWhich inputs are available, and how are outputs retained?
Customer script executionBounded output and an exit statusHow are hostile code, tenant separation, and resource exhaustion handled?

Questions to answer before connecting an agent

Write down the execution contract before choosing a provider or building the integration. Test it with representative workloads, including failures. A hung command, missing dependency, or stopped preview should produce a state your application can understand and recover from.

  • —Access: which source files, mounted directories, and credentials are available to this task?
  • —Networking: which destinations can the running code reach, including internal services?
  • —Resources: what bounds CPU, memory, disk, process count, runtime duration, and concurrent jobs?
  • —Lifecycle: how do you cancel work, stop an environment, and distinguish temporary files from durable artifacts?
  • —Evidence: can you retrieve exit codes, command logs, file changes, and the source revision that produced a result?
  • —Release: which actions require review, and how is permission to deploy granted?

How this maps to Adios

Adios connects the coding workflow through a source-backed workspace. Its workspace documentation describes source files, Git operations, agent activity, builds, logs, preview controls, and deployment. That gives the team a project it can return to after an individual command or preview run finishes.

A supported MCP client can use the hosted Adios tools to create a workspace, write files, prepare a preview, and inspect logs. Authentication scopes the client to authorized team resources. The documented MCP workflow calls for explicit approval before deployment.

Adios's security overview describes Linux namespaces, cgroups, and resource limits where supported by the selected runtime. Those documented controls should guide evaluation; the word sandbox is not a promise of a microVM or dedicated guest kernel for every workspace. Confirm the required runtime properties for the code you plan to execute.

To try the workflow, connect an MCP client or open a workspace, make a small source change, and inspect its build and preview. Keep the result in Git. That gives you a concrete starting point for deciding what the next agent task needs.

  All articles