liveBook · Manning

Tool usage

As explained in Build Python Web Apps with Streamlit

Tool use is the capability of an AI system to invoke external software functions or services while solving a task.

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

How Build Python Web Apps with Streamlit covers it

How deep it goes
Explains the conversational sequence and graph routing, but stops short of detailing individual tool implementations.
Examples
Uses order tracking, user identification, order lookup, cancellation, tracking numbers, and a LangGraph tools node.
What it assumes
Assumes familiarity with LLM-based applications while introducing external-tool integration and graph-based workflow structure.
What you can do after
Apply it via LangGraph to build an agent that selects tools, gathers missing parameters, and processes multi-step requests.
How it connects
Connects tool use with AI agents, APIs, databases, LangChain, LangGraph, ReAct, and multi-step workflows.

Also explained in

Compare how 13 books explain tool usage →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Python Web Apps with Streamlit. The section links point to the parts of the book it draws on.