← Latest papers
🤖 AI

When Does Restricting a Coding Agent to execute_code Help? A Regime ×\times Agent-Design Ablation

This paper demonstrates that restricting coding agents to a single `execute_code` tool is often as effective as and frequently cheaper than using tool-rich environments, revealing that the optimal tool surface is jointly determined by the interaction between task regimes and specific agent designs rather than by either factor alone.

Original authors: Hong Yang, Qi Yu, Travis Desell

Published 2026-07-14
📖 6 min read🧠 Deep dive

Original authors: Hong Yang, Qi Yu, Travis Desell

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you have a super-smart robot assistant whose job is to fix broken code or solve math puzzles. Right now, there's a huge debate in the tech world about how this robot should talk to the computer to get the job done.

Some say, "Give it a full toolbox with special buttons for every task!" (Like a fancy IDE).
Others say, "Just give it a command line and let it type shell commands!" (Like a hacker in a movie).
A third group says, "Nope! Just let the robot write a Python script and run it all at once!" (The execute_code approach).

This paper is like a giant, fair referee that sets up a race to see which method actually saves money and gets the job done. They didn't just guess; they ran the exact same robot (two different models: Claude and Codex) on the exact same tasks, but changed only the tools they were allowed to use.

Here is what they found, broken down into simple stories.

The Main Discovery: It Depends on the Robot and the Job

The biggest surprise? There is no single "best" tool. The winner changes depending on who the robot is and what it's doing.

Think of it like this:

  • The "Math Puzzle" Job (Artifact Tasks): If the robot is doing calculations or data crunching, the "write a script and run it" method (code_only) is the clear winner. It's like hiring a chef who just writes one perfect recipe and cooks the whole meal in one go.

    • For the Claude robot, this method saved 24.6% on costs.
    • For the Codex robot, it saved about 6.7% (though the paper says this one is a bit shaky, like a coin flip).
    • Verdict: For math and data, the script method is cheaper and just as good at solving the problem.
  • The "Fixing a Messy Codebase" Job (SWE-bench Tasks): This is where it gets tricky. These tasks involve editing many files in a complex project.

    • If you use the Codex robot: The script method is still the champion! It saved 19.9% on costs. Why? Because the script method lets the robot bundle many small requests into one big package, like a delivery truck carrying 50 packages instead of a person walking 50 times.
    • If you use the Claude robot: Uh oh. The script method actually got more expensive (by 14.4%), though the paper notes this wasn't a statistically "proven" difference, just a strong trend. Why? Because for Claude, writing a script to edit a file is like trying to change a tire by building a new car first. It takes way too many words (tokens) to explain the edit in code, creating "edit friction."

What the Paper Rules Out

The paper explicitly argues against the idea that one tool surface is always better for everyone.

  • It rules out: "Special IDE buttons are always required." (Because the script method won on Codex).
  • It rules out: "Bash commands are always enough." (Because the script method was cheaper on Claude for math tasks).
  • It rules out: "Code execution is always the cheapest." (Because it was more expensive for Claude on complex code fixes).

The authors are very clear: You can't just pick a tool based on the tool itself. You have to look at the combination of the robot's brain and the type of work.

The "Pass Rate" Surprise

Here is the most important part: The cost changed, but the success rate didn't.

Imagine two runners. One runs in heavy boots (expensive tools), and one runs in sneakers (cheap tools). The paper found that both runners finished the race at the exact same speed.

  • Whether the robot used the fancy toolbox, the bash commands, or the script method, the percentage of tasks they solved correctly was almost identical (within 3 percentage points).
  • The "script" method didn't make the robot smarter or dumber; it just changed how it walked to the finish line. Sometimes that walk was a sprint (cheap), and sometimes it was a stumble (expensive).

Why Did the Costs Change?

The paper digs into why the script method was cheaper or more expensive.

  1. The "Edit Friction" Tax (For Claude): When Claude had to use the script method to fix a file, it had to write a long Python script just to say "change line 5." This used up a lot of "output tokens" (words the robot had to type). It was like paying a toll every time you wanted to turn a page. This happened mostly on tasks where the robot failed or struggled, making those specific runs very expensive.
  2. The "Batching" Bonus (For Codex): When Codex used the script method, it could pack many small commands into one script. Instead of asking the computer "Read file A," then "Read file B," then "Read file C" (three separate trips), it asked "Read A, B, and C" in one go. This saved a ton of "input tokens" (words the robot had to read).
  3. The "Doomed Run" Effect: The extra cost for Claude on the code-fixing tasks mostly happened when the robot was already going to fail. It was like a car running out of gas while driving in circles. The script method didn't cause the failure; it just made the failed attempt cost more money.

How Sure Are We?

The authors are very confident in the math tasks and the Codex robot results. They ran these tests on 93 math tasks and 100 code-fixing tasks, using three different "seeds" (random starting points) for each to make sure the results weren't just luck. The savings for Codex on code-fixing tasks were statistically significant (a 19.9% drop with a p-value of 2.0 × 10⁻⁹, which is basically zero chance of being random).

However, for the Claude robot on code-fixing tasks, the result is a bit murkier. The cost went up by 14.4%, but the statistical test said this wasn't a "slam dunk" proof (p-value of 0.12). The authors call this "directional," meaning the trend is there, but they'd need to run it more times to be 100% certain it's not a fluke.

The Bottom Line

If you are building a coding agent:

  • Don't guess. The "best" tool depends on your specific robot and your specific job.
  • For Math/Data: Try the "write a script" method. It's cheaper and works just as well.
  • For Code Fixes: It depends. If you use Codex, the script method is great. If you use Claude, you might want to keep the standard editing tools, especially for hard problems, because the script method might get bogged down in "edit friction."
  • Don't worry about intelligence: Changing the tools won't make your robot smarter or dumber; it just changes the price tag of the journey.

The paper concludes that the "cheapest" way to run an agent isn't a universal rule; it's a puzzle where you have to match the tool to the robot and the task.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →