liveBook · Manning

Tool

As explained in AI Agents and Applications

A tool is an instrument or software capability that enables a person or system to perform a task, obtain information, or interact with resources.

A tool gives an AI agent a way to retrieve information or perform an action. For a travel request, an agent might use destination search and weather tools rather than rely on the LLM alone. At each step, the LLM chooses what to call; the agent executes the call, returns its result to the LLM, and may repeat the process before answering. section 1.1.3 section 11.0

To make a function callable as a tool, register its name, parameters, and description with the model. These details tell the model what the tool does and what input it needs. In LangGraph, the @tool decorator exposes them for a Python function; search_travel_info(query) then retrieves relevant destination content and returns up to four results as text. section 11.2.2

Listing 11.3 LangGraph attribute-based tool definition
@tool  #1
def search_travel_info(query: str) -> str:  #2
    """Search embedded Wikivoyage content for 
    information about destinations in England."""
    docs = ti_retriever.invoke(query)  #3
     top = docs[:4] if isinstance(docs, list) else docs  #3
    return "\n---\n".join(
    d.page_content for d in top)  #4

The listing shows the function signature, description, retriever call, and returned text that make destination search available as a tool. section 11.2.2

Tools need not be limited to retrieval. They can query customer records, send email, create tickets, or submit orders. A supervisor agent can even call specialist agents wrapped as tools. Define each agent’s scope and available tools clearly: an incorrect selection can send a request down the wrong path. section 12.4

Local search plus live weather

Keep search_travel_info as a local tool, fetch weather tools from a remote AccuWeather MCP server, and pass both into create_react_agent. The chat loop must be asynchronous. To verify the change, inspect the combined tools list, ask for weather in Penzance, and check the server output or LangSmith trace for the weather call. A plausible answer alone is not proof that the intended tool ran. section 13.4.4 section 13.4.5

How AI Agents and Applications covers it

How deep it goes
Builds from a decorated retrieval function to combined local and remote tools, including inspection of tool calls.
Examples
Uses destination search over Wikivoyage content and a remote AccuWeather tool tested with a Penzance weather question.
What it assumes
Assumes some familiarity with sourcing content for vector stores while teaching the agent’s tool-calling mechanics incrementally.
What you can do after
Build it from scratch with a decorated function, then configure a LangGraph agent with local and MCP tools and verify its calls.
How it connects
Connects tool calling to LLM decision-making, vector store retrieval, MCP servers, supervisor agents, and LangSmith traces.

Also explained in

Compare how 14 books explain tool →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents and Applications. The section links point to the parts of the book it draws on.