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













