Tool use lets an AI system invoke external software while solving a task. Instead of only answering questions, an agent can call APIs, query databases, and trigger workflows such as checking an order or processing a cancellation. section 10.6.1
An agent alternates between conversation, reasoning, and tool calls. It identifies missing inputs, asks the user for them, selects the next tool, supplies its parameters, and turns returned data into a useful response. section 10.6.4
Checking an order
Alice asks for an order update using her name and purchase date. The agent requests her email and birth date, calls retrieve_user_id, calls get_order_id with the returned user ID and purchase date, then calls get_order_status. It reports that order 101 has shipped, provides the tracking number, and gives the expected delivery date. section 10.6.4
Listing 10.12 An agentic graph.py
from langgraph.checkpoint.memory import MemorySaver
from langgraph.graph import START, StateGraph, MessagesState
from langgraph.prebuilt import tools_condition, ToolNode
from langchain_core.documents import Document
from langchain_core.messages import HumanMessage, SystemMessage
from prompts import *
from tools import tools
...
class SupportAgentGraph:
...
def build_graph(self):
...
builder.add_node("tools", ToolNode(tools))...
builder.add_edge("augment", "assistant")
builder.add_conditional_edges("assistant", tools_condition)
builder.add_edge("tools", "assistant")
return builder.compile(checkpointer=memory)
...
A LangGraph implementation represents tool use as a graph: an assistant node decides whether a call is needed, a conditional edge routes tool calls to a tools node, and the result returns to the assistant. section 10.6.4












