Tool Use in Language Model Agents
- 86Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
86 questions
- 1An interface through which a language model can invoke an external computer program is called a_____.
Hint
Think of the connection between a model and an outside program.
Answer
tool
Explanation
A tool is an interface that lets a language model invoke an external computer program.
- 2Because a language model is fundamentally a_____, it cannot independently invoke external programs.
Hint
Recall the basic operation of a language model.
Answer
token predicting machine
Explanation
A language model predicts tokens, so it cannot independently perform external actions such as retrieving live data.
- 3Giving a model abilities that are outside its own action space is the benefit called_____.
Hint
This benefit expands what the model is capable of doing.
Answer
extending the ability of language models
Explanation
This benefit gives a model access to abilities outside its own action space, such as accessing external information or taking actions.
- 4Using a tool to make an activity easier even though the model could perform it itself is called_____.
Hint
This benefit makes a possible task easier rather than adding a fundamentally new ability.
Answer
facilitating the language model
Explanation
Facilitation delegates something the model could do itself to a tool that can do it more easily or efficiently.
- 5If a model's parameters are_____and its information is months old, it cannot learn the current time without an external function.
Hint
The parameters are not being updated with new information during the interaction.
Answer
frozen
Explanation
If model parameters are frozen and its training information is outdated, it cannot know new facts without an external source.
- 6For exact arithmetic that a model could do slowly, a_____can often produce the result much faster.
Hint
Consider the dedicated tool for arithmetic.
Answer
calculator
Explanation
A calculator can perform arithmetic such as multiplying large numbers much faster than a language model reasoning through the calculation.
- 7Looking up current information provides_____that can ground a model's answer.
Hint
This is information that helps anchor an answer in current facts.
Answer
fresh evidence
Explanation
Retrieving current information gives the model up-to-date evidence on which to ground its response.
- 8Tools can give a model access to_____so it can respond based on information about the user.
Hint
Think of information about a particular user's situation.
Answer
private states
Explanation
Access to private states can provide information about a user so the model can tailor its response to that user's situation.
- 9Calling an API to make a change is an example of a tool affecting the model's_____.
Hint
This is the world or system outside the model that an action can affect.
Answer
external environment
Explanation
Tools can do more than retrieve information; they can also make changes outside the model, for example through browsing or an API.
- 10Tools can extend a model's capabilities by providing access to information or_____outside its own action space.
Hint
Along with information, tools can let a model do things outside itself.
Answer
actions
Explanation
Tools can give a model access to actions that are not available within its own action space.
- 11In this account, ChatGPT counts as an agent because it makes_____to answer queries.
Hint
The defining behavior involves making tool calls repeatedly as needed.
Answer
iterative tool calls
Explanation
An agent can make successive tool calls while working toward an answer, rather than only returning a single text response.
- 12An agent can represent a final textual response by calling a_____that signals it is done.
Hint
This tool indicates that no further interaction with the user is needed.
Answer
finish tool
Explanation
One way to represent a final text response in an agent loop is with a tool that signals the agent is done interacting.
- 13An alternative way to produce a final text response is to end the loop when the agent decides to_____.
Hint
The agent may finish without invoking anything external.
Answer
not call a tool
Explanation
A system can also end the agent loop when the agent decides that no tool call is necessary.
- 14Retrieving context and generating an answer based on it is known as_____.
Hint
The name combines retrieving information with generating an answer.
Answer
retrieval-augmented generation
Explanation
Retrieval-augmented generation retrieves context and then generates an answer based on that context; this pattern has become common in chat applications.
- 15Running a program to perform calculations or other computational tasks is an example of_____.
Hint
This tool runs a program supplied by the model.
Answer
code execution
Explanation
A code execution tool runs code, which is useful for calculations and other tasks that benefit from computation.
- 16Unlike text-focused tools, an image-generation tool interfaces with_____.
Hint
Consider the type of content produced by the generator.
Answer
images
Explanation
Image generation differs from many other tools because its output interfaces with images rather than primarily with text.
- 17Before calling an image-generation API, a language model may_____to give the generator more detail.
Hint
The model may make the original request more detailed before passing it on.
Answer
expand the query
Explanation
A model may elaborate on a user's prompt before sending it to an image-generation API, so the API receives a more detailed query.
- 18A function that creates a grocery cart through an Instacart API is an example of_____.
Hint
These are purpose-built tools for specific tasks.
Answer
custom functions
Explanation
Custom functions can connect an agent to specialized tasks, such as creating a grocery cart through an Instacart API.
- 19The tool category in which the system simply gives the user an answer is_____.
Hint
This category returns words rather than an external action or generated image.
Answer
textual responses
Explanation
A textual response is the simplest tool category: the system returns an answer in text.
- 20A broadly provided chat-interface tool for pulling information from online sources is_____.
Hint
This common tool retrieves information from online sources.
Answer
searching the web
Explanation
Web search brings information from different sources into the interaction and supports answers based on retrieved material.
- 21In the summary of tool capabilities, retrieval, execution, generation, and_____are listed as capabilities tools can add.
Hint
This is the category associated with using tools to carry out a task in an external system.
Answer
application
Explanation
The lecture describes tools as adding capabilities such as retrieval, execution, generation, and application to an agent.
- 22In a conventional tool setup, an agent may receive a list of many_____that it can invoke.
Hint
These are callable operations exposed to the agent.
Answer
API functions
Explanation
A conventional tool setup can present the agent with a list of API functions it can choose to call.
- 23With parallel tool calling, an agent can invoke_____in one step.
Hint
Parallel calling allows more than one API call at a time.
Answer
multiple APIs
Explanation
A system that supports parallel tool calling can make several API calls in a single step rather than just one.
- 24Because code can express many different operations and control flows, it can be viewed as a_____.
Hint
It can orchestrate other tools rather than merely perform one fixed operation.
Answer
meta tool
Explanation
Code is expressive enough to combine many operations and control-flow structures, so it can be viewed as a meta tool for calling other tools.
- 25Each piece of code can be expressed as a_____of function calls, along with control flow such as loops.
Hint
This is a branching structure used to represent nested function calls.
Answer
tree
Explanation
A piece of code can be represented as a tree of function calls, with loops and other control flow adding further structure.
- 26When programmatic tool calling imports reusable packages such as pandas, it gains access to_____.
Hint
These are reusable collections of code that can be imported into a program.
Answer
external libraries
Explanation
Programmatic tool calling can make functionality from external libraries available to the agent; calling pandas, for example, opens access to its tools.
- 27A system can give its agent purpose-built helper operations by adding its own_____.
Hint
These are custom helpers built for particular needs.
Answer
utility functions
Explanation
An agent system can include its own specialized helper functions in addition to functions provided by libraries.
- 28One reported result of CodeAct was an increase in task_____.
Hint
This measures how often tasks are completed successfully.
Answer
success rate
Explanation
The CodeAct results described in the lecture included an increase in success rate.
- 29Along with higher success, CodeAct reduced the_____.
Hint
This measures how many back-and-forth steps are needed on average.
Answer
average number of interaction turns
Explanation
CodeAct was reported to reduce the average number of interaction turns needed to complete a task.
- 30One risk of giving an agent code with loops is that it may create an_____.
Hint
This programming error occurs when repetition never ends.
Answer
infinite loop
Explanation
An agent with code access could generate a loop that never terminates, so the system needs a way to handle it.
- 31A cybersecurity risk arises when an agent imports a library that has been_____.
Hint
The library may have been taken over or made unsafe by an attacker.
Answer
compromised
Explanation
An agent that imports a library that has been compromised may itself be compromised, putting the larger system at risk.
- 32When an agent is allowed to execute code, a system may use a_____to contain it.
Hint
This is an isolated environment used to contain potentially risky execution.
Answer
sandbox
Explanation
A sandbox can contain an agent's programmatic activity, limiting the effects of its broad action space and resource use.
- 33Language-model tool calls are expressed in the output as_____.
Hint
These are the basic units the model predicts.
Answer
tokens
Explanation
Tool calls, like text continuations, are expressed as tokens in a model's output.
- 34A model output that contains a call such as a request to get the weather is a_____.
Hint
This kind of continuation leads to an external action rather than just prose.
Answer
tool continuation
Explanation
A text continuation might produce ordinary prose, while a tool continuation produces a structured call to a tool.
- 35In the described ReAct format, the response and tool call can be expressed as a_____.
Hint
The text and action are represented together in one model output.
Answer
single completion
Explanation
In the described ReAct representation, text and tool-call sections can be part of the same completion rather than separate code steps.
- 36Verbose reasoning that is not shown to the user may be represented by_____.
Hint
These represent internal reasoning rather than the concise message shown to the user.
Answer
thinking tokens
Explanation
Reasoning models may produce verbose thinking tokens that are not shown to the user, separately from the user-facing text and tool call.
- 37Tool-call tokens are often introduced during_____rather than during broad internet pre-training.
Hint
This training stage comes between pre-training and later training such as reinforcement learning.
Answer
mid-training
Explanation
Special tokens for tool calls are often introduced during mid-training, a stage after pre-training on broad internet data.
- 38To format messages correctly for a particular model, developers apply its_____.
Hint
This formatting pattern organizes system, user, and assistant messages for a particular model.
Answer
chat template
Explanation
A chat template converts a model's messages into the model-specific format used for inputs and outputs.
- 39A tool's parameters and their types can be described to a model using a_____.
Hint
This machine-readable structure can specify fields, types, and required values.
Answer
JSON schema
Explanation
A tool definition can describe a function's name and its parameters, including types and required fields, using a schema.
- 40Because models may use a_____, developers should not assume one parser works for every model.
Hint
The key issue is that model-specific call syntax is not universal.
Answer
different tool call format
Explanation
Models may use different formats for tool calls, so parsing code for one model may not work with another.
- 41When fine-tuning an already trained model, developers should_____it was trained on.
Hint
The model should continue using the call conventions it has learned.
Answer
match the tool call format
Explanation
Fine-tuning should preserve the format the model was already trained to use for tool calls.
- 42In an agent framework, a tool is typically_____at initialization so it can later be found by name.
Hint
This setup step makes the tool available to the framework before execution.
Answer
register
Explanation
Tools are registered during initialization so the system can later resolve a tool name to the implementation that should run.
- 43Once a tool name is resolved, the framework must_____the call to its implementation.
Hint
This means routing a call to the implementation that should handle it.
Answer
dispatch
Explanation
After resolving a tool's name, the framework dispatches the parsed arguments to the associated function or implementation.
- 44If a Python tool accepts a string but the code fails when run, the failure is an_____.
Hint
This happens after the arguments have been accepted and the tool tries to run.
Answer
execution error
Explanation
A tool call can pass validation but still fail during execution, such as when a string accepted as Python contains code that cannot run.
- 45After a tool call is executed, the returned result is provided to the agent as an_____.
Hint
This is the information returned to the agent after a tool call.
Answer
observation
Explanation
After a tool executes, the agent receives an observation from the result, whether the operation succeeds or fails.
- 46The system uses a matching_____to associate a tool result with the call that produced it.
Hint
This identifier lets the system pair a request with its response.
Answer
call ID
Explanation
A call ID links an individual tool call to its corresponding result, which is especially useful for parallel calls.
- 47If a tool call has no matching result, some systems reject the conversation as an_____.
Hint
A missing result can make the recorded sequence unacceptable to the model provider.
Answer
invalid history
Explanation
Some providers reject a conversation if it contains a tool call without a matching tool result, treating the sequence as invalid history.
- 48The constraint that a tool call must be parseable as valid JSON is a constraint on its_____.
Hint
This concerns whether the output is grammatically well-formed for its data format.
Answer
syntax
Explanation
The syntax constraint requires a tool call to be well-formed, such as valid JSON that can be parsed.
- 49Checking that all expected fields are present in a tool call is validation of its_____.
Hint
This concerns which fields and overall structure the call contains.
Answer
shape
Explanation
Shape validation checks that required or expected fields are present in the tool call.
- 50Ensuring that a city value is a string is checking the tool call's_____.
Hint
A city name, for example, should have the appropriate data kind.
Answer
types
Explanation
Type validation checks that values have the required kinds, such as a city field being a string.
- 51Machine-readable rules for required fields, data types, and allowed units can be expressed with a_____.
Hint
This describes data structure and validation requirements in a machine-readable form.
Answer
JSON schema
Explanation
A JSON schema or similar schema library can encode machine-readable rules about fields, types, and units.
- 52A regular expression can be represented as a_____.
Hint
This is the grammar class associated with regular expressions.
Answer
regular grammar
Explanation
Regular expressions can be represented by regular grammars, which can be parsed by finite-state automata.
- 53A machine that parses a regular grammar by moving among states as it reads tokens is a_____.
Hint
This machine has states but no stack.
Answer
finite state automaton
Explanation
A finite state automaton moves between states as it reads input and can recognize regular grammars.
- 54Unlike a regular grammar, a_____can represent the nested structures needed to describe JSON.
Hint
This grammar class is more expressive than regular grammars for nested structures.
Answer
context-free grammar
Explanation
JSON schema validation can be expressed with a context-free grammar, which can represent nested structures such as JSON trees.
- 55A machine that uses a stack to process a context-free grammar is a_____.
Hint
This machine uses a stack to keep track of nested structure.
Answer
pushdown automaton
Explanation
A pushdown automaton adds a stack to state-based processing, allowing it to handle context-free grammars.
- 56During constrained decoding, the logits of invalid next tokens are set to_____.
Hint
This score removes invalid tokens from consideration entirely.
Answer
negative infinity
Explanation
In grammar-constrained decoding, invalid next tokens are assigned negative-infinity logits so they cannot be selected.
- 57Even grammar-based decoding can leave a tool call incomplete if generation reaches the_____.
Hint
The output may be cut off because the model has a maximum generation length.
Answer
token limit
Explanation
A model can run out of available output tokens while still on a valid path, leaving an incomplete rather than fully formed tool call.
- 58A syntactically valid tool call does not by itself guarantee its_____.
Hint
A well-formed expression may still do the wrong thing.
Answer
semantic correctness
Explanation
Grammar-based decoding ensures that output follows a permitted structure, but it does not guarantee that the resulting program or action is logically correct.
- 59A traditional way for programs to interact with web services is through a_____.
Hint
This is a common web-service interface that uses HTTP requests.
Answer
REST API
Explanation
REST APIs are a traditional way to interact with web services by sending requests to an API server.
- 60The Python library described as a simple way to create a web API backend is_____.
Hint
This Python library helps create web APIs with relatively little code.
Answer
FastAPI
Explanation
FastAPI makes it straightforward to create a web backend and can generate a JSON schema from an API's definitions.
- 61A server can require an_____to authenticate a caller before allowing access.
Hint
This credential is supplied to prove that a caller is authorized.
Answer
API key
Explanation
An API key can authenticate callers and prevent people without the proper credentials from accessing an API.
- 62A FastAPI definition can provide a_____that a language model can use to specify allowed calls.
Hint
This format describes the API operations and their accepted arguments to a model.
Answer
JSON schema
Explanation
FastAPI can provide a JSON schema for an API, which can then be passed to a language model to describe allowed calls.
- 63A coding agent with Bash access can call a REST API directly using the_____command.
Hint
This command-line utility sends requests to web services.
Answer
curl
Explanation
The curl command can make REST API calls directly, including from a coding agent with access to Bash.
- 64The protocol introduced as a standard way to give models additional context is the_____.
Hint
The protocol's name includes the words 'Model' and 'Context'.
Answer
Model Context Protocol
Explanation
MCP is a protocol intended to provide a standard way for an application to give a model additional context and tools.
- 65The credential used to access a service such as GitHub is kept on the MCP server as the_____.
Hint
This is the credential for the service the MCP server connects to.
Answer
upstream API key
Explanation
In the MCP security pattern, the sensitive credential for a service such as GitHub is given to the MCP server rather than directly to the agent.
- 66Instead of receiving a sensitive GitHub token, the agent can receive an_____.
Hint
This credential lets the agent authenticate to the intermediary server.
Answer
MCP API key
Explanation
The agent receives an MCP API key to authenticate to the MCP server without needing the more sensitive upstream service credential.
- 67One possible way for an MCP client and server to communicate is through_____.
Hint
This transport uses a program's ordinary input and output streams.
Answer
standard IO
Explanation
MCP transport can use several methods, including standard input and output, sockets, or other mechanisms.
- 68Beyond tools, MCP can also provide_____, and extensions.
Hint
These are three additional MCP capabilities mentioned alongside tools.
Answer
resources, prompts, and extensions
Explanation
Beyond tools, MCP supports additional conveniences that include resources, prompts, and extensions.
- 69Tool calls can be executed in parallel only when they are_____.
Hint
Each call must be able to proceed without waiting for another call's output.
Answer
independent
Explanation
Tool calls can be parallelized when they do not depend on one another's results.
- 70In a sequence that fetches orders and then refunds one, the system must first find the_____.
Hint
This value must be found before it can be used to request the orders.
Answer
customer ID
Explanation
A workflow that must first find a customer ID, then use it to fetch orders, has a dependency and cannot perform those steps simultaneously.
- 71A common Python method for collecting results from multiple concurrent tool calls is_____.
Hint
This Python utility gathers the results of concurrent asynchronous operations.
Answer
asyncio.gather
Explanation
In Python, asyncio.gather can be used to await multiple asynchronous tool calls and collect their results.
- 72In agentic systems,_____models can sometimes be cheaper when cost is measured per completed task.
Hint
The paradox compares higher model price with lower cost for each completed task.
Answer
more expensive
Explanation
A more expensive model can sometimes cost less per completed task if it solves the task more quickly or uses parallel calls effectively.
- 73The lecture links recent improvements in parallel tool calling partly to_____.
Hint
This training approach can reward faster task completion.
Answer
reinforcement learning
Explanation
The lecture attributes improved parallel tool calling in part to reinforcement learning, which incentivized models to finish tasks quickly.
- 74A heavy_____on task length can encourage a model to use parallel tool calls.
Hint
This training incentive discourages unnecessarily long executions.
Answer
brevity penalty
Explanation
A strong penalty for long task execution can incentivize the model to complete work with fewer steps, including by making parallel calls.
- 75A prominent benchmark for tool calling mentioned in the lecture is the_____.
Hint
This benchmark's name begins with the university associated with Berkeley.
Answer
Berkeley Function Calling Leaderboard
Explanation
The Berkeley Function Calling Leaderboard is a prominent benchmark for assessing language-model tool calling.
- 76One robustness dimension evaluated by the function-calling benchmark is_____.
Hint
This measures how performance changes when the call representation changes.
Answer
format sensitivity
Explanation
The benchmark evaluates whether tool calling is sensitive to differences in formats, as well as robustness issues such as argument hallucination.
- 77After checking whether the model chose the appropriate tool, evaluators can check whether it supplied the right_____.
Hint
These are the values passed into the chosen function.
Answer
arguments
Explanation
Tool-call evaluation checks whether the model supplies the right values for the selected tool's inputs.
- 78When evaluating an agent's sequence of tool calls, one can check whether it performed them in the_____.
Hint
This matters when one call must happen before another.
Answer
right order
Explanation
For agentic tool calling, evaluation can check whether the model performed calls in the sequence required by their dependencies.
- 79A measure of whether the entire agentic task was completed correctly is_____.
Hint
This measures success across the whole task.
Answer
end-to-end task accuracy
Explanation
For agentic tool calling, evaluation can measure whether the complete task was correctly completed, not merely whether individual calls were well formed.
- 80Task time, token count, and cost are measures of an agent's_____.
Hint
This dimension concerns how quickly and economically the task is completed.
Answer
efficiency
Explanation
Efficiency can be measured using factors such as time to solve a task, number of tokens, and cost.
- 81Retrying after a timeout and choosing an alternative when a tool is unavailable are aspects of_____.
Hint
This dimension concerns handling failures and disruptions consistently.
Answer
reliability
Explanation
Reliability evaluation considers whether an agent handles failures appropriately, such as retrying a timed-out call or choosing another tool when one is unavailable.
- 82Checking whether a model resists adversarial requests to use tools inappropriately evaluates_____.
Hint
This dimension concerns preventing harmful or inappropriate tool use.
Answer
safety
Explanation
Safety evaluation tests whether a model avoids using tools in inappropriate ways, including in response to adversarial requests.
- 83A possible reason two providers serving the same model have different tool-call error rates is their level of_____.
Hint
This technique compresses a model's numerical representation to reduce inference costs.
Answer
quantization
Explanation
Different levels of quantization can change tool-call error rates; the lecture notes that heavily compressed FP4 models may make more mistakes than FP8 models.
- 84Speculative decoding should not change model results when it is_____.
Hint
This version of speculative decoding is designed not to change the final model results.
Answer
lossless speculative decoding
Explanation
Lossless speculative decoding should not alter the underlying model results, whereas lossy speculative decoding could produce different outputs.
- 85A provider can reduce malformed tool calls by using grammar-based_____.
Hint
This decoding approach restricts outputs to those permitted by a grammar or schema.
Answer
constraint decoding
Explanation
Providers may differ in whether they implement grammar-based constraint decoding, which can improve the likelihood of well-formed tool calls.
- 86A final, operational cause of tool-call failure is an unreliable_____.
Hint
This is the service that hosts and runs the model for the user.
Answer
inference provider
Explanation
A provider outage can cause a tool call to fail even when the model's output or the tool itself is not the underlying problem.

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