Programmatic tool calling

  • Agents
  • Industry term
3 steps

In programmatic tool calling, the AI model inside an app writes a short program that uses tools, actions the app lets it take. The program can repeat steps and return only the information the model needs.

The program can look up several records at once, calculate totals, or choose which records to keep. It reads the full tool replies and can send the model just a list or a total. The model, the trained AI that writes replies, may never receive the other details.

Where you’ll meet it

You ask your AI app which of 300 customers haven't ordered in 90 days. It runs a program that looks up order histories and returns a short list, without showing hundreds of individual lookup results in the conversation.

What to do

Before using the list, ask which order date the program used for each customer and how it handled customers with no orders. Compare a few customers on and off the list with their order records. Checking only listed customers wouldn't reveal customers the program missed.

Easy to mix up

Who reads each tool's full reply?
Programmatic tool callingTool use / function calling
The program, which chooses what to send back to the modelThe model, which uses the reply to decide what to do next

Check yourself

An agent's program reads supplier quotes and sends the model only their totals. You then ask the model to compare the warranty terms in those quotes. What would give it the information it needs?

Go deeperRunning generated code adds work and changes how approvals are handled

Anthropic's November 2025 article, “Code execution with MCP,” identifies the need for sandboxing: restricting what generated code can access. Builders must maintain a place to run that code as well as the tools themselves, adding operational work.

OpenAI's programmatic-tool-calling documentation recommends sending each tool result directly to the model when the next step needs its judgment, citations must be preserved, or actions require approval. Tools whose instructions load through search must also be found before the program starts. An already running program cannot perform tool search.

Sources

Practice Modern AI

Or take the learning quiz on a mix of every set