A stylized diagram showing an agent's layered memory system. At the center is a glowing, multi-faceted gem representing the agent's core. Around it, concentric circles indicate different memory types. The innermost circle, labeled "Working Memory (Context Window)," has a chat bubble icon. The next circle, "Episodic Memory (Interaction History)," contains a calendar or journal icon. The outermost circle, "Semantic & Structured Memory (Knowledge Base & Databases)," includes icons for stacked books (knowledge base) and a database server (databases). The entire image uses a clean, glowing blue/cyan/purple aesthetic against a dark, star-like background, consistent with the series' branding.

The Agent’s Memory

Have you ever been in a project meeting that feels like you’re stuck in a loop? You’re trying to build on last week’s decisions, but a key collaborator seems to have a fresh start every morning. You spend the first twenty minutes just re-explaining the context, the trade-offs, and the conclusions you all agreed to yesterday. It’s frustrating. You’re not just collaborating; you’re constantly performing a manual “context reload” for a human.

This experience, surprisingly, gives us a perfect window into one of the biggest challenges in building intelligent AI. An agent without memory treats every interaction as its first. It’s the difference between a conversation with a seasoned collaborator and a goldfish. It can’t recall your preferences, the context of your last request, or the results of an action it just took. This digital amnesia is the single biggest barrier that separates a clever tool from a true partner. To make that leap, our agent needs to remember. But what does that even mean for a machine?

Before we break down the layers of an agent’s memory, it’s crucial to understand a fundamental constraint of most large language models today: their APIs are stateless. This means that with each new request, the model has no inherent recollection of your previous interactions. It’s like having a conversation with a brilliant expert who has no short-term memory; every time you speak, you have to reintroduce yourself and painstakingly recount the entire conversation up to that point. The only information the model has to work with is what you provide in the current API call. This is why the entire history of a conversation, plus any other relevant documents or data, must be bundled together and sent back to the model with every single turn.

While this might sound like a significant limitation, it’s also a source of incredible control. Because we, as the system’s architects, are responsible for curating the agent’s memory for each interaction, we can be highly intentional about what it remembers. This statelessness is precisely what makes techniques for managing memory not just possible, but powerful. It forces us to build an external memory system, effectively turning a bug into a feature.

As we’ll see, an agent’s memory is not a single thing, but a layered system of recall, much like our own. We can break it down into three distinct forms: what the agent is thinking about right now (working memory), what it remembers happening (episodic memory), and what it knows about the world (semantic memory). Each of these layers comes with a fundamental trade-off that every engineer must navigate: the tension between cost, latency, and fidelity.

The Agent’s Mental Scratchpad

At the heart of any agent’s ability to “pay attention” is the context window. But before we dive in, let’s clarify a fundamental unit of measurement in this world: the token. A token isn’t quite a word; it’s the basic unit of text or code that a large language model processes. Think of them as the atoms of language for an LLM. For example, the word “unforgettable” might be split into three tokens: “un,” “forget,” and “table.” A good rule of thumb is that one token is roughly equivalent to about four characters of text. So, when we talk about a model’s “context window,” we’re talking about the total number of these tokens it can hold in its attention at any given time.

This window is the agent’s mental scratchpad, its working memory—the space where the current conversation, immediate instructions, and relevant data live. It’s what allows the agent to follow the thread of a conversation and connect one turn to the next.

With the advent of models like Gemini that boast million-token context windows, it’s tempting to see this as the ultimate solution to the memory problem. And for certain tasks, it’s a superpower. You can drop an entire codebase into the context to find a bug, analyze the full script of a movie to discuss character arcs, or sift through a massive legal document to find a specific clause. It provides a vast, temporary workspace for a single, complex analysis.

But it’s not a true long-term memory. Using a massive context window for an ongoing agentic task is like trying to have a focused conversation in a room where every previous discussion is still echoing. Stuffing it with a long, rambling chat history or slightly different versions of the same file doesn’t just increase cost and latency; it introduces noise. As researchers discovered in the “Lost in the Middle” paper, models suffer from a peculiar form of inattention—they reliably recall information at the very beginning and very end of their context window, but their performance degrades significantly when trying to access information buried in the middle. A bloated context, therefore, doesn’t just cost more; it can actively make the agent less effective by hiding the signal in the noise.

A more elegant approach is to treat the context window not as a bucket to be filled, but as a workspace to be managed. A fantastic, real-world example of this is the GEMINI.md file used by the Gemini CLI. It’s a simple markdown file that acts as a running log, a set of instructions, and a summary of the project’s state. Before starting a session, the agent can load this curated file into its context. It isn’t a raw transcript; it’s a human-and-machine-readable summary that grounds the agent in the specific task at hand, turning the context window into a persistent, but session-specific, memory space. This architectural takeaway is key: the agent’s immediate attention is a precious resource, and managing it sets the stage for more sophisticated memory systems.

The Agent’s Diary of Interactions

While working memory handles the here and now, an agent needs a way to remember the narrative of its interactions over time. What did the user ask for ten minutes ago? What was the result of that API call I made? This is the agent’s episodic memory—its personal story.

The simplest approach is a sliding window of conversation history, which leads to a kind of abrupt amnesia. A much smarter solution is the use of summarization buffers. The agent essentially keeps a diary of its interactions. As the conversation grows, a separate process recursively summarizes older parts of the dialogue. It’s like creating a “Previously on…” segment for a TV show. You don’t need every line of dialogue, just the key plot points. This can be made even more dynamic through progressive summarization, where the agent periodically re-summarizes its existing summaries to consolidate knowledge and identify higher-level themes.

But a truly intelligent agent doesn’t just record its past; it reflects on it. This is where the concept of salience comes in—the agent’s ability to determine what’s important. After an interaction, a more advanced agent can perform a self-reflection step, asking itself: “What were the key takeaways from that conversation? What new facts did I learn? What was the most important user preference revealed?” By scoring memories based on their importance, the agent can prioritize what to keep in its more detailed memory stores.

A powerful architectural pattern for this is explored in the paper “Entities as Experts,” which proposes a model with a dedicated memory for specific entities. A practical application of this is Entity Memory, where an agent is specifically tuned to extract and remember key entities—like people, project names, or locations—and their context, creating a quick-reference cache of the most important nouns in its world.

Just as important as remembering is the ability to forget. In human intelligence, forgetting is a feature, not a bug. It’s what prevents us from being overwhelmed by a lifetime of trivial details. For an agent, this is a crucial design principle. The process of recision—identifying and removing outdated or irrelevant information—is what keeps an agent’s memory relevant. If a project’s goals change, the agent doesn’t just add a new memory; it revises its understanding of the past. Designing how an agent forgets is as important as designing how it remembers.

Of course, each of these techniques lives on a spectrum of trade-offs. A highly detailed, reflective memory with entity extraction provides a rich, high-fidelity context, but every summarization and reflection step adds latency and computational cost. Deciding where to land on that spectrum—a fast agent or a thorough one—is a core design decision in building any stateful system.

Giving the Agent a Library to Read

Episodic memory gives the agent a personal history, but it doesn’t give it knowledge about the outside world. For that, we need to give it a library. This is where Retrieval-Augmented Generation, or RAG, comes in.

The technique was formally introduced in a 2020 paper, “Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks,” and it represented a major breakthrough. The core idea was elegant: combine a pre-trained generative model with an external information retriever. This hybrid approach gives the agent an open-book exam. Instead of relying solely on the information baked into its parameters during training, it can look things up in an external knowledge base at the moment it’s needed. This makes the agent’s responses more factual, verifiable, and up-to-date.

In practice, this is how it works today: as I explored in my previous series on embeddings, the process involves taking your documents, chopping them into chunks, and using an embedding model to create “meaning vectors” for each. These vectors are stored in a specialized vector database. When a user asks a question, the question itself is turned into a vector, and the database finds the chunks of text with the most similar meaning. Those chunks are then “augmented” into the context window along with the original question, giving the model the source material it needs to generate a factually grounded answer. This is the very technique I used to build my podcast RAG project, which lets me query the transcripts of my own recorded conversations.

The next evolution of this is what’s being called Agentic RAG. Where a simple RAG is a one-shot lookup, an agentic RAG system behaves more like a real researcher. It’s the engine behind the new wave of deep research tools. An agent using this pattern doesn’t just pull one document. It can perform an initial search, synthesize the results, identify gaps in its knowledge, and then autonomously formulate new, more refined queries to dig deeper. This iterative process provides far greater depth, but again, introduces that fundamental trade-off: a multi-step agentic query is significantly more expensive and slower than a single lookup.

The Immutable Laws of the Agent’s World

Some information, however, isn’t meant for semantic interpretation; it’s factual ground truth. An agent needs a place to get hard facts: “What is the user’s ID?” “What’s the current inventory level for this product?” This is where structured memory—the world of traditional SQL and NoSQL databases—comes in. They are the agent’s physics engine, representing the immutable laws of its world.

Accessing this kind of memory requires the agent to act. And this brings us to one of the most important concepts in agentic architecture, which we’ll explore fully in the next part of this series: tool use. An agent doesn’t need to know the data in a database; it just needs to know how to ask for it by using a tool. This creates a safe and powerful boundary between the agent’s fluid, probabilistic reasoning engine and the rigid, factual data store. When a question requires structured data, the agent can generate and execute a SQL query, not as a direct thought, but as a deliberate action.

For example:

  • User: “How many users signed up in the last 24 hours?”
  • Agent Thought: The user is asking for a specific count from the user database. I need to use the query_user_database tool. I will formulate a SQL query to get this information.
  • Agent Action: tool.query_user_database(sql=”SELECT COUNT(*) FROM users WHERE signup_date >= NOW() – INTERVAL ’24 hours’;”)
  • Tool Response: (count: 1,234)
  • Agent Response: “There were 1,234 new sign-ups in the last 24 hours.”

This “Think, Act, Observe” loop is the fundamental pattern for how agents interact with the outside world. While we’re introducing it here in the context of memory, it’s the key to unlocking an agent’s ability to do just about anything—from sending an email, to calling a weather API, to interacting with another agent. It’s the core of the “Action” in our “Perceive, Reason, Act” model, and it’s the subject of our next post.

The Expanding Architecture of Memory

The categories we’ve explored form the foundation of agent memory, but the field is rapidly evolving. Advanced architectures are becoming increasingly important for building more capable systems.

While vector databases excel at finding semantically similar information and SQL databases provide rigid facts, a third powerful structure is emerging as a cornerstone of advanced agent memory: the knowledge graph. A knowledge graph stores information not as documents or rows, but as a network of entities and the explicit relationships between them. Think of it less like a library and more like a detailed mind map. An agent equipped with a knowledge graph doesn’t just know that a document mentions “Project X” and “Alice”; it knows that “Alice” is the owner of “Project X,” and “Project X” is dependent on “Component Y.” This allows the agent to perform complex, multi-hop reasoning, answering questions like, “Who are the owners of all the projects that depend on Component Y?”—a query that would be incredibly difficult for a standard RAG system.

Furthermore, our discussion has been very text-centric. But the world an agent perceives is rich and multi-modal, and its memory must be as well. Multi-modal memory is the frontier where agents learn to recall not just what they’ve been told, but what they’ve seen. This could mean remembering the specific UI element on a screen to complete a complex navigation task, recalling the contents of a chart from a presentation slide, or identifying a product in a user-uploaded photograph. Instead of just text embeddings, the agent’s memory systems must store image embeddings, graphical data, and representations of spatial layouts, creating a far more holistic understanding of its environment.

When One Memory Serves Many

Finally, we must consider the “who” of memory. Most of our examples implicitly assume an agent serving a single user. But in real-world applications, agents will increasingly serve teams, departments, or entire companies. This introduces the complex challenge of shared memory and multi-tenancy. How does an agent partition its knowledge? What information becomes part of a shared team memory that everyone can access, and what must remain private to an individual’s episodic history? Designing the permissions, boundaries, and a “common ground” for a shared agent memory is as much a challenge of security and product design as it is of technical architecture. It’s about building a memory that respects context, privacy, and collaboration.

Weaving the Threads of Memory

So which architecture is right for you? The answer, as always, depends on the job to be done. For a conversational support agent that needs to recall user history and preferences, a robust episodic memory is paramount. For an agent designed to perform deep research and synthesis, a rich semantic memory powered by Agentic RAG is the core of its intelligence. And for an agent tasked with managing a business process or interacting with internal systems, a reliable structured memory is non-negotiable.

But the most sophisticated applications won’t be defined by a single memory type. Just as we concluded in Part 2 that an agent might employ an ensemble of different reasoning patterns, a truly capable agent will feature a hybrid memory system. The most powerful agents will use episodic memory to recall your preferences, query a semantic knowledge base to answer your questions, and access a structured database to execute a task on your behalf, all within a single, coherent workflow.

These memory systems are also deeply intertwined with how an agent thinks. A simple ReAct agent, as we explored in Part 2, lives almost entirely in its working memory, using its scratchpad to reason step-by-step. A more advanced planning agent, by contrast, must constantly query its episodic and semantic memory to build and validate its complex plans before acting.

Ultimately, an agent’s memory isn’t one thing, but a sophisticated, layered system. Building it is how we transform a forgetful tool into a context-aware partner. It doesn’t remove the need for human oversight; it elevates it. Our role shifts from operator to strategist, collaborating with an agent that understands our shared history and goals. The frontier is already pushing further, towards agents that can learn and adapt their own memory structures and, eventually, achieve true persistence not just through external databases, but through continuous fine-tuning of the model itself.

We’ve given our agent a brain, hands, and now, a memory. But to truly interact with the world, it needs to be able to use those hands. In our next post, we’ll dive into the “Action” part of the agent: a deep dive into the tools it uses to interact with these memory systems and the digital world at large.

This is a rapidly evolving space, and these patterns are just the beginning. I’m curious to hear from those of you on the front lines: What are the most interesting memory challenges you’re facing in the systems you’re building? Let me know in the comments below.

An abstract representation of AI cognitive patterns. A central glowing polygonal sphere is surrounded by four icons representing ReAct, Plan-and-Execute, Reflection, and Multi-Agent Collaboration, all on a dark background in a high-tech style

How Agents Think

Welcome back to The Agentic Shift. In our last post, “The Anatomy of an AI Agent,” we established that an agent is a system built around a model, defined by its ability to perceive (its senses), reason (its brain), and act (its hands). We settled on the analogy of a GPS navigator: a partner that doesn’t just show you a map, but actively senses traffic, thinks about the best route, and acts by giving you turn-by-turn directions to your goal.

That’s the “what.” Now, we’re diving into the “how.”

If the agent’s brain is a large model, how does it actually think? But here’s the interesting part: there isn’t just one way. An agent’s cognitive process is shaped by its underlying architecture—a kind of mental operating system that dictates its approach to solving a problem. Some agents are like meticulous planners, charting out every step of a journey before leaving the house. Others are more like improvisational travelers, figuring out their path as they go.

These cognitive frameworks are more than just academic curiosities; they are the fundamental patterns that enable an agent to tackle complex, multi-step goals. Understanding them is the key to building and working with this new generation of AI.

A Quick Note on Prompts

Before we dive in, it’s important to remember one thing: at the heart of every agentic pattern is a series of carefully crafted prompts. The logic we’re about to explore isn’t baked into the models themselves; it’s orchestrated by the application code. Each time you see a call to the llm in the pseudocode below, imagine a formatted prompt being sent to the model. The “magic” of an agent is really the art of conversation—asking the right questions, with the right context, at the right time.

It’s also important to note that the prompts included in our examples are intentionally simplified for clarity. In a real-world application, these prompts would be much more detailed, often including specific instructions on tone, format, and constraints, as well as examples to guide the model’s behavior. The art of creating these sophisticated instructions is a deep topic known as prompt engineering, which we’ll explore in a future post.

With that in mind, let’s explore four of the most foundational patterns being used today.

The ReAct Pattern: The Improviser

Imagine you’re a detective arriving at a crime scene. You don’t know the full story. You start with a goal—solve the case—but you can’t plan your entire investigation from the start. Instead, you look for a clue (observation), think about what it means (reason), and then take an action based on that thought (e.g., interview a witness). This iterative, adaptive loop is the essence of the ReAct (Reason + Act) pattern.

First formalized in a groundbreaking 2022 paper from collaborators at Princeton and Google Research, “ReAct: Synergizing Reasoning and Acting in Language Models,” this pattern is built on a simple, powerful cycle:

  1. Thought (Reason): The agent examines its goal and the information it has, then formulates an internal monologue. “The user wants the last Super Bowl score. First, I need to know which Super Bowl was the most recent.”
  2. Action (Act): Based on its thought, the agent chooses a tool and executes an action, like search(“most recent Super Bowl”).
  3. Observation: The agent gets a result from its action—”Super Bowl LVIII was played on February 11, 2024″—and adds this new information to its context.

This cycle repeats, with each observation informing the next thought. The ReAct pattern is incredibly effective for tasks where the path forward is unknown or the environment is constantly changing. Its main strength is its ability to course-correct. Of course, without careful prompting, ReAct agents can sometimes get stuck in repetitive loops—a challenge we’ll explore when we discuss debugging and productionizing agents later in the series.

Here’s what that loop looks like in pseudocode:

thought_prompt = """
Based on the following context, what is the next thought to move closer to the goal?
Context: {context}
Thought:
"""

action_prompt = """
Based on the following context, what is the next action to take? Choose from [search, finish].
Context: {context}
Action:
"""

context = "Goal: What was the score of the last Super Bowl?"
max_iterations = 10

for i in range(max_iterations):
    thought = llm.prompt(thought_prompt.format(context=context))
    context += thought

    action_text = llm.prompt(action_prompt.format(context=context))
    action = parse_action(action_text) # e.g., search("Super Bowl LVIII score")
    context += action_text

    if action.tool == "finish":
        return action.argument # Final answer
    
    observation = execute_tool(action.tool, action.argument)
    context += f"\nObservation: {observation}"

The Plan-and-Execute Pattern: The Meticulous Planner

While ReAct is the improviser, some tasks demand an architect. If you’re building a house, you don’t just start laying bricks. You begin with a detailed blueprint. This is the core idea behind the Plan-and-Execute pattern.

With this pattern, the agent operates in two distinct phases:

  1. Planning: First, the agent analyzes the high-level goal and generates a complete, step-by-step plan. It doesn’t take any action; it only thinks. This is often where a more powerful, sophisticated model is used to create a robust strategy.
  2. Execution: Once the plan is finalized, the agent (or a simpler, more cost-effective model) executes each step in sequence.

This approach offers predictability and control. It’s ideal for tasks in stable environments where the workflow is well-understood, like an automated software deployment. The primary drawback is its rigidity. If an unexpected error occurs, the entire plan might be invalidated, forcing a complete restart. This approach has been explored in academic research, such as in the paper “Plan-and-Solve Prompting,” which demonstrates how upfront planning can improve the reasoning of large language models.

A pseudocode implementation would separate these two phases clearly:

plan_prompt = """
Given the following goal, create a step-by-step plan to achieve it.
Goal: {goal}
Plan:
"""

# Phase 1: Planning
goal = "Deploy the new feature-x branch to staging."
plan_text = llm.prompt(plan_prompt.format(goal=goal))
plan = parse_plan(plan_text) # Turns numbered list into a list of strings

# Optional: Human-in-the-loop for approval
if not user.approve_plan(plan):
    exit("Deployment cancelled by user.")

# Phase 2: Execution
for step in plan:
    result = execute_step(step)
    if result.is_error():
        handle_error(result)
        break # Halt execution on failure

The Reflection Pattern: The Self-Critic

Even the best plans can have flaws. A great writer doesn’t just write a first draft; they revise it. They read their own work, critique it, and make it better. What if an agent could do the same? That’s the idea behind the Reflection pattern. It gives an agent a mechanism for self-critique and iterative refinement.

The process is straightforward but powerful:

  1. Generation: The agent produces an initial output—a block of code, a paragraph of text, or a plan.
  2. Critique (Reflection): The agent examines its own work, often guided by an external signal (like a failed unit test) or an internal set of principles. It generates feedback for itself.
  3. Refinement: The agent takes this feedback and generates a new, improved output.

This loop can be repeated until the output is satisfactory. The “Self-Refine” paper provides a formal framework for this, showing how iterative self-feedback can significantly improve performance. This ability to self-correct is powerful, but not foolproof. An agent can sometimes struggle to see its own blind spots, a failure mode we’ll look at how to mitigate later in this series.

Here’s how a reflection loop for code generation might look in pseudocode:

generation_prompt = "Write a Python function to {goal}."
reflection_prompt = """
The following code was generated to '{goal}'.
It failed with this error: {error_message}.
Please analyze the code and explain the bug.
Code: {code}
Reflection:
"""
refinement_prompt = """
Goal: '{goal}'.
The previous attempt failed. Here is a reflection on the bug:
{reflection}
Please generate a corrected version of the code.
Corrected Code:
"""

goal = "calculate the average of a list of numbers"
max_reflections = 5
context = ""

code = llm.prompt(generation_prompt.format(goal=goal))

for i in range(max_reflections):
    test_result, error_message = execute_unit_test(code)
    
    if test_result.is_pass():
        return code # Success
    
    reflection = llm.prompt(reflection_prompt.format(goal=goal, error_message=error_message, code=code))
    context += reflection

    code = llm.prompt(refinement_prompt.format(goal=goal, reflection=context))

Multi-Agent Collaboration: The Team of Specialists

So far, we’ve talked about single agents. But what about problems that are too big for one mind to handle alone? You’d assemble a team. The Multi-Agent Collaboration pattern does just that, creating a crew of specialized agents that work together.

This pattern typically involves a film crew-like structure:

  • The Orchestrator (The Director): This agent receives the main goal, breaks it down into smaller sub-tasks, and delegates them to the appropriate specialists.
  • Expert Agents (The Crew): These are agents designed for a specific function, like a Researcher or a Writer. Each has its own persona and a curated set of tools.

Frameworks like AutoGen from Microsoft and CrewAI are designed to facilitate this kind of collaborative workflow. As explored in surveys like “Demystifying and Advancing Collaborative AI,” this approach mirrors how human expert teams function. It’s powerful, but it introduces orchestration overhead. Miscommunication between agents can lead to cascading failures, a topic we’ll cover when we discuss building production-ready systems.

The pseudocode for this pattern looks like a director assigning tasks on a film set:

# Each agent is initialized with a system prompt that defines its expertise.
researcher_prompt = "You are an expert researcher. Use your search tools to find relevant information."
researcher = Agent(system_prompt=researcher_prompt, tools=[web_search])

writer_prompt = "You are an expert writer. Turn the provided data into a well-structured blog post."
writer = Agent(system_prompt=writer_prompt) # No tools needed for this agent

editor_prompt = "You are an expert editor. Review the text for clarity, grammar, and accuracy."
editor = Agent(system_prompt=editor_prompt)

# The Orchestrator manages the workflow
class Orchestrator:
    def run(self, goal):
        research_task = "Gather performance data for Llama 3 vs. GPT-4 on coding benchmarks."
        research_output = researcher.run(research_task)

        writing_task = f"Draft a blog post using this data: {research_output}"
        draft_post = writer.run(writing_task)

        editing_task = f"Review and polish this draft: {draft_post}"
        final_post = editor.run(editing_task)
        
        return final_post

# Kick off the process
goal = "Write a blog post comparing Llama 3 and GPT-4 on coding benchmarks."
orchestrator = Orchestrator()
result = orchestrator.run(goal)

Choosing the Right Pattern: A Quick Guide

Each pattern offers a different cognitive strategy, and the right choice depends entirely on the task. There’s a fundamental trade-off between adaptability and predictability. ReAct excels at exploration in unknown environments, while Plan-and-Execute provides reliability for known procedures. Here’s a simple guide to help you choose:

PatternCore IdeaBest For (Use Cases)Key LimitationPractical Considerations
ReActInterleaving reasoning, tool use, and observation in a tight, iterative loop.Exploratory tasks in dynamic environments. Web navigation, interactive Q&A, debugging a novel issue.Can be inefficient for predictable tasks; may get stuck in loops if not guided well.High cost/latency (many LLM calls).
Plan-and-ExecuteCreating a complete plan upfront and then executing it step-by-step.Predictable, multi-step procedures. Software builds, data processing pipelines, following a recipe.Brittle and inflexible; an early failure can invalidate the entire plan.Low cost/latency (often fewer LLM calls).
ReflectionCritiquing and iteratively refining its own output to improve quality.Tasks where the first draft isn’t enough. Code generation, creative writing, complex reasoning.Can suffer from self-bias; an agent can’t easily spot its own blind spots without an external signal.Variable cost/latency (depends on refinement loops).
Multi-AgentDecomposing a complex goal into roles for specialized agents to collaborate on.Complex, multifaceted projects. Writing a research report, financial analysis, large-scale software development.Adds significant orchestration overhead; success depends on clear communication protocols.Very high cost/latency (multiple agents making calls).

Beyond the Choice: Composing Patterns

The table above presents the patterns as a choice, but the most sophisticated agentic systems don’t just pick one. They compose them, creating a hierarchy of intelligence. This is where the true power of these architectures begins to emerge.

Imagine an orchestrator agent tasked with a complex goal, like “Write a complete market analysis report for our new product.” It might use a Plan-and-Execute pattern to create a high-level blueprint:

  1. Gather competitor data.
  2. Analyze market sentiment.
  3. Draft the report.
  4. Create visualizations.
  5. Finalize and edit the report.

This plan is predictable and structured. But the first step, “Gather competitor data,” is messy and unpredictable. For this specific task, the orchestrator might delegate the work to a subordinate ReAct agent, an “improviser” that is perfectly suited for navigating the web, dealing with unexpected website layouts, and finding information through exploration. In this way, the system gets the best of both worlds: the reliability of a high-level plan and the adaptability of an exploratory sub-agent.

The Human in the Loop: Our Role in the Age of Agents

While we’ve focused on how agents think, it’s crucial to remember that these patterns are not designed to operate in a vacuum. The goal is not to replace human oversight, but to elevate it. A key principle in building robust and responsible agents is ensuring there is always a human in the loop.

This partnership can take many forms, depending on the pattern:

  • In Plan-and-Execute, a human can review and approve the plan before any irreversible actions are taken, as shown in our pseudocode.
  • In a Reflection loop, a human can provide the external feedback, acting as a coach who points out subtle flaws the agent might miss on its own.
  • For a ReAct agent that gets stuck, a human can offer a hint or a new direction to get it back on track.
  • In a Multi-Agent system, a human can act as the ultimate orchestrator, resolving conflicts between agents or providing the strategic direction that guides the entire team.

Building these points of collaboration into an agent’s design transforms it from an autonomous black box into a transparent and steerable partner. This human-centric approach is not just a safety feature; it’s what will make these systems truly powerful.

Beyond the Foundations: A Glimpse of What’s Next

While these four patterns are the bedrock of modern agentic systems, the field is moving at a breathtaking pace. Researchers are already developing more sophisticated reasoning structures that build on these ideas.

One of the most exciting is Language Agent Tree Search (LATS). A standard ReAct agent follows a single, intuitive path. If it makes a wrong turn, it has to backtrack. LATS, inspired by classic search algorithms, allows an agent to explore multiple reasoning paths at once, like branches of a tree. It can evaluate different potential action sequences, discard unpromising ones, and pursue the path that seems most likely to lead to success. As detailed in the paper “Language Agent Tree Search Unifies Reasoning Acting and Planning in Language Models,” this makes agents more robust and capable of solving complex problems where a simple greedy approach might fail. This move from “single-path” to “multi-path” reasoning is a crucial step toward building more deliberative and strategic agents.

From Code to Conversation: The Next Abstraction

For those of us with a background in software engineering, these patterns might feel familiar in a surprising way. The history of programming is a story of ever-increasing abstraction. We moved from the raw bits of machine code to the symbolic representation of assembly. Then came procedural languages like C, which let us think in functions. Object-oriented languages like Java and C++ allowed us to model the world in classes. More recently, scripting languages like Python and JavaScript made development even more dynamic.

At each step, we’ve moved further away from telling the machine how to do something and closer to simply stating what we want to achieve.

Agentic patterns are the next logical step in this evolution.

When we use these patterns, we are engaging in a form of meta-programming. The “code” we write is no longer a precise sequence of commands but a set of goals, constraints, and tools expressed in natural language. The loops and logic in the pseudocode examples are the new “interpreters,” orchestrating the model’s reasoning to achieve a high-level objective. We are, in essence, programming with intent. It’s not a stretch to imagine a future where programming languages evolve to natively incorporate these concepts, allowing developers to define goals and delegate tasks using a grammar that blends traditional code with structured natural language.

Conclusion: A Pattern for Every Problem, and a Role for Everyone

We’ve journeyed through the cognitive architecture of AI agents, moving beyond the simple “what” to the complex “how.” We’ve seen that an agent’s “thinking” isn’t monolithic; it’s a choice between foundational patterns. From the adaptive improvisation of ReAct to the structured reliability of Plan-and-Execute, the self-correcting loop of Reflection, and the collaborative power of Multi-Agent systems, these patterns form a toolkit for building intelligence.

Choosing the right pattern is a critical design decision—a trade-off between adaptability and predictability, speed and cost. But the most sophisticated systems won’t just choose one; they will compose them, creating hierarchies of intelligence that leverage the strengths of each. And in the most effective systems, there will always be a role for the most intelligent component of all: the human in the loop. This isn’t a future where we are sidelined; it’s one where our role evolves from direct implementer to strategic collaborator—the coach, the reviewer, and the guide who provides the crucial oversight that turns a powerful tool into a trusted partner.

Perhaps the most profound realization is that in designing these systems, we are participating in the next great abstraction in software development. We are moving from writing explicit code to orchestrating intent, sculpting behavior through conversation and structured prompts. And this field is not standing still. The evolution from the single-path reasoning of ReAct to the multi-path exploration of emerging patterns like LATS shows a clear trajectory toward more robust, deliberative AI.

This brings our exploration of the agent’s brain to a close. We now have a blueprint for how an agent thinks. But a brain without memory is fleeting. To learn, adapt, and build upon its experiences, an agent needs to remember. In our next post, we’ll dive into the crucial component that makes this possible: Part 3: The Agent’s Memory. The foundation is set, and the truly exciting part is just beginning.

A conceptual illustration of an AI agent's anatomy. A central glowing orb represents the core agent, surrounded by three icons: an eye for Perception, a brain for Reasoning, and a hand for Action. Thin lines connect the icons to the center, symbolizing an interconnected system.

The Anatomy of an AI Agent

Welcome back to The Agentic Shift. This series is my attempt to map the new territory of agentic AI as it unfolds—a shift as fundamental as the move from desktop to mobile. We’re on a journey to understand how AI is evolving from a passive tool that creates to an active partner that does. Together, we’ll dissect the anatomy of an agent, explore how it thinks and remembers, examine the tools it uses to act, and grapple with the challenges of guiding it safely.

In our first post, we introduced this new age of agents. Now, it’s time to get our hands dirty and look under the hood.

From Maps to Navigators

I love maps. I always have. As a kid, I’d spread them out on the floor, tracing roads with my finger, just to understand the shape of a place. I love the ritual of folding them just right. For years, I kept a stack of them in my car. I even had the incredible fortune to work on Google Maps for nearly a decade.

Given all that, you’d think my sense of direction would be impeccable. Well, it isn’t. I could get lost in a paper bag with one opening. For me, a map is a beautiful tool for understanding, but a terrible one for navigating. It gives you all the data, but you have to do the hard work of figuring out where you are, where you’re going, and what to do when you inevitably take a wrong turn.

A GPS navigator, on the other hand, is a different beast entirely. It’s an active partner. You give it a goal—”Get me to the airport”—and it takes on the cognitive load. It doesn’t use AI in the way we’re going to be talking about it in this series, but it has the key characteristics of an agentic system. It senses the current state of the world through traffic data. It thinks about the most efficient path. And it uses its tools to act, giving you turn-by-turn directions. If it senses a problem, it proactively finds another way.

That leap—from a static tool to an active, goal-oriented partner—is the very essence of the “agentic shift.” And just like a GPS, an AI agent is defined by its fundamental anatomy: how it perceives its world, how it thinks, and how it acts.

Defining the Agent: More Than a Smart Tool

Before we go any further, let’s address the elephant in the room. The term “AI agent” is, as technologist Simon Willison has noted, “infuriatingly vague.” Different people use it to mean different things. For some, it’s an “LLM autonomously using tools in a loop.” For others, it’s a system that can “plan an approach and then run tools… until a goal is achieved.”

For our purposes in this series, we’ll establish a simple, core principle: an agent isn’t just a model; it’s a system built around a model. It’s a complete entity with distinct parts that work together. To understand it, we need to look at its three anatomical pillars:

  • Perception: The Senses
  • Reasoning/Cognition: The Brain
  • Action: The Hands

But why is this happening now? After all, we’ve had automation and bots for years. The difference lies in a powerful technological convergence. First, the “brain” got a massive upgrade; recent large models are capable of genuine reasoning and planning. Second, the digital world has become almost universally accessible via APIs, giving the agent’s “senses” and “hands” a world of information to perceive and a universe of tools to act upon. This combination is what makes the current moment so transformative.

The Anatomy, Piece by Piece

Let’s break down what each of these parts actually does.

Perception (The Senses)

First, how does an agent understand its environment? When we talk about an agent’s senses, we’re not talking about cameras or microphones. An AI agent’s environment is digital. Its perception comes from its ability to access information through APIs, data streams, and file systems. It might “see” the latest financial data by calling a stock market API, or “read” a user’s notes by accessing a local file. This is its window into the digital world.

Reasoning/Cognition (The Brain)

At the heart of every agent is its brain: a large model. This is the component that takes the information from its senses, considers the overall goal, and creates a plan. The model is the decision-maker. In Part 2 of this series, we’ll dive deep into how it thinks using different cognitive patterns, and in Part 3, we’ll explore the critical role of memory. For now, just know this is the part that makes the choices.

Action (The Hands)

An agent that can perceive and think is still just an observer. To be an agent, it must be able to do things. The agent’s “hands” are the tools it has been given. These tools are almost always APIs that allow it to perform actions: writing to a file, sending an email, searching the web, or running a piece of code. This is where the agent moves from thinking to acting. This creates a dynamic feedback loop: it acts, perceives the results of that action, and then reasons about what to do next. This cycle is the engine of an agent. This concept is so central that we’ll dedicate Part 4 entirely to the agent’s ‘toolkit’ and Part 5 to the art of writing the instructions that guide its actions.

The “Agentic” Spark: What Makes It Different?

These three parts—perception, reasoning, and action—are the building blocks. But what truly makes a system agentic are the emergent properties that come from combining them:

  • Autonomy: It can operate without constant, step-by-step human intervention. This doesn’t make the human irrelevant; it changes the nature of our collaboration from micromanagement to high-level direction. It doesn’t need to be told how to do something, just what the goal is.
  • Goal-Orientation: It’s driven by a high-level objective, not just a single command. The goal isn’t “search for flights”; it’s “plan my business trip to Singapore.”
  • Proactivity: It can take initiative. Like the GPS that reroutes you around traffic, an agent can adapt its plan when it perceives changes in its environment.

This combination of autonomy and proactivity is incredibly powerful, but it also introduces new challenges we have to solve. In Part 6, we’ll discuss how to build in the necessary guardrails to ensure agents act safely and securely.

A Simple Agent in Action: The Weather Forecaster

Let’s tie this all together with a simple example. Imagine an agent whose goal is to answer the question: “Will I need an umbrella tomorrow?”

  1. Goal: The agent is given its objective.
  2. Perception: It uses its senses—a weather API—to get the forecast for your location.
  3. Reasoning: Its brain processes the data it perceived: “80% chance of precipitation.” It connects this data to the goal and concludes that rain is likely and an umbrella would be useful.
  4. Action: It uses its hands—a notification API—to send a message to your phone: “Looks like rain tomorrow, don’t forget your umbrella!”
  5. Loop: The action is complete. The agent now waits, ready to perceive new information or receive a new goal.

This simple loop is the foundation of every agent, from this basic forecaster to the most complex systems being built today.

Conclusion: The Foundation is Set

So, what is an AI agent? At its core, it’s a system with a reasoning brain (a large model) connected to a digital environment through a dynamic loop of perception and action.

Understanding this anatomy isn’t just an academic exercise. For anyone looking to build, manage, or work alongside these new systems, this is the essential first step. It gives us a shared language and a mental model for everything that follows.

Now that we’ve assembled the basic anatomy of an agent, the rest of this series will be about bringing it to life. In Part 2, we’ll explore the fascinating ways an agent thinks, and from there, we’ll cover everything from memory and tools to safety and even how multiple agents can collaborate to solve complex problems. The foundation is set, and the exciting part is just beginning.

Abstract digital art of a glowing, multifaceted geometric shape at the center of a sparse network diagram on a dark background.

The Agentic Shift: Welcome to the Age of Agents

Throughout my career, I’ve had the privilege of witnessing a few of those rare, ground-shifting moments in technology. I saw the rise of the internet transform from a niche academic network into a global utility with high-speed access for all. I watched the personal computer evolve from an expensive hobbyist’s toy into a commodity that billions of people rely on every day, a shift that was fundamentally enabled by the advent of cloud computing. The cloud moved the heavy lifting of computing off our desktops and into vast, remote data centers, completely changing how we build and deliver software. Then came the mobile revolution, shrinking the PC into our pockets and connecting us to a constant stream of information. Hand-in-hand with this was the rise of social media, which turned the internet into a dynamic, two-way medium for human connection and communication. Today, we are standing on the cusp of another such fundamental shift, driven by artificial intelligence and the new design patterns emerging alongside it.

For the past couple of years, we’ve been captivated by what generative AI can create. We prompt, and it writes, draws, or codes. It’s a powerful, but ultimately passive, partnership. We give the command; it generates the response. But the wave that’s arriving now is different. It’s defined by what AI can do.

We are moving from passive assistance to active, autonomous execution. An AI agent isn’t just a sophisticated tool waiting for a command; it’s a partner given a mission. It can independently plan, use tools, and adapt its strategy to achieve a goal. As Bill Gates put it, “Agents are not only going to change how everyone interacts with computers. They’re also going to upend the software industry.” It’s a fundamental re-architecting of our relationship with machines.

This series, “The Agentic Shift,” is my attempt to map this new territory as it unfolds. It’s for the builders, the thinkers, the product managers, and the business leaders who are curious about where this is all heading. It’s for anyone who senses this shift and wants to understand it from the ground up.

Together, we’ll go on a journey. We’ll start by dissecting the basic anatomy of an agent—what makes it tick? From there, we’ll explore how agents think, remember, and use their digital “hands” through tools and APIs. We’ll cover the practical art of guiding their behavior, putting up essential guardrails, and choosing the right frameworks to build on.

Finally, we’ll look at how agents collaborate with each other and what it takes to move them from a prototype to a production system, all while grappling with the critical questions of ethics and responsibility.

It’s an ambitious road ahead, but a necessary one to travel. The age of agents is here. Let’s explore it together.

Series Table of Contents