1. Home
  2. Explore
  3. Computer Science
  4. Tool Use in Language Model Agents

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Tool Use in Language Model Agents

  • 86Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Tool Foundations
An interface through which a language model can invoke an external computer program is called a
.

86 questions

  1. 1
    An 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.

  2. 2
    Because 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.

  3. 3
    Giving 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.

  4. 4
    Using 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.

  5. 5
    If 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.

  6. 6
    For 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.

  7. 7
    Looking 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.

  8. 8
    Tools 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.

  9. 9
    Calling 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.

  10. 10
    Tools 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.

  11. 11
    In 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.

  12. 12
    An 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.

  13. 13
    An 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.

  14. 14
    Retrieving 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.

  15. 15
    Running 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.

  16. 16
    Unlike 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.

  17. 17
    Before 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.

  18. 18
    A 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.

  19. 19
    The 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.

  20. 20
    A 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.

  21. 21
    In 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.

  22. 22
    In 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.

  23. 23
    With 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.

  24. 24
    Because 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.

  25. 25
    Each 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.

  26. 26
    When 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.

  27. 27
    A 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.

  28. 28
    One 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.

  29. 29
    Along 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.

  30. 30
    One 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.

  31. 31
    A 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.

  32. 32
    When 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.

  33. 33
    Language-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.

  34. 34
    A 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.

  35. 35
    In 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.

  36. 36
    Verbose 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.

  37. 37
    Tool-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.

  38. 38
    To 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.

  39. 39
    A 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.

  40. 40
    Because 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.

  41. 41
    When 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.

  42. 42
    In 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.

  43. 43
    Once 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.

  44. 44
    If 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.

  45. 45
    After 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.

  46. 46
    The 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.

  47. 47
    If 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.

  48. 48
    The 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.

  49. 49
    Checking 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.

  50. 50
    Ensuring 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.

  51. 51
    Machine-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.

  52. 52
    A 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.

  53. 53
    A 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.

  54. 54
    Unlike 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.

  55. 55
    A 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.

  56. 56
    During 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.

  57. 57
    Even 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.

  58. 58
    A 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.

  59. 59
    A 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.

  60. 60
    The 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.

  61. 61
    A 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.

  62. 62
    A 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.

  63. 63
    A 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.

  64. 64
    The 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.

  65. 65
    The 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.

  66. 66
    Instead 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.

  67. 67
    One 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.

  68. 68
    Beyond 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.

  69. 69
    Tool 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.

  70. 70
    In 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.

  71. 71
    A 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.

  72. 72
    In 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.

  73. 73
    The 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.

  74. 74
    A 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.

  75. 75
    A 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.

  76. 76
    One 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.

  77. 77
    After 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.

  78. 78
    When 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.

  79. 79
    A 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.

  80. 80
    Task 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.

  81. 81
    Retrying 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.

  82. 82
    Checking 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.

  83. 83
    A 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.

  84. 84
    Speculative 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.

  85. 85
    A 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.

  86. 86
    A 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.

1 of 86
Question 1 of 86

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent