Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 1

AI Agent Architecture: Core Components

Recommended resources

Introduction

Welcome to the first lesson of your journey into building AI agents for project finance. The goal of this course is to equip you with the practical skills to design and implement sophisticated agentic systems for tasks across the entire project finance lifecycle.

Before we can start building, we need to establish a solid conceptual foundation. Think of it like this: you wouldn't start architecting a complex software system without first understanding the roles of a database, a server, and a client. Similarly, to build effective AI agents, we must first deconstruct them into their fundamental components.

This lesson addresses the first learning outcome of the course: Deconstruct the core components of an AI agent: LLM, memory, planning, and tools. We will explore the purpose of each component and how they work together to transform a simple Large Language Model (LLM) into a powerful system that can reason, strategize, and interact with the world to achieve complex goals.


What is an AI Agent?

At its core, an AI agent is a system that can autonomously pursue a goal. This distinguishes it from a simple LLM application, like a chatbot, which primarily responds to one-off prompts. An agent engages in a continuous loop: it reasons about what to do, acts on that reasoning (often using a tool), observes the result, and then repeats this cycle until the goal is accomplished.

To get a clear picture of this distinction, let's watch a brief introductory video.

AI Agents in 38 Minutes - Complete Course from Beginner to Pro

This video from Marina Wyss provides an excellent contrast between a standard LLM prompt and an iterative, agentic workflow. It introduces the core 'Reason-Act-Observe' loop that defines an agent.

Please watch the segment from 01:09 to 02:55. Focus on how the essay-writing example illustrates the difference between a single-pass generation and a multi-step, iterative process.

This iterative process allows agents to tackle complex, multi-step tasks that are impossible for a single LLM prompt, such as conducting due diligence, analyzing a portfolio, or monitoring market data for investment opportunities—all tasks central to your goal.


The Core Components of an AI Agent

Now, let's deconstruct the architecture of a typical AI agent. While implementations vary, they are generally built around four key components. This diagram provides a high-level overview of how they fit together.

AI Agent Architecture Overview
This diagram illustrates the four primary components of an AI agent. The **LLM** acts as the central brain. It uses **Planning** to create a strategy, **Tools** to interact with the external world, and **Memory** to maintain context and learn. The agent performs an **Action** based on its plan, and the cycle repeats.

We will now examine each of these components in detail:

  1. The LLM (The Brain): The reasoning engine.
  2. Tools (The Hands): The interface to the outside world.
  3. Planning (The Strategy): The ability to formulate a multi-step approach.
  4. Memory (The Notebook): The capacity to retain and recall information.

To provide a comprehensive overview before we dive into each part, the following article offers a clear and practical breakdown of a real-world agent architecture.

How AI Agents Work: Planning, Memory, Tools, Safety & ...

The article 'How AI Agents Work' by Robi Kumar Tomar provides a practical, no-hype overview of the agent architecture used in enterprise systems. It clearly defines the core components and their functions.

Please read sections 1 through 4, titled 'What Exactly Is an AI Agent?', 'Why Agents Matter', 'Agent Architecture', and 'The 5 Core Components of a Real AI Agent'. This will give you a strong conceptual map of the components we're about to discuss in detail. Estimated reading time is about 3-4 minutes.

1. The LLM: The Agent's Brain

The Large Language Model is the central coordinator of the agent. It serves as the reasoning engine that drives all operations. Given a user's goal, the LLM is responsible for:

  • Understanding the objective.
  • Making decisions about the next steps.
  • Choosing the appropriate tool for a given step.
  • Interpreting the results returned by a tool.
  • Synthesizing information to generate the final response.

A crucial concept to grasp is that the LLM does not execute code or perform actions directly. It is a text-generation model. It achieves action by outputting a specifically formatted text that requests a function call. Your application code then intercepts this request, runs the actual function (the "tool"), and feeds the result back to the LLM as new context for its next reasoning step.

2. Tools: The Agent's Hands and Senses

Tools are what give an agent capabilities beyond text generation. They are functions or APIs that allow the agent to interact with the external world, access information, and perform computations. Without tools, an LLM is a closed system; with tools, it can become a powerful actor in a digital environment.

For your goal of building agents for project finance, tools are indispensable. Examples include:

  • A web_search tool to find news on regulatory changes in Sub-Saharan Africa.
  • An api_caller to fetch real-time FX rates from a financial data provider.
  • A database_querier to pull historical performance data for a solar project in your portfolio.
  • A code_interpreter to run a Python script that calculates the Net Present Value (NPV) of a project.

The following video segment explains this concept of tool use very clearly.

AI Agents in 38 Minutes - Complete Course from Beginner to Pro

This segment from the 'AI Agents in 38 Minutes' video details how agents use tools. Pay close attention to the explanation of how an LLM requests a function call rather than executing it directly.

Please watch from 13:50 to 16:50. Focus on the loop: User Prompt -> LLM decides to use a tool -> LLM outputs a request -> Your code executes the tool -> Result is fed back to the LLM.

3. Planning: The Agent's Strategy

For any non-trivial task, an agent needs a plan. Planning is the process where the LLM breaks down a complex goal into a sequence of smaller, manageable sub-tasks. This is a significant step-up from simply reacting to a prompt; it involves foresight and strategy.

For instance, if you ask an agent to "Evaluate the default risk of the offtaker for project X," a good planner would decompose this into steps like:

  1. Identify the offtaker entity from the project documents.
  2. Use a search tool to find recent credit reports for this entity.
  3. Use another tool to analyze recent news for any negative sentiment.
  4. Query an internal database for payment history if available.
  5. Synthesize the findings into a risk assessment summary.

This dynamic planning is what allows agents to handle novel and complex situations that haven't been explicitly scripted. The following article provides a good overview of different planning techniques.

LLM Agents

The 'LLM Agents' article on Prompting Guide AI gives a structured explanation of the Planning and Memory components. It's a bit more technical, which should align well with your CS background.

Please read the sections titled 'Planning' and 'Memory'. In the 'Planning' section, note the distinction between 'Planning Without Feedback' (like Chain of Thought) and 'Planning With Feedback' (like ReAct, which we will implement in a future lesson).

4. Memory: The Agent's Notebook

Memory is what allows an agent to maintain context, learn from its actions, and perform complex tasks that require information to be carried across multiple steps. Without memory, every interaction would be stateless, and the agent couldn't handle anything more complex than a single tool call.

We typically distinguish between two types of memory:

  • Short-Term Memory: This holds the context for the current task. It includes the initial user request, the sequence of actions taken so far, the observations from those actions, and any intermediate results or "scratchpad" thoughts. This is often managed within the context window of the LLM.
  • Long-Term Memory: This allows an agent to retain and recall information over extended periods and across different tasks. It's the agent's knowledge base. This is commonly implemented using Retrieval-Augmented Generation (RAG), where information (like past project finance deals, legal document templates, or market reports) is stored in a vector database. We will dedicate a future lesson to building this.

This final short video clip provides a concise summary of how memory functions within an agent.

What Are AI Agents Really About?

The ByteByteGo channel offers a clear and concise explanation of an agent's core capabilities, including persistent memory.

Watch the segment from 00:53 to 02:30. Pay attention to how it describes persistent memory and the role of vector databases, which directly relates to the concept of long-term memory.

Test your understanding!

Imagine you task an agent with the following goal: "Generate a preliminary risk summary for a new 15MW C&I solar project in Vietnam, considering both market and political risks."

Based on the four components we've discussed, deconstruct how the agent would approach this task. Briefly describe:

  1. The high-level Plan the agent might create.
  2. The Tools it would likely need.
  3. How it would use Short-Term and Long-Term Memory.
Show answer
  1. Plan: The agent's LLM (brain) might formulate a plan like this:

    • Step 1: Search for recent reports on Vietnam's renewable energy policies and feed-in tariffs.
    • Step 2: Search for political risk analysis for Vietnam from sources like the World Bank or economic intelligence units.
    • Step 3: Access a data service to get current and historical data on local electricity prices and currency (VND/USD) volatility.
    • Step 4: Synthesize the collected information from steps 1-3 into a structured summary covering regulatory, political, and currency risks.
  2. Tools: To execute this plan, the agent would need tools such as:

    • web_search: To find policy documents and news articles.
    • financial_data_api: To fetch market data like electricity prices and FX rates.
    • document_retriever: To search its long-term memory for relevant past analyses.
  3. Memory:

    • Short-Term Memory: Would be used to store the results of each tool call in the current session. For example, it would hold the text from the policy reports found in Step 1 and the political risk analysis from Step 2, so they can be synthesized together in Step 4.
    • Long-Term Memory: The agent could query its long-term memory (a vector database) with the query "risks of Vietnamese solar projects." This might retrieve internal memos or summaries from previous, similar deals your firm has analyzed, providing valuable proprietary context that isn't available on the public web.

Conclusion

In this lesson, we have deconstructed the AI agent into its four essential components. You should now have a clear mental model of how these parts function and interact:

  • The LLM acts as the central reasoning brain.
  • Tools provide the hands and senses to interact with the world.
  • Planning gives the agent a strategy to tackle complex goals.
  • Memory serves as the notebook, providing context and persistent knowledge.

Understanding this architecture is the critical first step. It provides the blueprint we will follow as we begin to build and assemble these components into functional systems for project finance.

In our next lesson, we will move from theory to practice. You will build your first simple agent, connecting to an LLM API and implementing a "tool" that it can call. This will be your first hands-on experience bringing an agent to life.