by Samy (Kondasamy Jayaraman)

Module 15 · Agent sandboxing

Advanced

Where an agent’s code runs, and what it can reach

When an agent runs code to do its work, a planted instruction can make that code read your files or send your data away. A sandbox is a box the operating system holds the code inside: it decides which files the agent sees and which servers it can reach, from outside the model, so it holds even when the agent is taken over.

Read as
OK

The whole idea in one example

A planted note made the agent send a secret away

On the host

Full access

The agent runs with the developer’s own access. A note in its task tells it to read the access token and send it to an outside address.

customer data and the access token sent out to attacker.example.

What left the machine

Leaked

fetch to attacker.example

The token went out. On the host there was nothing to stop it.

In a sandbox the same note changes nothing: the token is kept by a gatekeeper (a proxy) outside the box, the outside address is not on the list of allowed servers, and the moves are refused. The agent’s turns are recorded, written to illustrate the sources below; the sandbox is a model (no real code runs), and its checks and the outcome are computed in your browser.

How it works

Three ideas carry the module

  1. OK

    1 Where the code runs

    The same task, held inside a box the operating system enforces

    In Anthropic’s October 2025 design, the file wall lets the agent read or change only specific folders.

    Source, checked 30 October 2026

  2. OK

    2 Two walls: files and network

    What it can read and write, and where it can reach

    In Anthropic’s design, the network wall lets the agent connect only to approved servers, so a taken-over agent cannot leak private data or download malware.

    Source, checked 30 October 2026

  3. OK

    3 An allowed door still leaks

    A request to an allowed server can carry data out

    Allowing broad domains such as github.com can create paths for data exfiltration, because the proxy makes its allow decision from the client-supplied hostname without inspecting the encrypted connection's contents.

    Source, checked 30 October 2026

The story

Larkspur’s agent runs code now

Larkspur Supply Co.’s agent now runs code to do its work, so where it runs and what it can reach decide what a compromised agent can do. You’re on the team that decides which sandbox settings it runs with.

New to Larkspur’s agent, or to planted instructions (prompt injection)? The AI agents module builds what this one defends.

New to Larkspur’s agent, or to planted instructions (prompt injection)? The Prompt injection & guardrails module builds what this one defends.

4
made-up attacks in the module’s test set
2
ordinary tasks in it too
4 of 4
attacks that work with no sandbox
0 of 4
with the sandbox set up well, and 0 of 2 tasks blocked

Your path

The chapters

  1. Chapter 1

    Where the code runs

    What changes when the same attack runs on the host, then in a sandbox?

  2. Chapter 2

    Files

    What does the sandbox mount, read-only or writable, and what does it hide?

  3. Chapter 3

    Network

    With egress off, then an allow-list through a proxy, what can the agent reach?

  4. Chapter 4

    Secrets

    With the egress open, does moving the secret out of the sandbox stop it being stolen?

  5. Chapter 5

    An allowed door still leaks

    If the agent can reach only Larkspur’s own host, can an attack still get data out?

  6. Chapter 6

    Fewer prompts, same safety

    With a sandbox boundary, which actions still need a person, and which can run freely?

  7. Chapter 7

    Red-team the sandbox

    Which sandbox policy stops every attack and still lets every ordinary task run?

Who it’s for

  • Product managers
  • Engineers
  • Analysts
  • No code needed

Product managers, engineers and analysts whose AI agent runs code or tools that can touch files and the network. No code needed. Play AI agents and Guardrails first if agents and planted instructions (prompt injection) are new to you.