code interpreter tool
Language models are famously shaky at exact arithmetic and step-by-step logic — they predict plausible text, not guaranteed-correct numbers. A code interpreter tool fixes this by letting the model write a small program, actually run it in a sandbox, and read back the real output. Instead of guessing what 4,817 times 263 is, the model writes the multiplication as code, the computer does it exactly, and the true answer returns.
Mechanically it is one powerful tool in the agent's toolbox: a sandboxed environment, usually Python, where the model can execute code, do math, parse files, draw a chart, or transform data. The result — a number, a table, an error message — comes back as an observation the model can use or debug. Because the computer, not the model, performs the computation, the answers are reliable in a way pure text generation never is.
It also widens what can go wrong: code can loop forever, crash, or do something unintended, so the sandbox is isolated and limited. The model still has to write correct code, but at least a mistake now shows up as an error it can see and fix, rather than a confident wrong number.