Architecture, Memory, Learning Systems and Practical Implementation
Introduction
Chapter 1: What Is a Self-Improving Agent
- From Chatbots to Agents to Self-Improving Systems
- What Counts as Improvement
- The Seven Levers of Self-Improvement
- Common Illusions of Progress
- The Book’s Roadmap
Chapter 2: The Intelligence Stack: LLMs, Reasoning and Agentic Control
- How Large Language Models Think
- Capabilities Relevant to Agency
- Fundamental Limitations and Failure Modes
- Prompting as Program Execution
- From Text Generation to Decision Making
Chapter 3: Agency and Autonomy: Control, Planning and Decision-Making
- The Perception-Action Loop
- Planning Paradigms: Search, Decomposition and Sampling
- Action Spaces and Tool Use
- Autonomy Levels and Human Oversight
- Uncertainty, Risk and Conservative Decision Making
Chapter 4: The Memory Problem: Why Agents Forget and How to Fix It
- Stateless Agents and the Forgetting Problem
- A Taxonomy of Agent Memory
- Memory as the Substrate of Improvement
- Costs and Constraints of Memory Systems
- Design Principles for Agent Memory
Chapter 5: Short-Term and Working Memory in Agents
- Context Windows as Working Memory
- Attention and Token Priority
- Context Management Strategies
- Sliding Windows and Context Compression
- The Role of Short-Term Memory in Planning
Chapter 6: Long-Term Memory: Vectors, Embeddings and Retrieval
- How Embeddings Encode Meaning
- Vector Databases and Indexing
- Similarity Search and Retrieval Strategies
- Retrieval-Augmented Generation in Agents
- Trade-Offs: Accuracy, Latency, Cost
Chapter 7: Episodic and Semantic Memory Systems
- Episodic Memory: Storing Trajectories and Experiences
- Semantic Memory: Facts, Concepts and Knowledge
- Separating Events from Principles
- Cross-Referencing Episodic and Semantic Memory
- When to Use Each Type
Chapter 8: Procedural Memory and Skill Acquisition
- Defining Skills in Agent Systems
- Procedural Memory as Executable Knowledge
- Skill Discovery and Abstraction
- Skill Composition and Reuse
- From Trial-and-Error to Stored Procedure
Chapter 9: Knowledge Graphs and Structured Memory
- When Graphs Beat Vectors
- Building and Maintaining Knowledge Graphs
- Graph Querying in Agent Workflows
- Hybrid Graph-Vector Memory
- Schema Design for Agent Knowledge
Chapter 10: Memory Lifecycle: Storage, Retrieval, Update, Consolidation, Forgetting
- Storing New Information
- Retrieving Relevant Information Under Pressure
- Updating Existing Beliefs
- Memory Consolidation Across Sessions
- The Necessity and Mechanics of Forgetting
Chapter 11: Types of Improvement: Context, Tools, Memory, Model, Code
- Context-Based Improvement: Better Prompts and Retrieval
- Tool-Based Improvement: New and Better Tools
- Memory-Based Improvement: Accumulated Knowledge
- Model-Based Improvement: Fine-Tuning and RL
- Code and Architecture-Based Improvement
Chapter 12: Reflection-Based Learning: Self-Correction and Meta-Cognition
- The Reflexion Pattern and Its Variants
- Self-Critique and Error Detection
- Post-Hoc Analysis of Failures
- Generating Improvement Hypotheses
- Integrating Reflection into Agent Loops
Chapter 13: Memory-Based Learning and Experience Replay
- Experience Storage and Format Design
- Replay Strategies and Sampling
- Extracting Patterns from Past Trajectories
- Combining Experience Replay with Retrieval
- Preventing Overfitting to Past Data
Chapter 14: Automated Skill Generation and Tool Creation
- Identifying Missing Capabilities
- Skill Generation from Examples
- Tool Creation and Integration
- Testing Newly Created Skills
- Curating the Skill Library Over Time
Chapter 15: Code Modification and Self-Evolving Systems
- The Appeal and Danger of Self-Modification
- Safe Code Generation Patterns
- Automated Testing of Changes
- Version Control and Rollback
- Incremental vs Radical Changes
Chapter 16: Self-Generated Training Data and Supervised Fine-Tuning
- Generating High-Quality Training Data
- Curriculum Design for Agents
- Data Filtering and Quality Control
- Fine-Tuning Pipelines for Agents
- Evaluating Fine-Tuned Models on Tasks
Chapter 17: Reinforcement Learning for Agents
- Reward Signals and Their Design
- RLHF for Agent Behavior
- Online RL and Policy Optimization
- Exploration vs Exploitation in Agents
- Practical Constraints and Alternatives to Full RL
Chapter 18: Evolutionary and Population-Based Methods
- Evolutionary Search for Prompts and Prompt Templates
- Population-Based Agent Training
- Crossover, Mutation and Selection in Agent Design
- Large-Scale Optimization of Agent Configurations
- When Evolutionary Methods Win
Chapter 19: Meta-Learning and Agent-Driven Experimentation
- What Meta-Learning Means for Agents
- Experiment Design by Agents
- Hypothesis Testing and Validation
- Learning Improvement Strategies Themselves
- Hierarchical Learning Loops
Chapter 20: Single-Agent Architectures: Loops, State and Control
- The Basic Agent Loop
- ReAct: Reasoning Plus Acting
- Reflexion and Self-Correction Loops
- Self-Ask and Decomposition Patterns
- Choosing an Architecture for Your Problem
Chapter 21: Multi-Agent Systems: Collaboration, Specialization and Competition
- Why Multiple Agents
- Collaboration Patterns: Handoff and Assembly
- Specialization and Role Assignment
- Competition and Critique Patterns
- Communication Protocols and Alignment
Chapter 22: Hierarchical and Planner-Executor Architectures
- Planning at Multiple Levels
- The Planner-Executor Divide
- Managing Subgoals and Dependencies
- Hierarchical Task Networks
- Delegation and Oversight
Chapter 23: Critic-Evaluator Systems and Learning Loops
- The Role of a Critic
- Designing Effective Evaluators
- Automated vs Human Evaluation
- Integrating Feedback into Improvement
- Avoiding Evaluation Gaming
Chapter 24: Persistent Autonomous Agents
- Long-Horizon Operation
- State Persistence Across Sessions
- Resource Management Over Time
- Drift Detection and Correction
- The Promise and Risk of Persistent Agents
Chapter 25: End-to-End Implementation: A Self-Improving Agent System
- Technology Stack and Project Structure
- Requirements and Dependencies
- Core Data Models
- Memory System Integration
- Core Agent Loop Implementation
- Experience Storage and Retrieval
- Reflection and Self-Evaluation
- Improvement Generation and Validation
- Configuration, Testing and Deployment
- Running and Extending the System
Chapter 26: Evaluation: Measuring Genuine Improvement
- What to Measure and Why
- Benchmark Design for Self-Improving Agents
- A/B Testing and Controlled Experiments
- Regression Detection
- Separating Signal from Noise
Chapter 27: Failure Modes and Risks
- Hallucinated and Corrupted Memories
- Reward Hacking and Goodhart’s Law
- Compounding Errors and Drift
- Overfitting and Catastrophic Forgetting
- Security Vulnerabilities in Self-Modifying Agents
Chapter 28: Safeguards and Reliability Engineering
- Sandboxing and Permission Boundaries
- Human Approval Gates
- Version Control and Immutable Audit Logs
- Reproducible Experiments
- Rollback Mechanisms and Kill Switches
Chapter 29: Deployment, Monitoring and Production Systems
- Observability and Logging
- Performance Monitoring and Budgets
- Scaling and Resource Management
- Incident Response for Autonomous Systems
- Long-Term Maintenance