Skip to main content

Someone wanted to learn this too, so Grasp built them a personal learning path.

You can keep exploring this one or create your own

Understanding Agentic Systems: The PRAM Framework

Introduction

Welcome to the second module of our course, "Mental Models for Agentic Systems." In the previous module, we established the foundational concepts of LLMs, culminating in a framework for deciding the appropriate level of automation for a given business task. We moved from the binary distinction of tool vs. agent to a nuanced spectrum of autonomy.

Now, we transition from what level of autonomy is needed to how to architect the systems that deliver it. This lesson introduces the single most important mental model for this task: the perception-reasoning-action-memory framework. This is a classic concept from AI, but it takes on new depth and significance in the context of LLM-based agents.

Your learning outcome for this lesson is to analyze agentic systems using the perception-reasoning-action-memory framework. By the end of this lesson, you will be able to deconstruct any agentic system into these four fundamental components, understand how they interrelate, and use this blueprint to reason about system design.

The Need for a Cognitive Architecture

As agentic systems become more complex—incorporating planning, tool use, and memory—our mental models for them must also evolve. Simply thinking of an agent as "an LLM with a prompt" is insufficient. We need a more structured, architectural approach to manage this complexity.

Cognitive Architectures for Language Agents

To begin, let's watch a brief segment from a presentation by LangChain on Cognitive Architectures. The speakers draw a compelling analogy between the current 'explosion of concepts' in agent design and the early days of digital circuits, arguing for the need for a standardized architecture, much like the Von Neumann architecture organized computer design.

Watch the segment from 06:41 to 09:27. Focus on the core argument: why do we need a high-level architecture to make sense of complex language agents?

This idea of a "cognitive architecture" provides the conceptual scaffolding we need. It allows us to move beyond ad-hoc designs and toward a principled, component-based approach. The most influential of these architectures is built around four key functions.

The Four Pillars of an Agentic System

At its core, any intelligent agent, whether biological or artificial, can be described by a continuous loop of four activities:

  1. Perception: The agent gathers information from its environment. This includes user inputs, data from sensors, files, API call results, and its own internal memories.
  2. Reasoning: The agent processes the perceived information to make a decision. This is the "thinking" part, where the LLM's capabilities are leveraged to break down problems, form plans, and choose the next step.
  3. Action: The agent acts upon its environment. This could be sending a message, calling a tool, writing to a database, or even updating its own internal state.
  4. Memory: The agent stores and retrieves information, allowing it to learn from past experiences and maintain context over time, overcoming the inherent statelessness of individual LLM calls.

This cycle is often called the perception-action loop, with reasoning and memory as the critical internal processes that guide it.

AI Agent Architecture: Perception-Planning-Action Loop
A high-level view of an agentic system. The agent perceives the environment, uses planning (reasoning), memory, and tools to decide on an action, and then executes that action, which in turn changes the environment, starting the cycle anew. (Source: Lilian Weng)

A Formal Framework: Cognitive Architectures for Language Agents (CoALA)

To move from a high-level concept to a rigorous engineering framework, we'll ground our discussion in a key academic paper that formalizes this architecture for LLM-based agents. The CoALA (Cognitive Architectures for Language Agents) framework provides a precise vocabulary for our four pillars.

Cognitive Architectures for Language Agents

The paper 'Cognitive Architectures for Language Agents' provides the formal structure we need. We'll read the introduction and the core section that lays out the CoALA framework.

First, please read the 'Abstract' and Section 1, 'Introduction'. This will provide context on why a formal framework like CoALA is necessary. Then, read the beginning of Section 4, up to (but not including) Section 4.1 'Memory'. Focus on how CoALA organizes agents along three dimensions: memory, action space, and a decision-making procedure.

CoALA organizes agent capabilities in a way that maps directly onto our perception-reasoning-action-memory model:

  • Memory: CoALA proposes a modular memory system.
  • Action Space: CoALA divides actions into internal (manipulating memory) and external (interacting with the world). This covers both Action and Perception.
  • Decision-Making: CoALA defines a cyclical process for choosing actions, which is the formalization of Reasoning.

Let's use this formal structure to dissect each component.

Agent Architecture and Planning Process
Diagrams from the CoALA paper. On the left (A), the detailed agent architecture showing various memory modules and their connections to the decision process. On the right (B), the simplified decision cycle: Planning (Proposal, Evaluation, Selection) leads to Execution.

Deep Dive into the CoALA Components

We'll now examine each part of the framework in detail, using the precise language from the CoALA paper. This will equip you to analyze systems with academic and engineering rigor.

1. Memory

Memory is what transforms a stateless LLM into a stateful agent. CoALA identifies several distinct memory modules, each with different architectural implications.

Cognitive Architectures for Language Agents

Now, let's explore the different types of memory an agent can possess. Please read the section of the CoALA paper detailing the memory modules.

Read Section 4.1 'Memory'. Pay close attention to the distinct roles of working, episodic, semantic, and procedural memory.

Let's summarize these from a system design perspective:

  • Working Memory: This is the agent's "RAM" or scratchpad—the information currently active for a decision. In practice, this is often managed by the agent's orchestration code and assembled into the LLM's context window for each call.
  • Long-Term Memory:
    • Episodic Memory: Stores the agent's experiences—a log of past actions, observations, and outcomes. Architecturally, this maps to a trajectory store, which could be a simple log file or a dedicated database. It's the source for reflection and learning from failure.
    • Semantic Memory: Stores factual knowledge about the world. This is the "second brain" you provide to an agent. Architecturally, this is almost always implemented using a vector database as part of a Retrieval-Augmented Generation (RAG) system.
    • Procedural Memory: Stores the agent's skills or capabilities. This is the agent's toolset. Architecturally, this is your code library of functions, API definitions, and the prompts that describe them to the LLM.

2. Action Space (Perception and Action)

The action space defines everything an agent can do. CoALA makes a critical distinction between actions that change the outside world and those that change the agent's internal state.

Cognitive Architectures for Language Agents

An agent's capabilities are defined by its action space. Let's examine how CoALA categorizes these actions.

Please read sections 4.2 through 4.5. These cover: Grounding actions (external) Retrieval actions (internal) Reasoning actions (internal) Learning actions (internal)

  • External Actions (Grounding): This is how the agent interacts with the outside world. This single category elegantly covers both Perception and Action.

    • Action: The agent executes a tool call (e.g., search_api('agentic AI')).
    • Perception: The agent receives the return value of that tool call (e.g., a list of search results). The grounding procedure is responsible for processing this environmental feedback into the agent's working memory.
  • Internal Actions: These are operations the agent performs on itself.

    • Reasoning: Manipulating information in working memory (e.g., summarizing a long text before storing it).
    • Retrieval: Reading from long-term memory into working memory (e.g., performing a vector search).
    • Learning: Writing to long-term memory (e.g., reflecting on a failure and storing the lesson in semantic memory).

3. Decision Making (Reasoning)

This is the core loop, the "CPU" of the agent, that orchestrates all other components. It's how the agent decides which action to take from its available space.

Cognitive Architectures for Language Agents

Finally, let's look at the decision-making process that ties everything together. This is the agent's core reasoning loop.

Read Section 4.6 'Decision making'. Focus on the two main stages: Planning and Execution. Note the sub-stages of planning: Proposal, Evaluation, and Selection.

The CoALA decision cycle is a loop of Planning and Execution:

  1. Planning: The agent uses internal actions (reasoning, retrieval) to decide on a course of action. This is not a single step but a process:
    • Proposal: Generate one or more candidate actions (e.g., "I could search the web" or "I could ask the user for clarification").
    • Evaluation: Assess the value of each candidate action (e.g., "Searching the web is likely to give me the answer").
    • Selection: Choose the best action to execute.
  2. Execution: The agent executes the selected action, which must be either a grounding (external) or learning (internal write to long-term memory) action. The result of this execution becomes a new perception, and the cycle repeats.

This plan-execute cycle is the formal structure behind agentic reasoning patterns like ReAct (Reason+Act) and more complex ones like Tree of Thoughts.

Application: Analyzing Agents with the CoALA Framework

The true power of this framework lies in its ability to deconstruct and compare different agent architectures.

Cognitive Architectures for Language Agents

Let's see how the CoALA framework can be used to analyze well-known agent systems like ReAct and Voyager.

Please read Section 5 'Case Studies'. You don't need to know the details of every agent mentioned, but focus on how the authors use the CoALA components (Memory, Grounding, Internal Actions, Decision Making) to create a concise 'spec sheet' for each one in Table 2. This is a direct application of today's learning outcome.

As the case studies show, you can characterize any agent by asking:

  • Memory: What kind of long-term memory does it have (if any)? Episodic, semantic, procedural?
  • Action Space: What are its external (grounding) and internal (reasoning, retrieval, learning) capabilities?
  • Decision Making: How complex is its reasoning? Does it simply propose one action (like ReAct), or does it have a more elaborate multi-step evaluation and selection process (like Tree of Thoughts)?

This analytical process is fundamental to both understanding existing systems and designing new ones.

A Practical Walkthrough

Let's ground this theory with a concrete example. The Stanford lecture video provides a simple travel agent scenario that illustrates the perception-reasoning-action-memory loop clearly.

Stanford CS230 | Autumn 2025 | Lecture 8: Agents, Prompts, and RAG

This clip from a Stanford lecture walks through a travel booking agent, showing the plan-execute cycle in action.

Watch the segment from 01:17:49 to 01:19:39.

Let's break down the travel agent using our framework:

  1. Perception: The agent receives the user's query: "plan a trip to Paris...".
  2. Reasoning (Planning): The agent decomposes the task into a multi-step plan: find flights, search hotels, generate itinerary, validate preferences, book trip. This is the proposal stage.
  3. Action & Perception Loop: The agent begins to execute the plan.
    • Action: It calls the flight_search_api (a grounding action).
    • Perception: It receives the flight options.
    • (The loop continues for hotels, etc.)
  4. Reasoning (Interaction): The agent might then reason that it needs more information and decides to act.
    • Action: It sends a message to the user: "Here is a proposal. Please validate." (a grounding action).
    • Perception: It receives the user's validation.
  5. Memory (Learning): After the interaction, the agent executes a learning action. It reflects on the interaction ("the user only likes direct flights") and writes this new knowledge to its long-term semantic memory to improve future performance.

Conclusion

Today, we've established the perception-reasoning-action-memory framework as the essential blueprint for designing and analyzing agentic systems. By using the formal vocabulary of the CoALA framework—memory modules, internal/external actions, and the decision-making cycle—we can move from vague ideas to structured architectural plans.

Key Takeaways:

  • Agentic systems are not monolithic; they are composed of distinct perception, reasoning, action, and memory components.
  • The CoALA framework provides a rigorous, engineering-focused language to describe these components: a modular memory system, a structured action space, and a cyclical decision-making process.
  • An agent's action space includes external grounding actions (interacting with the world) and internal actions like reasoning, retrieval, and learning.
  • The core of an agent is its decision-making loop, which follows a plan-execute cycle to choose and perform actions.
  • This framework is a powerful analytical tool that allows you to deconstruct any agent and understand its capabilities and limitations.

Preview of the Next Lesson:

Now that we have the universal technical blueprint for an agent, our next lesson will introduce a complementary organizational mental model: the 'agent-as-employee'. We will use this model to scope an agent's role, responsibilities, knowledge, and escalation pathways, translating business needs into the components of the architecture you learned today.

Can't find a good explanation? Sign up and we'll make it for you

Sign up