AI Engineering · LLM applications that ship
How does tool/function calling work?
Short answer
You describe available tools with schemas; the model returns a structured call instead of prose. Your code executes it, validates the result and sends it back, then the model continues.
Tool calling does not execute anything inside the model. The model chooses a tool and arguments, your application runs the function, and the result is appended to the conversation. This separation is what lets you enforce permissions, log side effects and retry safely.
- Describe each tool narrowly: one job, clear parameters, explicit constraints.
- Validate arguments before execution; never trust model-supplied IDs or amounts.
- Return structured errors the model can recover from instead of raw stack traces.
- Bound the number of tool calls per turn to prevent loops and runaway cost.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1How would you stop an agent from calling a destructive tool repeatedly?
- 2What should a tool return when the downstream API fails?
- 3Why is a narrow tool better than one generic 'execute' tool?
Say it in the interview
With tool calling the model outputs a structured request, but my code decides whether to run it. I define narrow tools with clear schemas, validate every argument, and enforce permissions on the server. Results go back as structured data, including errors the model can act on. I also cap how many calls a turn can make, because an agent that loops on a failing tool can burn cost and still produce nothing useful.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live AI Engineering mock interview and get scored feedback on depth, clarity and confidence.