Every tool this course has built so far is narrow on purpose: `read_invoice` reads one invoice, `check_status` checks one status, `send_email` sends one email. Each one exists because someone sat down, enumerated a specific operation the model would need, and wrote a handler and a schema for exactly that operation. That works well right up until the operation the model actually needs is one nobody enumerated in advance — filter these two thousand rows by a condition nobody wrote a tool for, convert this column of mixed units, join the output of one tool against the output of another in a way no single handler was built to do. A narrow-tool catalogue answers questions it was designed to answer; it has no answer at all for the question it wasn't.
Code execution is the tool that removes the enumeration problem entirely. Instead of calling a handler you wrote for one specific operation, the model writes the operation itself — real code, in a real interpreter, running inside a sandbox — and the sandbox executes whatever the model composed. One tool, `execute_code` in spirit if not always in name, now covers the entire space of operations expressible in a general-purpose language, which is a strictly larger space than any finite set of narrow tools could ever cover, no matter how many you write.
That power is not free. A narrow tool's input_schema is a contract: an `input_schema` that requires an `invoice_id` string can only ever be called with an invoice ID, and your dispatcher can check that mechanically before the handler runs. A code-execution tool's schema is, structurally, just "a string of code" — there is no schema shape that distinguishes a legitimate data transformation from a malicious one, because both are syntactically valid code. This lesson works through where that trade genuinely pays off, where a narrow tool still wins outright, and the sandbox discipline — state, dependencies, resource limits, and the security posture from lesson 23 — that makes handing a model a real interpreter survivable in production.