1 Understanding agentic applications
This chapter introduces agentic applications as systems that wrap large language models with tools, memory, retrieval, and reasoning loops so they can pursue goals across multiple steps rather than simply generate a single text response. It distinguishes fully autonomous agents, where the model decides what to do and when to stop, from agentic workflows, where developers define the main execution path while allowing LLM-powered steps inside it. The central message is to use autonomy deliberately: workflows are often more predictable and production-ready, while full agents are best reserved for open-ended tasks where the steps cannot be known in advance.
The chapter explains the augmented LLM as the foundation of agentic systems: a model enhanced with retrieval, tool use, and memory. Function calling is presented as the mechanism that lets an LLM request external actions, such as querying a database or calling an API, while the application code actually executes the tool and returns the result. It also introduces common design patterns for agentic applications, including prompt chaining, routing, parallelization, orchestrator-worker structures, and evaluator-optimizer loops. These patterns can be combined, but the chapter emphasizes choosing the simplest effective architecture before adding more agents or autonomy.
The chapter then outlines the practical challenges of building reliable agentic systems: errors compound across multiple steps, token costs can rise quickly, evaluation is harder than traditional testing, human oversight is necessary for consequential actions, and long context windows can degrade model performance. CrewAI is introduced as the framework used throughout the book, built around agents, tasks, tools, crews, and flows. Agents are specialized personas defined by role, goal, and backstory; tasks describe the work and expected outputs; tools let agents act; crews coordinate multiple agents; and flows provide controlled workflow logic. The chapter closes by positioning MCP as a standard way for agentic applications to connect with external tools and the broader AI ecosystem.
At the heart of each AI agent is the agent loop, in which the LLM reasons, calls tools at will, and decides when to stop.
In an agentic workflow, the system follows code paths that were pre-defined by the developer. Those steps can include arbitrary logic expressed in code, LLM calls, as well as dynamic routing based on the results of a previous step.
The application sends the user's prompt along with tool definitions to the LLM. Instead of answering directly, the LLM returns a structured tool call. The application + executes the tool and sends the result back, and the LLM produces its final response. The LLM never executes tools itself — it only requests them.
Each agent is initialized with a role, goal, and a compelling backstory.
The documentation writer agent has a well-defined role, a clearly laid out goal, and a compelling backstory. It has access to three tools: one to search the web for a specific query, one to summarize a snippet of text, and one to format any given text as markdown to create a nice document.
A crew is like a cross-functional team that works on a given set of tasks until they are completed.
An example flow that generates a book based on a topic that is given as input and returns a link to a generated PDF in the end. It contains two crews that are being executed in two different steps of the workflow, a shared state, parallel execution, and dynamic routing based on the output of a crew.
Summary
- Agentic AI turns a model that predicts text into a system that gets work done. An AI agent reasons, calls tools, observes results, and loops until the task is complete. Agentic workflows follow developer-defined code paths and trade flexibility for predictability.
- The augmented LLM is the atomic building block of every agentic system: a language model enhanced with retrieval, tools, and memory.
- Five recurring design patterns cover most agentic architectures: prompt chaining, routing, parallelization, orchestrator-workers, and evaluator-optimizer. They sit on a spectrum from simple to complex, and real applications often combine several.
- Production agentic systems face compounding errors across steps, high token costs, non-deterministic evaluation, the need for human oversight, and context degradation over long interactions.
- CrewAI organizes agentic systems around agents (defined by role, goal, and backstory), tasks, tools, crews, and flows. Crews handle multi-agent collaboration, while flows give explicit control over execution order and logic. MCP connects agents to external capabilities through a standardized protocol.
FAQ
What is agentic AI?
Agentic AI refers to AI systems that augment large language models (LLMs) with tools, retrieval, memory, and autonomous reasoning. Instead of responding once to a prompt and stopping, an agentic system can reason about what to do next, call tools, observe the results, and repeat until the task is complete.
How is an AI agent different from a regular LLM?
A regular LLM primarily predicts and generates text from a prompt. An AI agent wraps an LLM in additional logic and tooling so it can pursue goals, choose actions, invoke tools, inspect results, and decide when the work is finished. The core difference is that an agent operates in a reasoning-and-action loop rather than a single prompt-response exchange.
What is the difference between AI agents and agentic workflows?
An AI agent dynamically directs its own reasoning loop: it decides which tools to call, what steps to take, and when to stop. An agentic workflow follows logic defined in advance by a developer, often as a graph of nodes and edges. Workflows can still include LLM calls and dynamic routing, but they trade some autonomy for better predictability and control.
When should I use a workflow instead of a fully autonomous agent?
You should start with a workflow when the sequence of steps is mostly predictable, such as classifying an email, drafting a response, and sending it. Fully autonomous agents are better suited to tasks where the steps cannot be known in advance, such as open-ended research or complex debugging. The chapter recommends starting with workflows and adding autonomy only where it clearly pays off.
What is an augmented LLM?
An augmented LLM is a language model enhanced with three key capabilities: retrieval, tools, and memory. Retrieval lets it access external knowledge, tools let it take actions such as calling APIs or querying databases, and memory lets it maintain state across steps or conversations. The chapter describes the augmented LLM as the atomic building block of agentic systems.
How does function calling work in agentic applications?
Function calling allows an LLM to request the use of a tool by emitting a structured tool call with arguments. The LLM does not execute the tool itself. Instead, the developer’s application code receives the tool call, runs the actual function or API, sends the result back to the LLM, and then the LLM continues reasoning or produces a final answer.
What are the main patterns for building agentic applications?
The chapter introduces several common agentic design patterns: prompt chaining, routing, parallelization, orchestrator-workers, and evaluator-optimizer. Prompt chaining breaks work into sequential LLM calls; routing sends inputs to specialized handlers; parallelization runs multiple calls at once; orchestrator-workers uses a central LLM to delegate tasks; and evaluator-optimizer uses feedback loops to improve output quality.
Why are agentic applications difficult to run reliably in production?
Agentic applications are difficult because errors compound across multiple steps, token costs can grow quickly, evaluation is less straightforward than traditional unit testing, human oversight is often required for risky actions, and context quality degrades as the context window fills up. These challenges make careful design, monitoring, and guardrails essential.
What are the core building blocks of CrewAI?
CrewAI provides composable primitives for building agentic systems: agents, tasks, tools, crews, and flows. Agents are specialized AI personas, tasks define what needs to be done and what success looks like, tools let agents interact with the outside world, crews coordinate multiple agents, and flows provide explicit workflow control with logic, state, routing, and error handling.
What is MCP and how does it relate to CrewAI?
MCP, or Model Context Protocol, is an open standard for connecting AI systems to external tools and capabilities in a consistent way. It acts like a universal plug for AI tools. CrewAI supports MCP in both directions: CrewAI agents can consume tools from external MCP servers, and CrewAI crews can be exposed as MCP servers for other AI systems to call.
Building Agentic Applications with CrewAI and MCP ebook for free