Working through this module?0 of 19 done
Module 09 · Page 10 of 20 · 8 sections

AI Agents Architecture

What an agent is made of, how its planner, memory and tools fit together, and the step-by-step workflow it follows.

9.1

What is an AI Agent?

  • A system that can perceive its environment, reason, take actions using tools and learn from feedback to achieve a specific goal.
  • Unlike traditional LLMs, agents can interact with external tools, access real-time data and execute multi-step tasks.
  • Agents are goal-driven, autonomous and capable of planning, executing and adapting based on the results.
9.2

Key Components

1
Planner
Breaks down the goal into steps.
2
LLM
Reasoning and decision making.
3
Memory
Stores past interactions and context.
4
Tools
External systems (APIs, DB, search, etc.).
5
Executor
Executes the chosen actions.
6
Feedback Loop
Learns and adapts from results.
7
Guardrails
Safety, validation and error handling.
8
Observability
Logging, monitoring and evaluation.
9.3

High Level Architecture

UserGoal / query
PlannerUnderstand goal, break into steps, create plan
Agent Core
LLMReasoning & decision
MemoryShort-term / long-term
ToolsAPIs, search, DB, etc.
ExecutorCall tools, execute actions, handle errors, get results
Response to UserFinal answer, citations, intermediate steps
Feedback / learning: update memory, improve plan
9.4

1. Planner (Task Decomposition)

  1. 1Understand user intent and goal.
  2. 2Break a complex task into smaller steps.
  3. 3Decide which tools are required.
  4. 4Maintain and update the execution plan.
  5. 5Re-plan if a step fails or new information is found.
9.5

2. Memory

1
Short-term Memory
Current conversation context.
2
Long-term Memory
Past interactions and user preferences.
3
Types
Conversation history, vector memory, database.
4
Purpose
Helps maintain context across multiple steps and improves personalization and decision making.
9.6

3. Tools (External Systems)

1
Web Search
Real-time information (e.g. SerpAPI).
2
Database
Query enterprise data.
3
APIs
Call external services (e.g. weather, email).
4
Code Interpreter
Run and analyze code.
5
File System
Read and write files and documents.
6
Other Tools
Calculator, browser, custom tools.
9.7

4. Agent Workflow (Step-by-Step)

  1. 1Receive goal: the user provides a goal or query.
  2. 2Plan: break the goal into steps and create an execution plan.
  3. 3Select tool: choose the appropriate tool for the current step.
  4. 4Execute: call the tool and execute the action.
  5. 5Observe: analyze the results and update memory.
  6. 6Reflect: decide the next step (continue, re-plan or finish).
  7. 7Respond: return the final answer with citations and summary.
9.8

5. Design Considerations

  1. 1Tool selection and integration.
  2. 2Memory management and context handling.
  3. 3Error handling and self-correction.
  4. 4Security and access control.
  5. 5Monitoring, logging and evaluation.
  6. 6Human-in-the-loop for critical tasks.
  7. 7Cost optimization and latency management.
  8. 8Scalability for multi-agent systems.