From Fundamentals to Production-Grade Autonomous Systems
Introduction
Chapter 1: What Is an Agent?
- The Agency Spectrum: From Scripts to Autonomous Systems
- Defining Agents: Perception, Reasoning, Action, Goal-Directedness
- Historical Context: From ELIZA to Modern Agentic Systems
- When to Use Agents (and When Not To)
- Summary
Chapter 2: Evolution of Software Development Paradigms
- The Imperative to Declarative Shift
- From APIs to Natural Language Interfaces
- The Rise of Generative AI in Software Engineering
- Architectural Implications of Non-Deterministic Components
- Summary
Chapter 3: Core Principles of Agentic Design
- Bounded Autonomy and Controlled Agency
- The Tool-First Philosophy
- Explicit State and Deterministic Flows Around Non-Deterministic Cores
- Observability as a First-Class Requirement
- Fail-Safe Design and Graceful Degradation
- Summary
Chapter 4: Agent Architectures and Patterns
- The ReAct Pattern: Reasoning and Action Loops
- Plan-and-Execute Architectures
- Reflex and Deliberative Agent Models
- Hierarchical and Multi-Level Planning
- Pattern Selection Criteria for Real-World Systems
- Summary
Chapter 5: LLM Integration Fundamentals
- Model Selection: Open Source vs. Proprietary, Specialized vs. General
- API Integration Patterns and Client Libraries
- Token Economics and Context Window Management
- Handling Non-Determinism and Output Variability
- Rate Limits, Timeouts and Resilience
- Summary
Chapter 6: Prompt Engineering for Agents
- System Prompts as Agent Constitutions
- Role Definition and Persona Engineering
- Few-Shot Prompting and Exemplar Design
- Constraint Specification and Guardrails
- Iterative Prompt Refinement and Versioning
- Summary
Chapter 7: Structured Outputs and Function Calling
- Schema-Defined Outputs and JSON Mode
- OpenAI Structured Outputs with Strict Schema Enforcement
- Native Function Calling APIs
- Output Validation and Retry Patterns
- Handling Partial and Malformed Responses
- Comparison of Structured Output Techniques
- Summary
Chapter 8: Tools and Function Calling in Depth
- Tool Design Principles: Determinism, Idempotency, Observability
- Tool Discovery and Dynamic Loading
- Permission Systems and Access Control for Tools
- Error Handling and Tool Failure Recovery
- Building and Organizing Large Toolsets
- Summary
Chapter 9: Agent Reasoning and Planning
- Task Decomposition Strategies
- Chain-of-Thought and Its Variants
- Goal Hierarchies and Subgoal Management
- Backtracking and Plan Revision
- Planning Algorithms for Agentic Systems
- Summary
Chapter 10: State Management and Memory
- Working Memory and Context Windows
- Short-Term and Long-Term Memory Systems
- Memory Summarization and Compression Techniques
- State Persistence and Recovery
- Designing Stateful Agent Applications
- Summary
Chapter 11: Context Engineering
- The Context Budget: Managing Limited Tokens
- Context Assembly Strategies
- Information Prioritization and Ranking
- Dynamic Context Adaptation
- Context Window Best Practices
- Summary
Chapter 12: Retrieval-Augmented Generation (RAG)
- RAG Fundamentals and Architecture
- Document Processing and Chunking Strategies
- Query Transformation and Expansion
- Re-Ranking and Result Selection
- Advanced RAG Patterns: Multi-Hop, Graph-Based, Self-RAG
- Summary
Chapter 13: Vector Databases and Embeddings
- Embedding Models: Selection and Fine-Tuning
- Vector Indexing Algorithms and Trade-Offs
- Hybrid Search: Combining Vector and Keyword
- Vector Database Comparison and Selection
- Scaling Vector Search in Production
- Summary
Chapter 14: Knowledge Graphs for Agents
- Knowledge Graph Fundamentals for AI
- Graph Construction from Unstructured Data
- Graph-Based Reasoning and Querying
- Combining Knowledge Graphs with RAG
- Graph Storage Technologies and Trade-Offs
- Summary
Chapter 15: Multi-Agent Orchestration
- Why Multi-Agent: Specialization and Scalability
- Supervisor-Worker Architectures
- Consensus and Voting Mechanisms
- Conflict Resolution and Negotiation
- Orchestrator Design Patterns
- Summary
Chapter 16: Inter-Agent Communication
- Message Passing and Protocol Design
- Shared Memory and Blackboard Architectures
- Synchronous vs. Asynchronous Communication
- Communication Efficiency and Token Costs
- Fault-Tolerant Multi-Agent Communication
- Summary
Chapter 17: Model Context Protocol (MCP) and Standardization
- MCP Architecture and Philosophy
- MCP Servers, Clients and Resources
- Building MCP-Compliant Tools and Services
- Ecosystem and Interoperability
- Beyond MCP: Competing Standards and Future Directions
- Summary
Chapter 18: Code Execution and Sandboxing
- The Security Imperative for Code Execution
- Container-Based Sandboxing
- Language-Specific Execution Environments
- Resource Limits and Abuse Prevention
- Build and Dependency Management for Agents
- Summary
Chapter 19: AI-Assisted Coding Workflows
- Agent-Assisted Code Generation
- Refactoring and Code Improvement Agents
- Documentation Generation with Agents
- Integration with IDEs and Developer Tools
- Collaborative Human-Agent Development Patterns
- Summary
Chapter 20: Autonomous Debugging and Testing
- Bug Discovery and Root Cause Analysis
- Test Generation Strategies
- Automated Fix Proposals
- Property-Based and Fuzz Testing with Agents
- Validation and Trust in Agent-Generated Fixes
- Summary
Chapter 21: Code Review Agents
- Designing Review Agents: Criteria and Priorities
- Static Analysis Integration
- Style, Security and Logic Review
- Interactive Review Conversations
- Measuring Review Agent Effectiveness
- Summary
Chapter 22: Security and Privacy
- Prompt Injection Attacks and Defenses
- Indirect Injection and Data Poisoning
- Secrets Management and Credential Handling
- Access Control and Least Privilege
- Adversarial Testing and Red Teaming
- Summary
Chapter 23: Reliability and Fault Tolerance
- Error Classification and Handling Strategies
- Retry Logic, Backoff and Circuit Breakers
- Checkpointing and Recovery
- Concurrency and Parallel Execution
- Testing Agent Reliability
- Summary
Chapter 24: Observability and Evaluation
- Logging, Tracing and Metrics for Agents
- Agent Execution Tracing
- Evaluation Methodologies: Automated and Human
- Benchmarking and Regression Testing
- Continuous Monitoring and Alerting
- Summary
Chapter 25: Scalability and Cost Optimization
- Token Usage Optimization
- Model Cascading and Routing
- Caching Strategies
- Batch Processing and Queueing
- Infrastructure and Deployment Patterns
- Summary
Chapter 26: Human-in-the-Loop and Bounded Autonomy
- Designing Human-in-the-Loop Systems
- Confidence-Based Escalation
- Feedback Integration and Continuous Improvement
- Audit Trails and Accountability
- Governance, Policy and Organizational Alignment
- Summary
Chapter 27: Advanced Architectural Patterns
- Reflection and Self-Correction
- Multi-Agent Consensus and Debate
- Agent Markets and Task Auctioning
- Hierarchical Planning and Goal Decomposition
- Emergent Patterns and Hybrid Architectures
- Summary
Chapter 28: Emerging Research and Future Directions
- Current State of the Field
- Long-Horizon Task Planning
- Agentic Workflows and Autonomous Agents
- Agent Societies and Ecosystems
- Reasoning and Planning Advances
- Verification, Formal Methods and Safety
- Standardization and Interoperability
- Open Problems and Research Gaps
- Future Outlook
- Summary
Conclusion: Building the Future of Software with Agents
- A Practical Framework for Agentic Systems
- Key Lessons
- The Journey Ahead