# Stop Giving Your Agent Tools. Give It a Sandbox

Mikyo King, Arize AI | AI Engineer NYC 2026 | 14:38

Source: https://www.youtube.com/watch?v=dAoOYFx7ZYw
Channel: AI Engineer (https://www.youtube.com/@aiDotEngineer). Summarised by AIE Talks.
Page: https://aietalks.com/talks/stop-giving-your-agent-tools-give-it-a-sandbox
Published: 2026-10-27
Tags: context-engineering, evals, harness-engineering, tool-use

## TL;DR
- Code mode gives an agent a programming environment where it can find, compose, and run tools while returning only the information needed for its task.
- Arize Phoenix uses Bash, Python, REST operations, SQL, and browser-bound UI code to support longer and more flexible agent workflows.
- In Harbor evaluations, code mode used 43% fewer tokens and reduced cost by 31%, while latency stayed roughly constant despite sandbox overhead.

## Summary
Mikyo King argues that classic tool-calling agents become inefficient as their tool catalogs, outputs, and conversation histories grow. Code mode gives an agent a sandbox where it can discover tools, compose them in code, run operations sequentially or in parallel, and return only the useful result. King describes how Arize built this approach into Phoenix with Bash, Python, REST operations, SQL, and UI control. He is direct about the costs: sandbox resources, network access, secrets, permissions, failures, debugging, durability, image handoffs, and the risk of double sandboxing. Arize evaluates the approach with Harbor, running agents in isolated environments with repeated trials and task verifiers. In those evaluations, code mode cut token use by 43% and cost by 31%, while latency stayed roughly constant. The talk makes a practical case for testing sandboxed agents rather than assuming their flexibility comes for free.

## Key ideas
### Coding agents are dissolving the boundary between software users and software engineers
[00:36](https://www.youtube.com/watch?v=dAoOYFx7ZYw&t=36s)
King compares two ways to collect invoices from email. A programmer can write a script that checks attachments, downloads them, and stores them in a folder. A non-technical user has to work through the inbox interface and download files manually. Tools such as Claude Code let a coding agent build the needed software dynamically. King connects this change to benchmarks such as SWE-bench, where models are trained to perform software engineering tasks. He argues that agent architectures should make similar use of dynamic software creation.

### Classic tool calling fills the context with catalogs and raw results
[01:52](https://www.youtube.com/watch?v=dAoOYFx7ZYw&t=112s)
In a conventional agent, a large catalog of tools is placed in the context. The agent calls one tool, receives its output in the context, reasons about it, and calls another. This can work with a small, fixed tool set, but longer tasks create context bloat. Irrelevant tools, noisy outputs, pagination, and many turns lead to what King calls context rot. The agent may then need compaction, while each extra tool call adds latency, cost, and time before the user gets an answer.

### Code mode lets the agent discover and compose tools inside a programming environment
[03:03](https://www.youtube.com/watch?v=dAoOYFx7ZYw&t=183s)
Code mode replaces a huge upfront tool menu with the ability to search for the specific tool needed and execute it in a programming environment. The agent can run calls sequentially or in parallel, add conditionals, and call several tools in one turn. It can also return only the result needed by the model. King describes this as a way to reduce the amount of tool output pushed into context and reduce the number of turns required for a task.

### Progressive disclosure and composability make code mode more efficient
[04:37](https://www.youtube.com/watch?v=dAoOYFx7ZYw&t=277s)
King gives four reasons for using code mode. The agent can progressively discover tools instead of receiving the whole catalog at the start. It can compose tools through sequences, parallel calls, fan-out, and chains. It can trim or search tool results and place only useful information in context. It can also create new tools for a task. For example, code can remove personally identifiable information from records without placing raw credit card numbers into the model's context.

### Phoenix combines several sandboxes with data and interface access
[06:11](https://www.youtube.com/watch?v=dAoOYFx7ZYw&t=371s)
Arize built code mode into Phoenix, starting with Bash so agents can combine Linux commands such as sed and grep with the Phoenix CLI and write results to files. A Python sandbox provides another programming environment, while Phoenix's REST create, read, update, and delete operations let the agent manipulate traces and datasets. SQL supports aggregate queries, such as finding language-model spans with a particular P95 latency, without paging through every trace. Phoenix also gives code access to parts of its UI, including changing the time range and reading data through a browser-bound programming environment.

### Sandboxed code introduces security and operational costs
[08:19](https://www.youtube.com/watch?v=dAoOYFx7ZYw&t=499s)
Code mode runs generated code, so the system must manage CPU, memory, sandbox lifetime, and network egress. Secrets need careful handling because they must not return to the model's context. Permissions can be correct for one operation and too broad or inappropriate for a later operation or a composed workflow. Sandboxes can fail to boot, and debugging code is harder than debugging an individual tool call. Tool parameters become code, tool discovery requires an additional handshake, and combining MCP with a harness can create double sandboxing and extra serialization work.

### Durability, data handoffs, and model choice remain open problems
[10:42](https://www.youtube.com/watch?v=dAoOYFx7ZYw&t=642s)
King says a long code workflow may break in the middle without a way to resume from the failed step. The choice of programming language can matter when determinism or mathematics is important. Code mode can manipulate images and other binary data, but moving those results out of the sandbox without putting the whole binary into context may require a signed image handoff. Frontier models perform well with code mode, while smaller models used for cost savings may lack the needed capability.

### Harbor evaluates code mode through repeated sandboxed trials
[11:44](https://www.youtube.com/watch?v=dAoOYFx7ZYw&t=704s)
Arize evaluates its agents with Phoenix and the Harbor framework. Harbor places agents in sandbox environments, gives them clear instructions, turns network access off, and runs tasks through multiple trials to reduce flakiness. Verifiers assign a one or zero for task success across different permutations. The team tracks pass at K for tasks that should succeed, since an indeterminate agent can take different trajectories on different attempts. Captured trajectories and eval results also let the team identify instructions that reduce efficiency and improve the agent through repeated iteration.

### Arize's Harbor run reduced tokens and cost without increasing latency
[12:55](https://www.youtube.com/watch?v=dAoOYFx7ZYw&t=775s)
In the comparison King presents, code mode reduced token use by 43% and cost by 31%. The sandbox added overhead, but latency stayed roughly constant. Arize ran the comparison across surfaces including Claude Code, MCP, and the CLI. King presents the result as evidence that fewer turns, selective context, and longer-horizon behavior can produce a more efficient agent, provided the sandbox and its failure modes are tested.

## Notable quotes
- "Basically, anything you need, the coding agent can actually build that software for you dynamically." (01:13)
- "You give it a programming environment to execute those tools in different types of flows." (03:12)
- "The emerging behavior of being able to create its own tools has a huge amount of benefit." (06:05)
- "We decreased the amount of tokens by 43%. The cost went down by 31%, and there was some overhead with the sandbox, but the latency stayed pretty constant." (12:50)

## Tools & references mentioned
- Arize AI
- Arize Phoenix
- Claude Code
- SWE-bench
- Bash
- Python
- SQL
- Harbor
- MCP
- Anthropic
- JavaScript

## Who should watch
- You are building a tool-calling agent whose context grows with every tool definition and raw result.
- Your agent needs to combine many operations, process data, or perform longer tasks without exposing all intermediate results to the model.
- You are considering sandboxes and need a grounded account of secrets, permissions, failures, durability, evaluation, and cost.

## Editor's note

From the pack [Context engineering](https://aietalks.com/packs/context-engineering):

Delucia tests failures late in long sessions, Hablich measures tokens per successful outcome, and Pai insists that generated code remain inspectable. Those checks need records of real runs. Kitaru captures an agent's inputs, outputs and tool calls so a team can replay the same task after changing retrieval, compaction or tool exposure and inspect what the new context changed.

Written by the AIE Talks editors (the Kitaru team), not by the speaker.

## Related talks

- [Code Mode: Let the Code do the Talking](https://aietalks.com/talks/code-mode-let-the-code-do-the-talking) (Sunil Pai, Cloudflare, 19:40)
- [Give Your Agent a Computer](https://aietalks.com/talks/give-your-agent-a-computer) (Nico Albanese, Vercel, 1:08:53)
- [Why AI Agents Should Have Their Own Sandbox](https://aietalks.com/talks/why-ai-agents-should-have-their-own-sandbox) (Philipp Schmid, Google DeepMind, 20:42)
- [Agents That Write Their Own Tools at Runtime](https://aietalks.com/talks/agents-that-write-their-own-tools-at-runtime) (Sandhya Subramani, AWS, 20:40)
- [YOLO Mode, Safely: MicroVM Sandboxes for Any Agent](https://aietalks.com/talks/yolo-mode-safely-microvm-sandboxes-for-any-agent) (Rowan Christmas, Docker, 11:35)
