Code mode's 10 failure modes: 58% cheaper per Pydantic benchmark, but easier to break

himanshu_942 · reddit · 2026-11-25

A practitioner breaks down 10 failure modes of programmatic tool calling (code mode), where the model writes a script that calls your tools instead of invoking them one at a time. Pydantic's benchmark of 5,276 runs across eight models found code mode cuts cost by 58% and wall time by 51% on long tasks — but it also moves dozens of tool calls into code nobody reviews before execution.

Script-to-tool contract

The proxy between script and world

Between runs

The catch: the proxy is real engineering and carries most of the safety; small jobs (5 items in the benchmark) can cost more with code mode; debugging generated code is harder than reading a clean tool-call trace.

Original post →

More from coding & agent

coding & agent channel →