The model fills out a form. Your code submits it.

Part 4 was the catalog of hands. Function calling (vendors also say tool use) is the protocol: the model does not “run Python in its head.” It emits a structured request — typically a tool name plus JSON-shaped arguments — and waits. The runtime validates, executes, and writes the result back into memory as the next observation.

OpenAI’s tools guide states the contract in one line: the model selects a tool; your application performs the action. Anthropic’s tool use overview is the same shape from another lab: you declare tools; the model returns a tool-use block; you run it; you continue the conversation with the result.

That round trip is the agent’s nervous system. Miss a step and you either hallucinate a success or stall in chat.

The JSON round trip

Advertise a schema. Get a structured request. Return a structured observation. OpenAI’s tools guide and Anthropic’s tool use overview both describe that loop: declare tools → model emits a tool request → you run it → you continue with the result.

You advertise:
  get_order(order_id: string)

Model emits (just an example, not a contractual API of any one vendor):
  { "name": "get_order", "arguments": { "order_id": "9" } }

Runtime returns:
  { "status": "paid", "total": 80 }

Next prompt includes that JSON response

If the model emits {"order_id":"nine"} and you coerce it into 9 without a rule, you taught it that sloppy arguments still move money. Don’t.

Your code still must parse (reject malformed JSON), authorize (this caller, this account), execute (timeouts are observations), and return a short factual payload. The model proposed. The runtime decided.

Conclusion

Function calling is how language becomes an API request without pretending the weights contain your private network. The next layer, retrieval, is how you stop stuffing the whole company wiki into that request.

Takeaway: Function calling is a structured order form — name plus arguments — executed by the runtime, not by the model itself.

Sources


Part 4: Tools
Part 6: RAG