AI / LLM Integration
Tool calls: multiple-choice review
Six questions that cut across the whole unit. None is a definition to recite — each mirrors a decision you make wiring a real agent loop against real, sometimes-mutating tools.
Confirm you can connect the round-trip contract, the validation trust boundary, the runaway guard, parallelism, and tool_choice — the synthesis the lesson built toward.
A user task needs four tool calls, all at distinct steps. Roughly how many model invocations does the loop make, and why does it matter for cost?
The model returns a tool_use for cancel_order with id 'ord_9f3c', an id that never appeared in the conversation. What is the senior move?
An agent in production occasionally racks up huge bills on single turns. Logs show it calling lookup_order, getting an error, and calling it again with identical arguments — over and over. What is the root cause and the fix?
You have two chains. Chain A: get_weather(NYC) and get_weather(SF). Chain B: find_user(email) then cancel_user_order(userId). Which can the model parallelize, and why?
You are building a classifier that must always return one of a fixed set of categories as structured JSON — prose is never an acceptable answer. Which tool_choice setting fits, and why not the others?
A 10-tool agent runs a 6-step task and the latency and cost are far higher than expected even though each tool is fast. What is the dominant overhead, and the standard mitigation?
The through-line is one contract: the model only requests a tool, your code executes it, and the loop re-invokes the model after every result — so cost compounds, schemas are re-sent each round (cache them), and an unguarded loop runs away. Validation is a trust boundary: schema-validate, then authorize and existence-check, then execute, returning errors as tool_result so the model self-corrects. Parallelism only helps independent calls; tool_choice (auto/any/tool/none) controls whether and which tool fires.