How does function calling enable the observe-plan-act agent loop?
Function calling is a provider-side feature where the model emits structured tool-call JSON instead of plain text. The deterministic parseability is what makes tool-using agent loops practical at scale.
Imagine asking an assistant to look something up. One way: they write a sentence saying 'please search for X' and you read the sentence and try to figure out what they meant. The other way: they hand you a small form with the search field filled in, so there is no ambiguity about what they want. Function calling is the second way. Modern LLM APIs let the model produce a structured tool-call form (a JSON object with the function name and arguments) instead of a free-text request. The runtime can read the form directly and call the right function. No guessing, no regex. This deterministic shape is what makes agent loops reliable enough to ship in production.
Detailed answer & concept explanation~7 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Define function calling as the provider-side feature where the model emits structured tool-call JSON guaranteed at the sampling layer. Name the providers (OpenAI, Anthropic, Google, open-weight). Contrast with prompt-engineered tool calls. Explain why this is the substrate for reliable agent loops. Distinguish from MCP. Close with the known limit: structure is guaranteed, semantic correctness is not.
Real products, models, and research that use this idea.
- OpenAI's tools parameter in chat completions returns tool_calls in the response; GPT-5.5 and o3 both support function calling natively.
- Anthropic's Claude Opus 4.7 and Sonnet 4.6 support tool_use content blocks, the structured tool-call format that LangGraph and CrewAI build their agent loops around.
- Google's Gemini 3.1 Pro uses function_declarations; the structured function_call response part is consumed by Vertex AI agent runtimes.
- Open-weight models like Llama 4 Maverick, Mistral Large 3, Qwen 3.5, and DeepSeek V4 all ship with tool-use support, often using OpenAI-compatible APIs so existing agent code works without changes.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow is function calling different from MCP?
QWhy is function calling more reliable than prompt-engineered tool calls?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Confusing function calling with prompt-engineered tool calls. Prompt-engineered tool calls rely on the model writing parseable text; function calling guarantees structured JSON at the token-sampling layer.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.