Hello! Welcome to the first lesson in our new module, Foundations of AI Agents.
In the previous module, we mastered the art of fine-tuning. We took general-purpose Large Language Models and specialized them, making them experts on specific tasks and significantly improving their performance. You now have the skills to create a powerful, knowledgeable model.
But what happens when a task requires more than just generating text based on internal knowledge? What if you need to find the current price of a stock, check the weather, query a production database, or book a meeting in a calendar? A standalone LLM, no matter how well-trained, is isolated from the real world. It can't do things.
This is where AI agents come in. This module is about giving models the ability to act. We'll transform our LLMs from know-it-alls into do-it-alls. Our learning outcome for this first lesson is to describe the core components of an AI agent: reasoning, planning, and action. We'll build a conceptual blueprint of an agent that will serve as the foundation for the practical implementations in the lessons to follow.
From Chatbot to Agent: What's the Difference?
At a high level, an AI agent is a system that uses an LLM as its core "brain" to autonomously pursue goals. Unlike a simple chatbot that just responds to prompts, an agent can create a multi-step plan, interact with external systems, and adapt its approach based on new information.
The key differentiators are:
- Autonomy: Agents can initiate actions to achieve a goal without constant human supervision.
- Goal-Orientation: They work towards a defined outcome, not just a conversational reply.
- Interaction: They can use "tools" (like APIs or code interpreters) to act in an environment.
This diagram provides a great visual model of an agent's fundamental operating loop.

Let's make this concrete with an example.
Task: "Book me a table for two at a well-rated Italian restaurant near me for 8 PM tonight."
- A chatbot's response would be passive: "You can find Italian restaurants on Google Maps or Yelp and use their reservation systems to book a table."
- An agent's response would be active:
- "Okay, I need to find your current location." (Action: Use a location API)
- "Searching for Italian restaurants near you with a rating of 4 stars or higher." (Action: Use a maps/review API)
- "I found three options: 'La Trattoria', 'Bella Roma', and 'Vino e Pasta'. 'Bella Roma' has the best reviews. It is available at 8 PM." (Reasoning: Compares options)
- "Shall I go ahead and book the table at 'Bella Roma'?" (Waits for user confirmation)
- "Confirmed. Booking a table for two at 'Bella Roma' for 8 PM." (Action: Use a reservation API)
- "Your table is booked. I've sent a confirmation to your calendar." (Action: Use a calendar API)
This ability to reason, plan, and execute a sequence of actions is what makes agents so powerful.
The Core Components of an Agent's Architecture
Modern AI agents are typically built with a modular design. While implementations vary, they almost always include four key components that work together. The following article provides a great overview of this architecture.
LLM Agent Architecture: A Complete Guide
The article "LLM Agent Architecture: A Complete Guide" from Leanware provides a clear breakdown of the essential modules that make up an AI agent. We'll use it to explore each component.
Please read the section Core Components of LLM Agent Architecture and its four subsections: Agent Core or Brain Memory Modules Planning Mechanisms Tool Use and Integration As you read, focus on the primary role each component plays in the overall system.
Now, let's unpack these four components, which form the anatomy of an agent.
1. Reasoning (The Agent's "Brain")
The Agent Core or "brain" is the central processing unit of the agent. It's powered by an LLM. This is where the "thinking" happens. The reasoning component is responsible for:
- Understanding the Goal: Interpreting the user's request, even if it's complex or ambiguous.
- Making Decisions: Evaluating the current situation and deciding what to do next. Should it ask a clarifying question? Use a tool? Or provide a final answer?
- Synthesizing Information: Taking the results from tool use (e.g., data from an API call) and integrating them into its working context to inform the next step.
As you saw in the reading, this isn't just a simple prompt-response loop. It's an iterative cycle of perception, reasoning, and action, with the LLM orchestrating the entire process.

2. Planning
A Planning Mechanism allows the agent to break down a complex, high-level goal into a sequence of smaller, manageable steps. Without a plan, an agent would act impulsively and would likely fail at any task requiring more than one step.
For our restaurant booking example, the plan might look like this:
- Step 1: Get user's location.
- Step 2: Search for nearby, highly-rated Italian restaurants.
- Step 3: Check availability for the top-rated restaurant.
- Step 4: Confirm with the user before booking.
- Step 5: Execute the booking.
- Step 6: Confirm the result to the user.
Planning makes the agent's behavior more reliable and also more interpretable. As a developer, you can inspect the plan before the agent executes it, which is crucial for debugging and building trust in the system.
3. Action (Tool Use)
The Action component is what connects the agent's brain to the outside world. It's the agent's "hands." Actions are performed by using tools. In the context of AI agents, a tool is anything that allows the agent to interact with an external system. As a backend developer, you can think of these as functions or API endpoints that the LLM can decide to call.
Common tools include:
- API Clients: For interacting with web services (e.g., weather, stocks, travel).
- Database Connectors: For executing SQL queries to retrieve or store data.
- Code Interpreters: A sandboxed environment (often Python) where the agent can run code to perform calculations, analyze data, or manipulate files.
- Web Browsers: For scraping information from websites.
The reasoning component decides which tool to use and with what arguments, and the action component executes it. We will dive deep into the practical implementation of this in our next lesson.
4. Memory
Finally, Memory is what allows an agent to maintain context, learn from experience, and perform consistently over time. Without it, every interaction would be stateless and isolated.
As the reading pointed out, memory comes in two main forms:
- Short-Term Memory: This is the agent's working memory for the current task. It's typically managed within the LLM's context window and holds the conversation history, recent tool outputs, and the current plan.
- Long-Term Memory: This allows the agent to retain information across sessions. It's where the agent stores past conversations, user preferences, or successful solutions to problems. This is often implemented using a vector database, a concept you'll recognize from our RAG module, where past experiences can be retrieved based on semantic similarity.
Putting It All Together: A Virtuous Cycle
These four components don't operate in isolation. They form a powerful, synergistic loop.
Reasoning, Memory, and the Core Capabilities of Agentic AI
The article 'Reasoning, Memory, and the Core Capabilities of Agentic AI' provides an excellent summary of how these components form a virtuous cycle.
Please read the section titled The Anatomy of an Agent: Core Capabilities. Focus on the introductory paragraph and the bulleted list summarizing Reasoning, Planning, Memory, and Tool Use. Notice the description of how these pillars 'form a synergistic system'.
As the article highlights, the cycle works like this:
- Reasoning and Memory inform Planning.
- Planning coordinates Tool Use (Action).
- The results of Tool Use populate Memory.
This creates a continuous loop of learning and improvement, where the agent gets smarter and more effective with each task it performs.
Test your understanding!
An AI agent is given the goal: "Summarize today's top 3 news headlines about the tech industry and email the summary to my team."
Briefly describe the role each of the four core components (Reasoning, Planning, Action, Memory) would play in achieving this goal.
Show answer
- Reasoning: The LLM brain would interpret the goal. It would decide what "today," "top headlines," and "tech industry" mean. It would also orchestrate the overall process, deciding when to search, when to summarize, and when to email.
- Planning: The agent would break the goal into a sequence of steps:
- Search for today's tech news headlines.
- Select the top 3 most relevant headlines.
- Read the content of those articles.
- Summarize the key points.
- Retrieve the team's email addresses.
- Compose and send the email with the summary.
- Action (Tool Use): The agent would use several tools to execute the plan:
- A web search tool (like a Google Search API) to find the news headlines.
- A web scraping tool to read the content of the articles.
- An email tool (like a Gmail API) to send the final summary.
- Memory:
- Short-term memory would hold the headlines and article content during the summarization process.
- Long-term memory might be used to retrieve the list of team email addresses, which were stored from a previous request.
Conclusion
In this lesson, we established the conceptual blueprint for an AI agent. We moved beyond the idea of an LLM as a simple text generator and reframed it as the core reasoning engine in a larger, more capable system.
Key Takeaways:
- An AI agent is an autonomous, goal-oriented system that can interact with its environment.
- The core components of an agent are a Reasoning engine (the LLM brain), a Planning mechanism to create step-by-step strategies, and the ability to take Action through tools.
- Memory (both short-term and long-term) is a crucial enabling component that provides context and allows the agent to learn from experience.
- These components work in a synergistic cycle: reasoning informs planning, planning coordinates action, and the results of actions are stored in memory to improve future reasoning.
What's Next?
We've covered the "what" and "why" of agent architecture. In the next lesson, we'll get practical and start building the "how." We will focus on the Action component and learn to implement function calling, the primary technique that allows an LLM to gain access to and use external tools. You'll write code that gives a model its first real-world capability.