Why Code Actions Win

The claim that agents should write code isn't just aesthetic — Hugging Face backs it with measured results: code agents take fewer steps, make fewer LLM calls, and score better on hard benchmarks. This post examines the evidence and the mechanism, so you understand not just that code actions win but why.

The last post explained what code actions are. This one examines why they win — the concrete efficiency and accuracy advantages Hugging Face reports, and the mechanism behind them. The claim is that code agents are meaningfully better than JSON tool-calling agents on substantive tasks, and it’s worth understanding the reasoning, because it tells you when the advantage is real. (Figures are Hugging Face’s reported results on their benchmarks — directional, verify on your workload.)

The efficiency advantage

The headline result: code agents are reported to reduce the number of steps and LLM calls by around 30% compared to standard tool-calling, on the tasks measured. That’s a substantial efficiency gain, and it follows directly from the code-action mechanism (the last post):

The efficiency gain matters on two fronts covered elsewhere in this blog:

So the code agent’s expressiveness (from the last post) isn’t just elegant — it translates into measurably fewer, more-productive steps, which is fewer calls, lower cost, and lower latency. That’s a concrete, multi-dimensional win, not just a nicer programming model.

The accuracy advantage

Beyond efficiency, code agents are reported to achieve superior performance on complex benchmarks — better accuracy, not just fewer steps. This is the more surprising claim (you might expect a tradeoff — faster but worse), and the mechanism explains why there isn’t one:

So code agents are reported to be both more efficient and more accurate on complex tasks — an unusual combination that comes from aligning the action format with both the task’s structure and the model’s strengths. The absence of a speed-vs-accuracy tradeoff is the strongest part of the case: you’re not trading quality for efficiency; the same mechanism delivers both.

The mechanism, restated

It’s worth restating why one mechanism delivers both efficiency and accuracy, because that’s the deep point:

Complex agentic work is fundamentally about composing operations — call this, use its result to do that, loop, combine, compute. A programming language is built to express composition; a list of isolated JSON function calls is not. So when you let the agent act in code, you let it express the composed action directly and correctly in one step, whereas JSON tool-calling forces the agent to decompose that composition into many single-call turns, threading intermediate results back through the model as text each time. The single code action is both fewer steps (efficiency) and less error-prone (accuracy), because the composition stays intact in code rather than being fragmented across turns. One mechanism — actions as composable code — produces both wins, because both problems (too many steps, too many error points) come from the same root: fragmenting composed work into isolated calls.

When the advantage is real (and when it isn’t)

The evidence is compelling, but the advantage is strongest for a specific kind of task, and honesty requires the boundary:

So code actions win because they align the action format with composed work and with the model’s code fluency — delivering fewer steps and better accuracy where tasks involve real composition, which is most substantive agentic work. The advantage is genuine and mechanistically sound, largest where composition is heaviest, and directional in magnitude. But executing model-written code introduces a serious cost — security — which the next post addresses, because it’s the price of this power.

Key takeaways

Further reading

Sources & References

Code agent performance