Knowledge as of Oct 26, 2026
The Inference TimesReference architectures, tutorials, demos and free skills — by Nitin Goswami
Epoch III · Step 16Ask the AI Nitin →

REFERENCE ARCHITECTURE · coala-cognitive-architecture · October 17, 2026

CoALA: how language agents remember, decide and act

A reference architecture for thinking about any LLM agent: three kinds of long-term memory, a working memory where the model reasons, an action space, and a decision cycle that ties them together. Explained with two diagrams and one worked example.

Domain
AI agents
Level
Beginner
Key concepts
working memory · semantic · episodic · procedural memory · internal vs external actions · decision cycle
Related demos
RAG Demo

In one picture

CoALA, short for Cognitive Architectures for Language Agents (Sumers et al., 2023), is a way to describe any LLM agent with the same few parts. The language model is not the whole agent; it's the reasoning engine inside it. Around it sit memories that hold information, actions that move information or change the world, and a decision cycle that chooses what to do next.

Long-term memory Procedural how to act: prompts, code Semantic what is true: facts, docs Episodic what happened: past turns Working memory goal · context · scratchpad the LLM reasons over this load retrieval retrieval learning Action space · external (grounding) Dialogue talk to a person Tools & APIs search, code, DBs Environment browser, robot, files act act act
CoALA at a glance, adapted from Sumers et al. (2023): long-term memory, working memory and the action space.

Why it matters

Agent frameworks use the same words for different things. "Memory" might mean the chat history, a vector database or a fine-tuned model. "Planning" might be one prompt or a search over many. Without shared vocabulary, two designs are hard to compare and gaps are hard to spot.

CoALA gives each piece a role. Once every component has a role, three questions get easy:

  • What does this agent actually remember?
  • What can it change? Only its own memory, or the outside world too?
  • Who decides what happens next? A fixed pipeline, or the model each turn?

The building blocks

Working memory is what the model sees right now: the goal, the retrieved context, recent turns and any scratch work. In practice, it's the prompt. It's small and rebuilt every cycle.

Long-term memory comes in three kinds:

MemoryHoldsEveryday example
SemanticFacts about the world or a domainDocuments in a vector store, a knowledge graph
EpisodicWhat happened beforePast conversations, logs of earlier attempts
ProceduralHow to actThe system prompt, tool definitions, the agent's code, the model's weights

Actions are either internal, working on the agent's own memories, or external, reaching outside it:

ActionKindWhat it does
RetrievalInternalReads from long-term memory into working memory
ReasoningInternalThe LLM processes working memory and writes results back to it
LearningInternalWrites to long-term memory: storing documents, saving an episode, updating a prompt
GroundingExternalTalks to a person, calls a tool or API, acts in an environment

The decision procedure is the loop that picks which action to take, described next.

How it works

Each cycle has two stages, planning and execution:

  1. Propose. The model suggests candidate actions, often after retrieving context.
  2. Evaluate. Each candidate is scored, by the model, by rules or by a value estimate.
  3. Select. One action is chosen. Simple agents skip straight here: there's only one option.
  4. Act. The chosen action runs: an internal one, like retrieving or learning, or an external one, like replying or calling a tool.
  5. Observe. The result goes back into working memory, and the next cycle starts. The loop ends when the goal is met or a budget runs out.
Planning Propose candidate actions Evaluate score each one Select pick one Execution Act internal or external chosen action Observe result → working memory next cycle (until done or budget hit)
The decision cycle, adapted from Sumers et al. (2023): planning (propose → evaluate → select), then execution and observation.

A worked example: the RAG demo

A basic RAG chatbot is a small CoALA agent. Uploading a document is a learning action into semantic memory. Each question triggers a retrieval action that fills working memory, the model reasons, and the reply is a grounding action. Seen this way, what's missing is easy to spot: there's no episodic store (history lives only in the browser), and the agent never learns from conversations.

User POST /upload learning action pgvector semantic memory POST /chat question Prompt context + 6 turns working memory ChatOpenAI reasoning files embed + store retrieval · top-4 answer + sources (dialogue) episodic: client only
The RAG demo mapped onto CoALA: learning into semantic memory, retrieval into working memory, reasoning, then a reply. Episodic memory is only client-side.

Patterns & variations

PatternWhat changes in CoALA termsWhen to use it
Plain RAGA fixed cycle: retrieve → reason → reply. No learning from chatsQ&A over a known body of documents
ReAct (Yao et al., 2022)Reasoning and grounding alternate over several cycles; the model picks the next toolTasks that need several lookups or tool calls
Conversational memoryAdds an episodic store and retrieval from itAssistants that should remember a user across sessions
Reflection (Park et al., 2023)A learning action writes the agent's own conclusions into long-term memoryLong-running agents that improve from experience
Human-gated learningLearning writes to a review queue; a person promotes items to semantic memoryAgents that speak for a person or a brand, where drift is unacceptable

Pitfalls

PitfallWhat you'll noticeRemedy
Everything in working memoryPrompts grow until they're slow, costly or truncatedMove history to episodic memory and retrieve only what's relevant
Unreviewed learningThe agent "remembers" false or injected factsGate writes to semantic memory; keep a review queue
Unbounded decision loopsRunaway tool calls and costsCap the cycles and tokens; force a final answer at the cap
Procedural memory edited ad hocBehaviour changes nobody can traceVersion prompts and tool definitions like code; record the version with each run
Episodic and semantic mixed togetherOld chat snippets cited as factsSeparate stores, labelled sources, different retrieval rules

Go further

  • See it built: the RAG demo implements the agent in Fig. 3, with every stage visible in its UI.
  • Read the paper: Sumers et al. (2023), listed below, covers the framework in depth, including how it relates to classic cognitive architectures.
  • Next on this desk: explainers on agent harnesses and AI Ops will use the same vocabulary.

Credits & sources

  1. Theodore R. Sumers, Shunyu Yao, Karthik Narasimhan, Thomas L. Griffiths. Cognitive Architectures for Language Agents (2023)The framework this page explains: the memory modules, the internal and external action space and the decision cycle. Fig. 1 and Fig. 2 are simplified, redrawn adaptations of the paper's framework, not copies.
  2. Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, Yuan Cao. ReAct: Synergizing Reasoning and Acting in Language Models (2022)The reason-then-act pattern in the Patterns table.
  3. Joon Sung Park, Joseph C. O'Brien, Carrie J. Cai, Meredith Ringel Morris, Percy Liang, Michael S. Bernstein. Generative Agents: Interactive Simulacra of Human Behavior (2023)The reflection pattern, where an agent writes its own conclusions back into memory.

More Reference Architectures

Reference Architecture · Agents

Agent memory over MCP: giving any model a long-term memory it can call

Agent memory over MCP puts an assistant's long-term memory in its own small server, so that any app that speaks the Model Context Protocol can save facts and look them up again. Explained with three diagrams and one worked example.

Reference Architecture · Voice AI

Grounded voice insight: turning recorded speech into claims you can check

A pattern for getting judgements out of recorded conversations that a reader can verify: transcribe, measure what can be counted, let an LLM judge the rest with quotes, and check every quote against the transcript before showing it. Explained with two diagrams.

Reference Architecture · Agents

What is an internal agent SDK? One shared way for many teams to build AI agents

A shared toolkit that lets every team in a company build AI agents the same safe way: each team writes only what is unique to its agent, and the SDK supplies the checks, the step-by-step runner, saved progress, human sign-off, model access and cost limits. Explained with two diagrams.