Overview

5 Expanding GenAI Capabilities with Tools and Agents

Large language models are powerful at generating and reasoning over text, but by themselves they remain limited to text-in, text-out behavior. That is often enough for tasks like summarization or translation, yet many real applications need more than answers: they need live information, actual side effects, and the ability to choose among multiple steps as conditions change. This chapter argues that the missing ingredient is action, and that GenAI systems become far more useful when they can observe the world, decide what to do, and carry out tasks rather than merely describe them.

To bridge that gap, the chapter introduces agents and tools. An agent wraps an LLM and gives it a structured loop for reasoning and acting, while tools are functions the agent can call to perform concrete jobs such as searching the web, querying a database, fetching a webpage, sending an email, or controlling a device. The agent repeatedly receives the user request, the available tools, and previous tool results, then decides whether to answer directly or invoke one or more tools. Through examples like checking live weather, sending email, and making a room comfortable for sleeping, the chapter shows how agents combine planning, tool use, and iterative feedback to solve problems that pure text generation cannot handle.

The chapter then turns to Langflow and demonstrates how to build agentic apps visually. First, it shows a simple calculator agent, where a calculator component is converted into a tool and connected to an agent so the model can solve math accurately instead of guessing. It then expands to a more ambitious travel agent that searches the web, fetches page content, and consults Wikipedia to generate historical day-trip itineraries. Finally, the chapter broadens the perspective by showing how tools can bridge external systems, how whole flows can be reused as tools, and how multiple specialized agents can coordinate like a team. The overall message is that agents extend LLMs from conversational helpers into autonomous, modular systems that can reason, act, and integrate with the real world.

The looped life of an agent: at each iteration, it decides whether to use a tool or to respond to the user.
An agent and its toolset. Each tool is described with a short piece of text.
An agent in action — thinking, calling tools, and solving the task step by step.
An agent equipped with a handy calculator in the middle of a flow in Langflow.
Anatomy of an agent in Langflow.
The calculator component will do the math for you.
Our calculator component has become a calculator tool.
An agent equipped with a tool in Langflow (left) and an example of the composite prompt sent to the LLM.
An agent with a calculator in its hands can do the math when needed.
We can maximize the boxes appearing in the answer to see what tools the agent has used and how.
The HistoryTravelBuddy™ agent turns simple prompts into happy itineraries.
A history-savvy travel agent, with the right tools at hand.
You can get your Private API Key from your free account on SerpApi.com.
The Serp Search API component lets you run live online searches.
The results of a Serp Search. Each website is a row in the output table.
The URL component can fetch the content of any webpage you like.
The Wikipedia component exports the encyclopedia entries you need.
The flow implementing HistoryTravelBuddy™, which can boast a toolset of three tools.
A child-friendly itinerary provided by HistoryTravelBuddy™ in Rome, showcasing all the behind-the-scenes tool interactions.

Summary

  • When you need an LLM to interact with the outside world—whether by fetching live data, triggering actions, or making multi-step decisions—you need agents.
  • Tools are capabilities made available to agents. Each tool performs a specific function and must include a clear, structured description for the agent to understand how and when to use it
  • The agent’s reasoning loop allows it to decide which tool to use (if any), call it with the appropriate parameters, receive the results, and continue reasoning until the task is complete.
  • In Langflow, any component can be turned into a tool by activating Tool Mode—this includes standard components like calculators, and more advanced ones like web search, URL fetchers, or Wikipedia queries. Even entire flows can be toolified and reused by other agents.

FAQ

What is an agent in GenAI?An agent is a wrapper around a large language model that gives it the ability to plan and trigger actions. The LLM remains the reasoning core, while the agent framework adds the structure needed to use tools and act on the user’s behalf.
Why aren’t LLMs alone enough for many real-world applications?LLMs are text-in, text-out systems. That works for tasks like summarizing or translating, but it is not enough when an application must fetch live data, take actions, or make decisions based on changing conditions in the real world.
What kinds of problems require tools and agents?Problems that need live information, external actions, or multi-step decision-making often require tools and agents. Examples include checking the weather in real time, sending emails, updating records, controlling devices, or planning a sequence of actions.
What is a tool in the context of GenAI?A tool is a function the agent can call to do a specific job. It takes inputs, performs an operation, and returns a result. Tools can connect to APIs, query databases, send messages, control devices, or perform calculations.
How does an agent decide whether to use a tool or answer directly?At each step, the agent receives the user request, the available tools, and any previous tool results. The LLM reasons over that context and either produces a final response or issues a tool call if it needs more information or needs to act.
What happens after an agent calls a tool?The agent executes the tool, captures the output, and feeds that output back into the LLM as part of the next prompt. The model then reasons again using the new information until it decides the task is complete.
Why are tools described as a bridge between the LLM and the real world?Tools connect the LLM’s reasoning abilities to external systems and actions. They let the model go beyond language generation and interact with databases, web services, smart devices, email systems, and other real-world resources.
Why is a calculator useful as an agent tool?LLMs can make mistakes on precise arithmetic because they predict text rather than compute exactly. A calculator tool gives the agent deterministic math capabilities, allowing it to solve calculations accurately when needed.
How does a travel agent like HistoryTravelBuddy use multiple tools?It can use a web search tool to find attractions, a URL-fetching tool to read page content, and a Wikipedia tool to retrieve historical facts. The agent combines these tool outputs to create a richer, more accurate itinerary.
What are three ways agents and tools can be expanded in real applications?They can bridge to external systems such as calendars, CRMs, or sensors; they can turn whole flows into reusable tools for other agents; and they can be organized into multi-agent systems where specialized agents manage different tasks under a coordinator.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Grokking AI Applications ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Grokking AI Applications ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Grokking AI Applications ebook for free