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.
Grokking AI Applications ebook for free