Module 1 · Lesson 3 · 15 min read
Agent architecture and its components
Agent Architecture and Components
Introduction
Every intelligent agent, however simple, is made of cooperating components: environment, perception, reasoning, planning, memory, tools, action and feedback. In this lesson we break the agent down into these components and see how this breakdown helps with design and debugging.
Learning objectives
- Name the eight components of agent architecture and the role of each
- Link each component to a real example from a technical support agent
- Use the architecture as a checklist for debugging an agent
- Read a Python structure that separates perception, reasoning, action and memory
Why talk about "architecture"?
As an agent grows, it becomes hard to understand as a single piece. Thinking in separate components helps you locate the fault: is the problem that the agent did not perceive the information? Or that it perceived it and reasoned badly? Or that it reasoned well but the tool failed? The CoALA framework (Cognitive Architectures for Language Agents), published in 2023, proposes a structured way to describe language agents through memory modules, an action space and a decision-making procedure. Here we use a teaching breakdown close to it.
The eight components
1. Environment
Everything outside the agent that interacts with it: the user, files, databases, application programming interfaces (APIs), and even other agents. The environment may be fully observable or partially observable; an agent rarely sees everything.
2. Perception
Turning what comes from the environment into a form the agent understands. In a language agent this usually means turning tool results, PDF files and images into text or structured data that enters the context.
3. Reasoning
The heart that decides. In modern agents it is the language model that reads the goal and context and chooses what to do. The quality of reasoning depends on the model and on the quality of the instructions and context provided.
4. Planning
Breaking the big goal into steps. It may be explicit (a written task list) or implicit (the agent decides one step per cycle). We cover this in detail in the planning module.
5. Memory
What the agent keeps: the current conversation context (short term) and lasting information about the user or the domain (long term). The memory module is dedicated to this.
6. Tools
The functions the agent can call: search, a calculator, reading a file, querying a database. Tools are the agent's "hands".
7. Action
The actual execution of a decision: calling a tool, sending a message to the user, or handing the task to another agent.
8. Feedback
The result of the action returns to the agent as a new observation: success, an error, data. Without it the agent cannot correct its course.
A practical example: a technical support agent for the university lab
A student writes: "The printer in Lab 3 is not working." Let us map what happens onto the components:
| Component | What happens |
|---|---|
| Environment | The lab ticketing system, the fault knowledge base, the student |
| Perception | Reading the message and extracting "Lab 3" and "printer" |
| Memory | Remembering that the same student reported a similar fault yesterday |
| Planning | Search the known faults, then suggest a fix, and if it fails open a ticket |
| Tools | knowledge_search and task_manager |
| Action | Calling search, then opening a ticket |
| Feedback | The ticket number or an error message from the system |
The architecture in code
The following example puts the components together in one structure in pure Python. Reasoning here is simple rules to illustrate the idea; in a real agent a language model call takes their place.
from dataclasses import dataclass, field
KB = {"printer": "Restart the printer and check the paper",
"wifi": "Sign in through the university portal"}
def knowledge_search(query):
return next((v for k, v in KB.items() if k in query), None)
def open_ticket(text):
return {"ticket_id": 1042, "text": text}
@dataclass
class Agent:
tools: dict
memory: list = field(default_factory=list) # memory
def perceive(self, raw): # perception
return raw.lower()
def reason(self, obs): # reasoning and planning
if "printer" in obs and not any(m.get("tried_kb") for m in self.memory):
return ("knowledge_search", obs)
return ("open_ticket", obs)
def act(self, decision): # action through tools
name, arg = decision
result = self.tools[name](arg)
self.memory.append({"tool": name, "result": result,
"tried_kb": name == "knowledge_search"})
return result # feedback
agent = Agent(tools={"knowledge_search": knowledge_search, "open_ticket": open_ticket})
obs = agent.perceive("Printer in lab 3 is not working")
print(agent.act(agent.reason(obs))) # first attempt: the knowledge base
print(agent.act(agent.reason(obs))) # second: open a ticketNotice how memory affected the second decision: because the agent had already tried the knowledge base, it moved on to opening a ticket instead of repeating itself.
Summary
Agent architecture divides it into components: the environment it works in, perception that turns inputs into information, reasoning and planning that decide, memory that keeps context, tools and actions that execute, and feedback that closes the loop. The CoALA framework provides an academic basis for this breakdown. Thinking in components makes design clearer and makes debugging systematic instead of guesswork.
Terms
| Term | English | Definition |
|---|---|---|
| Environment | Environment | Everything outside the agent that interacts with it: users, systems and data |
| Reasoning | Reasoning | The process of choosing the next action based on the goal and context |
| Planning | Planning | Breaking the goal into executable steps |
| Memory | Memory | The information the agent keeps across steps or sessions |
| Tool | Tool | An external function the agent calls to perform an action or fetch information |
| Partially observable | Partially Observable | An environment whose full state the agent cannot see at any moment |
Review questions
- What is the difference between perception and reasoning? Give an example of a fault in each.
- How did memory affect the technical support agent's second decision?
- Why is feedback necessary to close the loop?
- Design a components table for an agent that helps book study rooms.
References
- Cognitive Architectures for Language Agents (CoALA) arxiv.org Reviewed on 2026-11-18
- Building effective agents (Anthropic, 2024) www.anthropic.com Reviewed on 2026-11-18
