Published: 2026-10-30
Summary
Summary
Code mode: give the agent a sandbox instead of a tool catalog, with Arize's Harbor results (43% fewer tokens, 31% lower cost)
Chapters / key moments (click to jump — plays here on the page)
Instead of handing an agent a catalogue of tools and pushing every result into its context, code mode gives it search over tools plus a programming environment to run them in. This talk lays out why Arize adopted it, what is in their sandbox, and what it costs you in complexity.
Source video
"Stop Giving Your Agent Tools. Give It a Sandbox - Mikyo King, Arize AI" by AI Engineer — Watch on YouTube → The speaker leads the open-source group at Arize, whose Phoenix platform the agent runs in. Results are from their own evaluation.
Why code mode
- Less context bloat. A big tool catalogue and bulky tool results fill the window and cause turns, compaction and context rot. In code mode the agent searches for the tool it needs, runs it in code, and returns only what it needs.
- Composition. Tools can run in sequence, in parallel, with conditionals, fan-out and chaining, many in one turn.
- Progressive disclosure of tools, similar to the tool search now built into model providers.
- Emergent tools. Asked to remove personal data from records, a tool-calling agent without a suitable tool may do it in context and leak card numbers into the window. With a sandbox it can write its own tool.
What they put in the sandbox
- Bash, to compose built-ins like
sedandgrepwith their own CLI and offload output to files for later. - A Python sandbox.
- Their REST create, read, update and delete endpoints hoisted into the coding environment (such as fetching traces or changing datasets) so the agent can compose them.
- SQL. Not everything is CRUD; an aggregate query such as "LLM spans over a P95 latency" should not need paging through every trace.
- A UI programming paradigm: a web worker with two-way binding to the browser so the agent can change the time range or read data in the front end.
How they tested it
- Run the agent through variations in sandboxed Harbor environments with network access turned off and clear instructions.
- Run each task several times as trials to remove flake, since the system is non-deterministic.
- Write evals as Harbor verifiers that score each task 1 or 0, and track pass@k per task.
- Compare before and after across the surfaces (Claude Code, MCP and CLI). The reported result: tokens down 43%, cost down 31%, latency roughly constant despite sandbox overhead.
- Keep the trajectories and evals, then use them to tell a coding agent which instructions steer the agent wrong and hill-climb. Introducing a new tool can reduce efficiency at first.
Caveats: what code mode costs
- Resources and egress: hosted sandboxes need CPU, memory and lifetime limits, and you must decide what network access to allow.
- Secrets must not return to the context window; vaulting strategies differ by sandbox provider.
- Permissions are often over-broad, and can be correct for the first operations and wrong for a later one or a composition.
- Harder to debug: you debug code rather than individual tools, tool parameters are now code, and a failure in the middle of a big script cannot be resumed.
- Double sandboxing when code mode exists both in MCP and in the harness, with results serialised to JSON between them.
- Binary outputs such as images should not be serialised back into context; a signed hand-off may be needed.
- Language and model choice: JavaScript suits models but may not suit maths-heavy work; frontier models are strong at code mode, and a smaller, cheaper model may not be.





