Overview

10 Exploring the cognitive agent that thinks, monitors, and adapts

The chapter introduces cognitive agents as a practical response to the limits of stacking reasoning patterns alone. It argues that agents can be skilled at reasoning yet still fail in predictable ways—such as giving confidently wrong answers, repeating the same unsuccessful approach, sticking to a rigid plan, overcommitting when they lack knowledge, or failing to compose multiple tools into a useful workflow. The key idea is to move from isolated reasoning tricks to an architecture that can decide what kind of thinking a task needs, monitor whether that thinking is working, and adapt when it is not.

To do that, the chapter defines cognition as the agent’s ability to build and revise an internal task model, and metacognition as the ability to assess its own thinking in real time. It maps these ideas to a modular architecture inspired by Society of Mind, Global Workspace Theory, and System 1/System 2 thinking. A shared workspace holds task state, confidence, intermediate results, and signals, while specialized modules handle perception, planning, execution, evaluation, attention, and memory. The result is an agent that can classify tasks, choose among strategies like direct answering, decomposition, exploration, or hypothesis testing, and use memory to inform future decisions.

The chapter then shows how this architecture becomes production-ready through monitoring and control mechanisms. The evaluation module checks evidence quality, detects contradictions, and watches for stagnation; the attention module routes control based on those signals; the confidence gate prevents unsupported answers; and the memory module records both successes and failures in a structured knowledge graph. Together, these components create emergent behaviors such as curiosity, adaptive persistence, selective depth, and graceful degradation. The overall message is that more capable agents come not from bigger models alone, but from modular systems that can reason, monitor, remember, and adapt in concert.

The five production agent failure modes mapped to cognitive and metacognitive deficits.
Cognitive primitives versus cognitive architecture, where the reasoning primitives become a selection within the process.
Three theoretical foundations of the mind mapped to agent architecture components
The Cognitive Agent Architecture shows the flow from user/initial query to the cognitive loop, which iterates and processes through the modules.
Planning Module strategy selection.
Attention routing decision tree.
The Memory Module’s three behaviors layered on the MCP memory server.
The cognitive loop layered on the agentic loop.

Summary

  • Individual reasoning patterns (CoT, ReAct, ToT, Reflexion) are cognitive primitives. Composing them into a unified architecture produces qualitatively different behavior that starts to look general rather than narrow.
  • Cognition in agent terms means the quality of the agent’s internal model of the task: can it decompose novel problems, reason about dependencies, compose tools in new ways, and update its understanding as new information arrives?
  • Metacognition means the agent’s ability to monitor its own reasoning: does it know when it is confident vs. guessing? Does it detect when it is stuck? Does it recognize the boundaries of its own knowledge?
  • The Cognitive Agent Architecture draws on three theoretical foundations: Minsky’s Society of Mind (intelligence as interaction between specialized modules), Baars’ Global Workspace (shared state that modules compete to influence), and Kahneman’s System 1/System 2 (routing queries to appropriate depth of processing).
  • The architecture has six core components: a Cognitive Workspace (shared state), and five modules – Perception (understanding the problem), Planning (selecting strategy), Execution (acting on the plan), Evaluation (metacognitive monitoring), and Attention (dynamic routing between modules). A seventh component, the Memory Module, provides persistent long-term memory via the official @modelcontextprotocol/server-memory knowledge graph.
  • The MCP memory server’s knowledge graph stores problem types as entities, successful strategies as observations, and structural relationships between related problems as relations. The memory module wraps these primitives with proactive retrieval (checking past experience before planning) and experience recording (logging outcomes after evaluation), creating a persistent learning loop.
  • Emergent behaviors arise without being explicitly programmed: curiosity, adaptive persistence, selective depth, and graceful degradation. The knowledge graph amplifies these behaviors over time as the agent accumulates experience.
  • Metacognitive monitoring – specifically confidence-gated execution, stagnation detection, and knowledge boundary awareness – is the most valuable production capability because it prevents confidently wrong answers.
  • The cognitive architecture extends the agentic loop by enriching what happens inside each iteration. The memory knowledge graph persists learning across sessions, turning individual problem-solving into cumulative institutional knowledge.
  • The path to more general agents is architectural, not just parametric. Modular cognitive architectures where reasoning, monitoring, memory, and adaptation are separate concerns provide a framework for incremental improvement that pure prompting and model scaling do not.

FAQ

What is the main goal of building a cognitive agent in this chapter?The main goal is to add a “craftsman” to the toolbox: an architecture that decides which reasoning pattern to use, monitors whether it is working, and adapts when it is not. Instead of simply stacking reasoning techniques, the chapter builds a system that can think before acting and think about its own thinking.
What are the five failure modes of capable-but-not-cognitive agents?The five failure modes are: a confident wrong answer, a broken record, a rigid plan, an over-committed guess, and a shallow composition. Each one reflects a missing cognitive or metacognitive capability, such as evidence evaluation, stagnation awareness, replanning, confidence gating, or compositional reasoning.
How is cognition defined for agents in this chapter?Cognition is defined as the quality of the agent’s internal model of the task. A cognitive agent represents what is being asked, decides how to approach it, and updates that understanding as new information arrives. The key capabilities are task decomposition, dependency reasoning, compositional tool use, and model updating.
What is metacognition for agents?Metacognition is the agent’s ability to think about its own thinking. In practical terms, it includes confidence calibration, stagnation detection, and knowledge boundary awareness. These mechanisms help the agent know when it is correct, when it is stuck, and when it does not know enough to answer safely.
What are the theoretical foundations behind the cognitive agent architecture?The architecture draws on three frameworks: Minsky’s Society of Mind, Baars’ Global Workspace Theory, and Kahneman’s System 1/System 2 model. Minsky supports specialized modules, Baars supports a shared workspace, and Kahneman supports routing between fast and deep processing depending on task complexity.
What is the Cognitive Workspace?The Cognitive Workspace is the shared state object that all modules read from and write to. It stores the task representation, active hypotheses, intermediate results, confidence state, execution history, and attention signals. It acts like a global broadcast medium for the agent’s current cognitive state.
How does the Perception Module help the agent?The Perception Module analyzes the raw user query before any action is taken. It classifies the task type, extracts entities, identifies ambiguities, and estimates complexity. This triage step determines whether the agent can take a fast path or needs the full cognitive cycle.
What does the Planning Module do?The Planning Module reads the task representation and chooses a strategy such as DIRECT, DECOMPOSE, EXPLORE, or HYPOTHESIS_TEST. It can also use memory hits to inform planning. Its job is to convert understanding of the task into an executable plan with ordered sub-goals.
How do the Evaluation Module and Attention Module work together?The Evaluation Module checks whether the agent is making progress, whether evidence is consistent, and whether confidence should change. It can raise signals like STAGNATION or CONTRADICTION. The Attention Module reads those signals and routes control to the next appropriate module, such as replanning, memory retrieval, escalation, or response.
Why does the chapter use a memory module with a knowledge graph?The Memory Module gives the agent long-term experience using the MCP memory server and a knowledge graph. This lets the agent retrieve past problem types, record outcomes, and build relations between related issues and strategies. The chapter favors a knowledge graph over vector similarity because structural relationships are more useful for reasoning about problems and solutions.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • AI Agents in Action, Second Edition ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • AI Agents in Action, Second Edition ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • AI Agents in Action, Second Edition ebook for free