Tool Use in Language Model Agents
- 83Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is a tool in the context of a language model agent?
What is a tool in the context of a language model agent?
83 questions
- 1
What is a tool in the context of a language model agent?
- A
A text format that prevents models from generating ordinary answers
- B
A special training process that makes every model an API server
- C
An interface through which a model invokes an external program
- D
A stored set of facts that replaces the model's parameters
Correct answer
CAn interface through which a model invokes an external program
Explanation
A tool is an interface through which a language model can invoke an external computer program. The downstream action may vary, but the interface enables the model to use external capabilities.
- A
- 2
Why does a language model need tools to call a calculator or browser?
- A
It cannot generate tokens unless it first searches the web
- B
It predicts tokens and cannot invoke external programs on its own
- C
It can execute external programs, but cannot read their output
- D
It can call programs only when their code is part of its training data
Correct answer
BIt predicts tokens and cannot invoke external programs on its own
Explanation
A language model is fundamentally a token-predicting system. It cannot, by itself, invoke external programs; tools provide that connection.
- A
- 3
What does it mean for a tool to extend a language model's abilities?
- A
A tool converts every response into a fixed, non-text format
- B
A tool gives the model access to capabilities outside its own action space
- C
A tool makes a task easier even though the model can already do it
- D
A tool changes the model's parameters whenever it receives a new request
Correct answer
BA tool gives the model access to capabilities outside its own action space
Explanation
Extending a model means giving it access to capabilities outside its own action space, such as external information it could not otherwise obtain.
- A
- 4
Which situation best illustrates a tool facilitating rather than extending a model?
- A
Giving the model information that is absent from its parameters
- B
Making the model capable of a task it fundamentally cannot perform
- C
Allowing the model to change a user's external environment
- D
Offloading a task the model can perform to make it easier or faster
Correct answer
DOffloading a task the model can perform to make it easier or faster
Explanation
Facilitation applies when the model can perform a task itself, but an external tool performs it more easily, quickly, or reliably. Calculator use for arithmetic is an example.
- A
- 5
Which task most clearly requires extending a model's capabilities?
- A
Summarizing a paragraph already included in the conversation
- B
Multiplying two numbers that appear in the prompt
- C
Rephrasing a sentence without changing its meaning
- D
Retrieving the current time when the model's knowledge is stale
Correct answer
DRetrieving the current time when the model's knowledge is stale
Explanation
If the model's knowledge is stale and its parameters are frozen, it cannot independently know a newly available current time or other fresh information. An external function can retrieve it.
- A
- 6
Why might an agent use a calculator for a computation a language model can do?
- A
Searching for a private user preference unavailable in the prompt
- B
Changing an external account by submitting a transaction
- C
Using a calculator to multiply two large numbers quickly
- D
Retrieving a current event that occurred after the model's training
Correct answer
CUsing a calculator to multiply two large numbers quickly
Explanation
A calculator can perform exact computation rapidly, while asking a language model to reason through a large multiplication may take longer and be less reliable.
- A
- 7
What is a key benefit of searching for current information?
- A
It permanently updates the model's parameters with each result
- B
It guarantees that the model will interpret every source correctly
- C
It removes the need for the model to generate a response
- D
It provides fresh evidence on which to ground an answer
Correct answer
DIt provides fresh evidence on which to ground an answer
Explanation
Retrieving current information supplies fresh evidence that can ground an answer, rather than relying only on potentially outdated information encoded in the model.
- A
- 8
How can a tool provide access to a user's private state?
- A
Preventing the model from personalizing its responses
- B
Replacing all user information with general training data
- C
Providing user-specific information that can inform a response
- D
Restricting the model to facts visible in its original parameters
Correct answer
CProviding user-specific information that can inform a response
Explanation
Tools can expose private state, such as information about a user, allowing the model to tailor its response based on that information.
- A
- 9
What does it mean for a tool to let an agent act on an external environment?
- A
They prevent the model from interacting with outside systems
- B
They only provide new wording for the model's response
- C
They convert the model's output into additional training data
- D
They allow the agent to make changes in an external environment
Correct answer
DThey allow the agent to make changes in an external environment
Explanation
Some tools let an agent act on an external environment, for example by browsing or calling an API to make a change rather than merely describing one.
- A
- 10
How can an agentic loop produce an ordinary textual response?
- A
The agent can provide text only after all tools have been removed
- B
Text responses must always be generated by a browser tool
- C
The agent can use a finish tool or end the loop without another tool call
- D
The agent must call a calculator before responding in text
Correct answer
CThe agent can use a finish tool or end the loop without another tool call
Explanation
An agent may use a finish tool to signal that it is done and provide text, or the loop may end when the agent chooses not to call another tool.
- A
- 11
What is the basic pattern of retrieval-augmented generation?
- A
Train a new model for every question and avoid retrieving context
- B
Convert the question into code and return only its execution result
- C
Generate an answer first and retrieve information only to store it
- D
Retrieve relevant information and generate an answer based on it
Correct answer
DRetrieve relevant information and generate an answer based on it
Explanation
Retrieval-augmented generation retrieves relevant context and then generates an answer based on it. The content presents this pattern as broadly normal in modern chat applications.
- A
- 12
What is a distinctive feature of image-generation tool use?
- A
It uses only the user's exact words and cannot modify the prompt
- B
It is simply another name for executing Python code
- C
It retrieves images but cannot generate new ones
- D
It produces images and may use an expanded prompt from the model
Correct answer
DIt produces images and may use an expanded prompt from the model
Explanation
Image generation differs from text-oriented tools because it interfaces with images. The model may also expand or rewrite a user's prompt before sending it to the image-generation tool.
- A
- 13
Which example best represents a custom tool?
- A
They replace all APIs with a single fixed calculator function
- B
They can implement application-specific actions such as creating a grocery cart
- C
They restrict agents to the standard tools built into every model
- D
They are used only to generate text without interacting with services
Correct answer
BThey can implement application-specific actions such as creating a grocery cart
Explanation
Custom functions can connect a model to application-specific actions, such as creating a grocery cart and calling a shopping service API.
- A
- 14
What feature was used to characterize ChatGPT as an agent?
- A
It makes iterative tool calls as part of answering queries
- B
It has a larger vocabulary than a conventional language model
- C
It has a chat interface, regardless of whether it uses tools
- D
It always displays its internal reasoning to the user
Correct answer
AIt makes iterative tool calls as part of answering queries
Explanation
The lecture's definition of an agent emphasizes iterative tool calls used to answer queries, rather than only producing a one-time textual response.
- A
- 15
Why can code be viewed as a meta tool?
- A
Code can compose tool calls and control flow, so it acts as a meta tool
- B
Code is less expressive than choosing one API from a fixed list
- C
Code prevents the agent from using external libraries
- D
Code is merely another name for a single fixed API function
Correct answer
ACode can compose tool calls and control flow, so it acts as a meta tool
Explanation
A fixed list of APIs lets an agent call individual functions, while code can compose function calls into a larger program with control flow, making it a meta tool.
- A
- 16
What makes a program a richer way to use tools than a sequence of isolated calls?
- A
Programs consist only of a sequence of unrelated text responses
- B
Programs can call functions but cannot express repetition
- C
Programs can compose function calls and include loops or other control flow
- D
Programs can express control flow but cannot call functions
Correct answer
CPrograms can compose function calls and include loops or other control flow
Explanation
Programs represent computations through composed function calls and can also include loops and other control flow. This makes them more expressive than isolated API calls.
- A
- 17
How can code expand the set of tools available to an agent?
- A
It prevents functions from being combined into larger tasks
- B
It automatically gives the model access to every installed library
- C
It can use external libraries and developer-written utility functions
- D
It removes the need to define or register any callable functions
Correct answer
CIt can use external libraries and developer-written utility functions
Explanation
Code can bring in external libraries, exposing many additional functions, and developers can also write utility functions for specialized tasks.
- A
- 18
Why could code improve a task involving comparing smartphone prices across countries?
- A
It requires the model to make every API call in a separate agent turn
- B
It eliminates the need to obtain any prices or exchange rates
- C
It can combine the required lookups and calculations into one program
- D
It guarantees that the cheapest country will be selected without data
Correct answer
CIt can combine the required lookups and calculations into one program
Explanation
A program can perform a multi-step task, such as checking country-specific prices and exchange rates, in one program instead of requiring a repeated sequence of separate tool interactions.
- A
- 19
What results were reported for the CodeAct approach?
- A
It increased success rates and reduced average interaction turns
- B
It removed the need to execute or validate tool calls
- C
It improved only tasks that were already programming problems
- D
It increased interaction turns while leaving success unchanged
Correct answer
AIt increased success rates and reduced average interaction turns
Explanation
The CodeAct results described in the content showed higher success rates and fewer average interaction turns, including on tasks traditionally treated as ordinary tool-use tasks.
- A
- 20
What execution risk can result from giving an agent the ability to write loops?
- A
Loops force all tool calls to run in parallel
- B
Loops prevent programs from calling functions
- C
Variables make every program impossible to execute
- D
A program may enter an infinite loop and fail to terminate
Correct answer
DA program may enter an infinite loop and fail to terminate
Explanation
An agent that can write loops may create an infinite loop. A system therefore needs a way to detect or contain nonterminating execution.
- A
- 21
Why can allowing an agent to import libraries create a security risk?
- A
External libraries cannot affect the security of an agent
- B
A compromised dependency may compromise the agent and its system
- C
Using libraries guarantees that an agent uses less CPU
- D
A library automatically prevents malicious code from running
Correct answer
BA compromised dependency may compromise the agent and its system
Explanation
A compromised library can compromise the agent that imports it and potentially the larger system. Library versions and security therefore need careful attention.
- A
- 22
Why can programmatic tool calling be harder to constrain?
- A
A broad action space makes predictable behavior harder to ensure
- B
Code prevents developers from validating tool outputs
- C
Programmatic calls always have fewer possible actions than APIs
- D
Programs cannot express actions beyond a fixed list of tools
Correct answer
AA broad action space makes predictable behavior harder to ensure
Explanation
Programmatic tool use gives an agent a broad action space, which makes its behavior harder to constrain, validate, and predict.
- A
- 23
What resource-related risk comes with powerful code execution?
- A
It always uses fewer resources than a direct API call
- B
It may use substantial memory, disk space, or CPU
- C
It can only consume network bandwidth
- D
It cannot affect system resources if its output is text
Correct answer
BIt may use substantial memory, disk space, or CPU
Explanation
Running agent-generated code can consume memory, disk space, and CPU, so it can have a higher impact than calling a narrowly scoped tool.
- A
- 24
What safety measure becomes important when agents can execute programs?
- A
A larger prompt window
- B
A system that permanently updates model parameters
- C
A requirement that every tool return an image
- D
A sandbox or other mechanism to contain execution
Correct answer
DA sandbox or other mechanism to contain execution
Explanation
Because code can take powerful actions and consume resources, programmatic tool use calls for containment measures such as sandboxes.
- A
- 25
Which statement best captures the trade-off of programmatic tool calling?
- A
It is always safer than individual tools because it uses fewer calls
- B
It improves performance only by permanently changing the model
- C
It offers no efficiency benefit and has no special risks
- D
It offers expressive composition but also broadens the agent's risks
Correct answer
DIt offers expressive composition but also broadens the agent's risks
Explanation
Code can be more expressive and efficient than calling many separate tools, but its broad capabilities also increase security, resource, and predictability risks.
- A
- 26
How can text and tool calls appear in the same model output?
- A
A tool call is always hidden outside the model's output
- B
Ordinary text is generated only after all tool calls are deleted
- C
A single output may include both a user-facing message and a tool call
- D
A model output must contain either text or a tool call, never both
Correct answer
CA single output may include both a user-facing message and a tool call
Explanation
A model output can contain ordinary text and a tool call in the same completion. The text can address the user while the tool-call portion specifies an action.
- A
- 27
How are tool calls commonly represented in a model's generated output?
- A
They are stored only in the model's parameters and never output
- B
They are produced by converting each response into an image
- C
They are always inferred from the meaning of ordinary prose
- D
They are expressed using tokens that represent a tool call
Correct answer
DThey are expressed using tokens that represent a tool call
Explanation
Tool calls are represented in the model's output using tokens in a tool-call format, rather than being ordinary text continuations alone.
- A
- 28
What can a ReAct-style model completion contain?
- A
The model sends only a tool call and cannot address the user
- B
The user-facing message replaces the need to invoke tools
- C
One completion can contain both user-facing text and the tool call
- D
The tool call is produced only by a separate human operator
Correct answer
COne completion can contain both user-facing text and the tool call
Explanation
In the described ReAct-style arrangement, a completion can include a message to the user as well as the actual tool call, rather than expressing the loop only as separate external code.
- A
- 29
Which components may appear in a reasoning model's output when it uses tools?
- A
Only visible reasoning followed by a final answer
- B
A tool result, a system prompt, and a training-data update
- C
A user-facing message, a browser history, and a new model
- D
Private thinking, a user-facing message, and a tool call
Correct answer
DPrivate thinking, a user-facing message, and a tool call
Explanation
Reasoning models may produce verbose thinking that is not shown to the user, a less verbose user-facing message, and the actual tool call.
- A
- 30
When are tool-call formats commonly introduced into a model's training?
- A
They are added only when the model executes its first API call
- B
They must be present in every document used for pre-training
- C
They are commonly introduced during mid-training
- D
They can only be introduced after reinforcement learning
Correct answer
CThey are commonly introduced during mid-training
Explanation
Tool-call tokens do not necessarily need to be present during pre-training on the internet. They are commonly introduced during mid-training on data in the desired format.
- A
- 31
What does a chat template do?
- A
It converts structured chat messages into a model-specific token format
- B
It validates the external API's credentials before generation
- C
It translates tool results into natural-language explanations automatically
- D
It makes different models use identical tool-call tokens
Correct answer
AIt converts structured chat messages into a model-specific token format
Explanation
A chat template converts structured messages, such as system, user, and assistant messages, into the special-token format expected by a particular model.
- A
- 32
What information can a tool definition provide to a model?
- A
It specifies the model's hidden reasoning process
- B
It contains only the tool's user-facing description
- C
It describes the function and its parameter names, types, and requirements
- D
It contains the result of the tool before the tool is called
Correct answer
CIt describes the function and its parameter names, types, and requirements
Explanation
A tool definition can specify the function name and parameters, including their types and which are required. This schema can be included in the model request.
- A
- 33
What should developers do when fine-tuning a model that already has a tool-call format?
- A
Match the tool-call format the model was trained to use
- B
Use a different format for every tool in the same request
- C
Remove the tool schema so the model can infer all parameters
- D
Replace its format with any other model's format
Correct answer
AMatch the tool-call format the model was trained to use
Explanation
When an already-trained model is fine-tuned to use tools, the tool-call format should match the format it was trained to use; otherwise, it is being asked to produce an unfamiliar format.
- A
- 34
Why can tool-call parsing code for one model fail on another model?
- A
All models use the same format but different API names
- B
Model-specific tool formats may require model-specific parsing
- C
A model's tool-call format is determined by the user's query
- D
Formats differ only when a model does not support JSON
Correct answer
BModel-specific tool formats may require model-specific parsing
Explanation
Different models may use different formats for tool calls, so parsing code for one model's format cannot simply be assumed to work with another's.
- A
- 35
How does a model-specific chat-template function help with tool use?
- A
It replaces the need to register tools in the agent
- B
It makes all models share one identical set of parameters
- C
It converts every REST API into a local Python function
- D
It applies the message and tool format expected by the chosen model
Correct answer
DIt applies the message and tool format expected by the chosen model
Explanation
A chat-template function applies the formatting expected by the specific model being used, helping ensure that prompts and tool calls match that model's conventions.
- A
- 36
How does an agent framework typically connect a tool name to executable code?
- A
It maps each registered tool name to an implementation
- B
It asks the model to implement every tool from scratch
- C
It assigns each tool a random name at execution time
- D
It stores only the tool's output and discards its implementation
Correct answer
AIt maps each registered tool name to an implementation
Explanation
A typical agent framework registers tools by name and associates each name with an implementation, such as a Python or TypeScript function.
- A
- 37
Which sequence describes a typical tool-call runtime process?
- A
Validate the user request, then skip the tool implementation
- B
Execute the call first, then decide which tool name it meant
- C
Parse the call, look up and validate the tool, execute it, and return an observation
- D
Return the model's arguments without checking or executing them
Correct answer
CParse the call, look up and validate the tool, execute it, and return an observation
Explanation
At runtime, the system parses the call, looks up the selected tool, validates the arguments, executes the tool, and returns an observation.
- A
- 38
What is a tool-call validation error?
- A
The model's parameters are updated during execution
- B
The model's response contains user-facing text
- C
The tool returns a successful observation
- D
The call fails the checks applied to the tool or its arguments
Correct answer
DThe call fails the checks applied to the tool or its arguments
Explanation
A validation error occurs when the tool call itself is invalid, such as when the model selects an inappropriate tool or provides arguments that do not pass validation.
- A
- 39
Which situation is an execution error rather than a validation error?
- A
A model outputs a well-formed call with no arguments
- B
A call passes initial checks but fails during execution
- C
A tool name cannot be found in the registration map
- D
A result is returned with the correct call ID
Correct answer
BA call passes initial checks but fails during execution
Explanation
A tool call may pass initial validation but fail when run. For example, a Python tool may accept a string as code even though executing that code raises an error.
- A
- 40
What is the purpose of assigning IDs to tool calls?
- A
It replaces the tool name in the request
- B
It specifies the tool's JSON schema
- C
It records the model's training format
- D
It matches a tool result to its corresponding call
Correct answer
DIt matches a tool result to its corresponding call
Explanation
A call ID links a tool result to the particular tool call that produced it. This is especially useful when several tools are called in parallel.
- A
- 41
Why is it important to preserve a matching result for each tool call?
- A
A missing result automatically changes the model's tool format
- B
Tool results must always be included before the tool call
- C
Some systems reject histories with a tool call but no matching result
- D
Call IDs are invalid whenever tools are run sequentially
Correct answer
CSome systems reject histories with a tool call but no matching result
Explanation
Some systems reject a conversation history that includes a tool call without its corresponding result. If a process fails before writing the result, resuming with that incomplete history can cause an error.
- A
- 42
Which set of properties captures key structural constraints on tool calls?
- A
A valid tool name, a short response, and an image attachment
- B
Valid syntax, required fields, and appropriate types or values
- C
A correct model, a complete prompt, and a current timestamp
- D
A user-facing message, an API key, and a successful retry
Correct answer
BValid syntax, required fields, and appropriate types or values
Explanation
Well-formed tool calls need valid syntax, the expected shape or required fields, and appropriate types and values such as valid units.
- A
- 43
What does syntax validation check?
- A
Whether a tool is appropriate for the user's goal
- B
Whether a tool's result is factually accurate
- C
Whether the output follows valid syntax, such as valid JSON
- D
Whether a function call is faster than a different call
Correct answer
CWhether the output follows valid syntax, such as valid JSON
Explanation
Syntax validation checks whether the output can be parsed in its required format, such as whether a JSON object has properly balanced delimiters.
- A
- 44
What does shape validation check?
- A
Whether the API server is running remotely
- B
Whether expected or required fields are present
- C
Whether the model chose the newest available tool
- D
Whether the response has fewer tokens than the prompt
Correct answer
BWhether expected or required fields are present
Explanation
Shape validation ensures the call has the expected structure and includes required fields, rather than merely being syntactically parseable.
- A
- 45
What does type validation check for a tool call?
- A
Whether the tool call is written in the model's training language
- B
Whether a parameter has the required type and permitted values
- C
Whether the requested action is completed in one agent turn
- D
Whether the model has access to the user's private state
Correct answer
BWhether a parameter has the required type and permitted values
Explanation
Type validation checks that values have the expected types, such as requiring a city parameter to be a string. Schemas may also constrain values such as units.
- A
- 46
How does JSON schema help validate tool calls?
- A
It guarantees that the requested action is semantically correct
- B
It replaces the need to parse the model's generated output
- C
It gives the model access to an API without an implementation
- D
It expresses machine-readable rules for validating call structure and values
Correct answer
DIt expresses machine-readable rules for validating call structure and values
Explanation
A JSON schema provides machine-readable rules, such as requiring a city string and limiting a units field to Celsius or Fahrenheit, so calls can be checked against them.
- A
- 47
How do regular grammars and context-free grammars differ in the described parsing approach?
- A
Finite-state automata parse context-free grammars, but not regular ones
- B
Finite-state automata parse regular grammars, but not general context-free grammars
- C
Regular grammars require a stack, while context-free grammars do not
- D
Both grammar types can only be checked after generation is complete
Correct answer
BFinite-state automata parse regular grammars, but not general context-free grammars
Explanation
Regular grammars can be recognized by finite-state automata, while JSON structures with nested brackets require the greater expressive power of context-free grammars.
- A
- 48
Why is a context-free grammar useful for expressing JSON structure?
- A
A context-free grammar can represent nested JSON structure
- B
A JSON object cannot be described using a formal grammar
- C
A regular expression can check every possible JSON schema constraint
- D
A finite-state automaton can represent any nesting depth without extra state
Correct answer
AA context-free grammar can represent nested JSON structure
Explanation
Nested JSON structures can be described using a context-free grammar, which can represent recursively structured objects and their members.
- A
- 49
What capability does a pushdown automaton add for grammar-based validation?
- A
It checks only whether the output contains legal vocabulary tokens
- B
It uses a stack to handle structures that a finite-state automaton cannot parse
- C
It removes all grammar rules and accepts any generated sequence
- D
It replaces the need for a schema with a model-generated explanation
Correct answer
BIt uses a stack to handle structures that a finite-state automaton cannot parse
Explanation
A pushdown automaton adds a stack to the finite-state approach, allowing it to handle the nested structures needed for context-free grammars.
- A
- 50
How does grammar-based constrained decoding restrict generated tokens?
- A
The model's output is rewritten after generation to match the schema
- B
Invalid next tokens are masked and probabilities are renormalized over valid ones
- C
Invalid tokens are boosted so the model can repair them later
- D
The model selects a tool only after the entire answer is generated
Correct answer
BInvalid next tokens are masked and probabilities are renormalized over valid ones
Explanation
With grammar-based constrained decoding, valid next tokens retain probability while invalid next tokens are masked, typically by assigning them negative-infinity logits, then probabilities are normalized over valid tokens.
- A
- 51
How can a constrained decoder handle different kinds of token validity?
- A
Every token is treated as valid until a parser reports an error
- B
All token validity is computed after generation is complete
- C
Always-valid or invalid cases may be precomputed; context-dependent cases are checked during generation
- D
Only the first token is checked against the grammar
Correct answer
CAlways-valid or invalid cases may be precomputed; context-dependent cases are checked during generation
Explanation
Some token validity can be precomputed because tokens are always valid or invalid; validity that depends on the current parsing or stack context must be determined during generation.
- A
- 52
How can a tool call remain incomplete despite grammar-based constrained decoding?
- A
The output contains more than one valid tool call
- B
The tool call uses a string parameter
- C
The token limit is reached before the output reaches a final valid state
- D
The JSON schema contains an optional field
Correct answer
CThe token limit is reached before the output reaches a final valid state
Explanation
Constrained decoding cannot complete a valid structure if generation stops because the output-token limit is reached before the grammar reaches an accepting final state.
- A
- 53
What is a key limitation of grammar-based constrained decoding?
- A
A valid JSON call cannot contain incorrect argument values
- B
Grammar constraints always guarantee correct program behavior
- C
Structural validity does not guarantee semantic correctness
- D
Constrained decoding prevents tools from returning errors
Correct answer
CStructural validity does not guarantee semantic correctness
Explanation
Grammar constraints ensure that output follows the specified structure, but they do not establish that the program or action is logically correct. Syntactically valid Python can still be wrong.
- A
- 54
What is a REST API used for in the described tool-use setting?
- A
A local-only method for executing Python libraries
- B
A model-training format for encoding private reasoning
- C
A grammar that validates nested JSON output
- D
A common interface for interacting with web services
Correct answer
DA common interface for interacting with web services
Explanation
A REST API is a common way to interact with web services. A client can send a request to the service, which then performs the requested operation.
- A
- 55
What is a benefit of using FastAPI to expose a tool?
- A
It converts any model into a secure, sandboxed execution environment
- B
It can expose Python functions as APIs and provide their schemas
- C
It replaces the need for authentication on a web service
- D
It makes every API call asynchronous without additional code
Correct answer
BIt can expose Python functions as APIs and provide their schemas
Explanation
FastAPI can expose Python functions as web endpoints, support API-key validation, and provide a JSON schema that can be supplied to a model.
- A
- 56
Why might a service require an API key?
- A
It allows the service to reject callers without appropriate credentials
- B
It converts the tool's output into a chat template
- C
It ensures that every generated call uses valid JSON
- D
It guarantees that the model selects the correct tool
Correct answer
AIt allows the service to reject callers without appropriate credentials
Explanation
An API key can be required so that requests without appropriate credentials are blocked. This is useful for restricting access to a service or personal data.
- A
- 57
How can a JSON schema from an API help an agent use that API?
- A
It automatically teaches the model to execute arbitrary programs
- B
It contains the service's secret credentials for the model
- C
It prevents the API from being called remotely
- D
It can describe the API's permitted calls in machine-readable form
Correct answer
DIt can describe the API's permitted calls in machine-readable form
Explanation
A FastAPI-generated schema can describe an API's permitted calls in machine-readable form, and that schema can be provided to a language model.
- A
- 58
How could a coding agent with Bash access call a REST API?
- A
By converting the REST API into a context-free grammar
- B
By embedding its API key in the model's parameters
- C
By replacing the API server with a chat template
- D
By using a command such as curl from Bash
Correct answer
DBy using a command such as curl from Bash
Explanation
A coding agent with access to Bash can use a command such as curl to call a REST API directly.
- A
- 59
What security benefit can MCP provide compared with giving an agent an upstream API key?
- A
It can keep upstream credentials on the MCP server and give the agent a separate key
- B
It encrypts all tool results so the agent cannot read them
- C
It gives the agent direct access to every upstream secret
- D
It removes authentication from upstream APIs
Correct answer
AIt can keep upstream credentials on the MCP server and give the agent a separate key
Explanation
MCP offers a separate authentication layer: the agent receives an MCP credential for the MCP server, while the upstream service credential can remain with that server.
- A
- 60
Why is it useful to keep an upstream API key away from the agent?
- A
The agent cannot make requests when an MCP key is used
- B
A leaked agent-side key need not reveal the upstream credential
- C
The MCP server makes all upstream services public
- D
Upstream credentials are unnecessary when tools are called
Correct answer
BA leaked agent-side key need not reveal the upstream credential
Explanation
If an agent receives a powerful upstream credential, it might accidentally expose or misuse it. Keeping that credential on the MCP server reduces the harm if the agent leaks its own, more limited MCP key.
- A
- 61
How can tool discovery differ between REST APIs and MCP?
- A
REST may use an OpenAPI document, while MCP can list tools through its protocol
- B
MCP cannot describe which tools are available
- C
Both use the same discovery method and differ only in tool names
- D
REST always lists tools automatically, while MCP requires manual code
Correct answer
AREST may use an OpenAPI document, while MCP can list tools through its protocol
Explanation
For discovery, a REST-based setup may fetch an OpenAPI document, while MCP provides a specific mechanism for listing available tools.
- A
- 62
What is a basic difference between REST and MCP invocation?
- A
Both require the agent to import the same Python library
- B
REST uses only standard input/output, while MCP uses HTTP only
- C
REST uses HTTP requests, while MCP uses its own transport
- D
REST uses a model-specific token format, while MCP uses JSON schema
Correct answer
CREST uses HTTP requests, while MCP uses its own transport
Explanation
REST invocation uses HTTP requests, while MCP uses an MCP transport, which may operate through standard input/output, a socket, or another supported channel.
- A
- 63
Which additional capabilities may MCP provide?
- A
It replaces the model's need for a chat template
- B
It guarantees semantic correctness of every generated call
- C
It can also provide resources, prompts, and extensions
- D
It can only transmit API keys and tool results
Correct answer
CIt can also provide resources, prompts, and extensions
Explanation
Beyond tools, MCP can support resources, prompts, and extensions. These are additional protocol capabilities, rather than features limited to ordinary API invocation.
- A
- 64
What is the purpose of an MCP registry?
- A
It executes tool calls on behalf of every model
- B
It validates model reasoning before each API request
- C
It stores upstream API keys for all MCP clients
- D
It helps users find available MCP servers
Correct answer
DIt helps users find available MCP servers
Explanation
A registry can help users discover MCP servers that provide particular capabilities.
- A
- 65
What is parallel tool calling?
- A
It runs independent tool calls together instead of sequentially
- B
It makes every tool call depend on the previous result
- C
It combines dependent calls into one call without passing results
- D
It prevents an agent from using more than one tool per task
Correct answer
AIt runs independent tool calls together instead of sequentially
Explanation
Independent calls can be issued together, for example checking the weather, reading a calendar, and looking up flight status, instead of waiting for each call to finish before starting the next.
- A
- 66
When can tool calls safely be parallelized?
- A
Only when every call returns the same type of value
- B
Only when the calls do not depend on each other's results
- C
Whenever the calls use different tool names
- D
Whenever the tools run on separate servers
Correct answer
BOnly when the calls do not depend on each other's results
Explanation
Parallelization is appropriate when calls do not depend on each other's results. If one call needs an ID returned by another, that dependency prevents them from being run simultaneously.
- A
- 67
Which sequence should not be fully parallelized?
- A
Writing unrelated files in separate locations
- B
Viewing several independent images at the same time
- C
Finding a customer ID, fetching their orders, and refunding one
- D
Checking weather, calendar, and flight status at once
Correct answer
CFinding a customer ID, fetching their orders, and refunding one
Explanation
Finding a customer ID, using it to fetch orders, and then refunding an order forms a dependency chain: later calls need the results of earlier ones.
- A
- 68
How can a Python agent execute independent tool calls concurrently?
- A
By placing all calls inside a single JSON string
- B
By waiting for each call to finish before starting the next
- C
By launching calls concurrently and gathering their results
- D
By assigning every call the same result ID
Correct answer
CBy launching calls concurrently and gathering their results
Explanation
A system can launch multiple independent tool calls concurrently and collect their results with an asynchronous facility such as Python's asyncio.gather.
- A
- 69
How can a more expensive model be cheaper on a task-by-task basis?
- A
It may complete tasks in fewer turns or parallelize calls more effectively
- B
It always has a lower per-token price than a smaller model
- C
It uses more tokens but is automatically billed at a discount
- D
It avoids using tools and therefore never incurs API costs
Correct answer
AIt may complete tasks in fewer turns or parallelize calls more effectively
Explanation
A more expensive model may be cheaper per completed task if it solves the task in fewer turns or makes more effective parallel calls, reducing total task cost.
- A
- 70
How can reinforcement learning encourage parallel tool calling?
- A
It removes the model's ability to make multiple calls
- B
It forces all tool calls to use the same arguments
- C
It guarantees that every parallel call is independent
- D
It can reward fast completion and encourage parallel calls
Correct answer
DIt can reward fast completion and encourage parallel calls
Explanation
Reinforcement learning can reward finishing tasks quickly. A strong penalty for lengthy execution can incentivize models to make independent tool calls in parallel.
- A
- 71
How did the Berkeley Function Calling Leaderboard's coverage evolve?
- A
It tests model pre-training but not tool-use behavior
- B
It expanded from single-turn calls to multi-turn, agentic, and robustness measures
- C
It evaluates only the speed of REST API servers
- D
It measures only end-to-end coding-agent performance
Correct answer
BIt expanded from single-turn calls to multi-turn, agentic, and robustness measures
Explanation
The Berkeley Function Calling Leaderboard developed from single-turn tool calling toward measuring multi-turn tool calling, tool-calling agents, and robustness.
- A
- 72
Which issues are measured as aspects of tool-calling robustness?
- A
The model's ability to generate images from text
- B
Argument hallucination and sensitivity to formatting
- C
The time required to train the model from scratch
- D
The number of libraries installed on the inference server
Correct answer
BArgument hallucination and sensitivity to formatting
Explanation
Tool-calling robustness measures include whether a model hallucinates arguments and whether its performance is sensitive to the tool-call format.
- A
- 73
What are two basic dimensions for evaluating a model's tool calls?
- A
Whether it chose the appropriate tool and supplied correct arguments
- B
Whether the user has previously used the same chat interface
- C
Whether the model's training corpus contained the API documentation
- D
Whether the tool's source code uses a particular programming language
Correct answer
AWhether it chose the appropriate tool and supplied correct arguments
Explanation
Evaluating a tool-use stack can include checking whether the model selected an appropriate tool and supplied the right argument values.
- A
- 74
What additional dimensions matter when evaluating agentic tool calling?
- A
Whether the model uses the newest chat template
- B
Whether calls occurred in the right order and the task succeeded
- C
Whether the user saw every internal reasoning token
- D
Whether each tool has the same response length
Correct answer
BWhether calls occurred in the right order and the task succeeded
Explanation
For agentic tool use, evaluation can check whether tools were called in the right order and whether the complete task was ultimately successful.
- A
- 75
Which measures are relevant to tool-use efficiency?
- A
The number of available API schemas and model parameters
- B
The number of users who have called the tool
- C
The length of the tool's implementation and documentation
- D
Time to solve, token use, and cost
Correct answer
DTime to solve, token use, and cost
Explanation
Efficiency can be measured by how quickly a task is solved, how many tokens it takes, and how much it costs.
- A
- 76
Which behavior is relevant to evaluating tool-use reliability?
- A
Whether the model can produce a longer answer after a timeout
- B
Whether it handles timeouts and unavailable tools appropriately
- C
Whether the agent has access to more training examples
- D
Whether every tool call uses a different transport
Correct answer
BWhether it handles timeouts and unavailable tools appropriately
Explanation
Reliability evaluation can test whether the agent retries appropriately after a timeout or selects an alternative tool when a tool is unavailable.
- A
- 77
What does safety evaluation of tool use examine?
- A
Whether it can always call every available tool
- B
Whether it selects the most expensive model
- C
Whether it minimizes the number of schema fields
- D
Whether it resists adversarial or inappropriate tool use
Correct answer
DWhether it resists adversarial or inappropriate tool use
Explanation
Safety evaluation can test how the system responds to adversarial outputs or requests that try to make it use a tool in an inappropriate way.
- A
- 78
What did the provider-comparison benchmark demonstrate?
- A
Tool-call error rates depend only on the user's question
- B
Different model sizes always produce identical error rates
- C
The same model can have different tool-call error rates by provider
- D
The benchmark changes the user's tool schema for each provider
Correct answer
CThe same model can have different tool-call error rates by provider
Explanation
The provider comparison varies who serves the same model. It illustrates that tool-call error rates can differ substantially across inference providers.
- A
- 79
How can quantization contribute to differences in tool-call error rates?
- A
Quantization determines whether the user has an API key
- B
Different quantization levels can affect tool-call reliability
- C
FP4 always preserves the exact behavior of an uncompressed model
- D
Quantization changes only the names of available tools
Correct answer
BDifferent quantization levels can affect tool-call reliability
Explanation
Serving differences can include quantization. Heavy compression, such as some FP4 quantizations compared with FP8, may result in worse tool-call performance.
- A
- 80
How might speculative decoding affect tool-call reliability?
- A
A cheaper draft model guarantees fewer tool-call errors
- B
Lossless speculative decoding changes the model's intended output
- C
Speculative decoding always requires changing the tool schema
- D
Lossy speculative decoding may change outputs and affect reliability
Correct answer
DLossy speculative decoding may change outputs and affect reliability
Explanation
Lossless speculative decoding should not change the underlying model results, but a lossy variant could affect outputs and therefore tool-call reliability.
- A
- 81
Why can different providers have different tool-call error rates for the same model?
- A
Constraint decoding affects only user-facing prose, not tool calls
- B
They all use identical decoding algorithms for the same model
- C
Providers cannot alter inference or decoding behavior
- D
They may use different constraint-decoding algorithms or support
Correct answer
DThey may use different constraint-decoding algorithms or support
Explanation
Providers may differ in whether they use grammar-based constrained decoding and how they implement it. Without such constraints, the system relies more heavily on the model to produce valid calls.
- A
- 82
What is a non-model reason that a tool call might fail?
- A
The inference provider may be unavailable or unreliable
- B
The model has not been given a sufficiently long prompt
- C
The tool's schema contains a required field
- D
The API uses a different function name from the model
Correct answer
AThe inference provider may be unavailable or unreliable
Explanation
A provider can have outages or other reliability problems, causing a tool call to fail even when the model's generated call is otherwise correct.
- A
- 83
Which description best summarizes the layered structure of tool use?
- A
Tools add capabilities, while schemas, validation, dispatch, and result matching coordinate their use
- B
Call IDs replace the need for validation and tool implementations
- C
Tools replace models, schemas, and runtime execution systems
- D
Schemas execute tools, while models only display their results
Correct answer
ATools add capabilities, while schemas, validation, dispatch, and result matching coordinate their use
Explanation
Tool use is layered: tools provide capabilities, schemas describe calls, the model emits them, and the system validates and dispatches them while matching results to call IDs.
- A

Ask anything
We've read this whole study set, so questions about it get the best answers.