# Agentic Ai Engineering
All Agentic Ai Engineering notes →1. Tool Calling Architecture
Covers the mechanics of function/tool calling in modern LLM APIs -- schema definition, the model's structured-call output, execution, and result injection back into the conversation -- as the foundational primitive every agent framework builds on.
2. APIs as Tools
Covers wrapping arbitrary external APIs as agent tools -- authentication handling, request/response schema translation, and error surfacing patterns so API failures degrade gracefully instead of confusing the agent's reasoning.
3. REST & GraphQL Integration
Covers integrating REST and GraphQL services as agent tools specifically, including schema introspection for GraphQL, pagination handling, and rate-limit-aware retry design distinct from generic API wrapping.
4. Database Tools
Covers giving an agent direct database access as a tool -- text-to-SQL generation, read-only scoping, query validation before execution, and the injection-attack surface unique to letting an LLM generate queries against production data.
5. Search Tools
Covers search as an agent tool -- web search APIs, retrieval-augmented search over internal corpora, and result-ranking/summarization strategies that keep search results from overwhelming the agent's context budget.
6. Browser Automation
Covers browser automation as an agent tool -- headless browser control, DOM parsing and accessibility-tree extraction for the agent to reason over, and the reliability challenges of dynamic, JavaScript-heavy pages.
7. Computer Use Agents
Covers computer-use agents that operate a full desktop GUI via screenshots and coordinate-based actions rather than structured APIs, and the accuracy, latency, and safety tradeoffs versus API-based or browser-DOM-based tool access.
8. Code Execution
Covers sandboxed code execution as an agent tool -- isolation boundaries, resource limits, and output capture -- for tasks better solved by generating and running code than by reasoning about the answer directly.
9. Model Context Protocol (MCP)
Covers the Model Context Protocol as a standardized interface between agents and external tools/data sources, why it emerged to replace bespoke per-framework tool integrations, and its client-server architecture for tool discovery and invocation.
10. Tool Discovery
Covers how agents discover which tools are available and applicable at runtime -- static registration versus dynamic discovery, tool metadata/schema design, and scaling tool catalogs beyond what fits in a single prompt.
11. Tool Selection Strategies
Covers strategies for selecting the right tool among many candidates -- embedding-based tool retrieval, hierarchical tool routing, and the accuracy degradation observed as the number of available tools grows past what a single LLM call can reliably discriminate.
12. Tool Security
Covers the security model for agent tool use -- least-privilege scoping, output sanitization against prompt injection carried in tool results, approval gates for destructive actions, and audit logging for what an agent actually executed.
13. Agents in CI/CD & SDLC Workflows
Covers how coding agents establish execution context, get scoped to a single repository and branch, get triggered by CI/SDLC events, and act autonomously via branch/PR creation while merge stays gated -- using GitHub Copilot's coding agent as the reference implementation.
14. Safe Execution Paths & Error Handling
Covers the error-handling taxonomy, retry design, rollback mechanics, escalation paths, and traceability record that let an agent operate safely when a tool call fails -- grounded in GitHub Copilot coding agent's CI-driven retry loop and git-native audit trail.
1. What is Agentic AI?
What makes a system 'agentic' rather than a chatbot or a script, the recurring design patterns, real-world use cases, and the engineering mindset this book assumes.
2. Agent vs Workflow vs Automation
Draws the architectural line between a fixed automation script, a deterministic workflow or DAG, and a true agent with dynamic control flow — the distinction interviewers probe first when evaluating whether agent is the right word.
3. Characteristics of Intelligent Agents
Defines the properties that qualify a system as agentic — autonomy, goal-directedness, environment perception, and adaptive planning — as a checklist for distinguishing genuine agentic behavior from a chatbot with extra steps.
4. Agent Lifecycle
Covers an agent's full lifecycle from initialization and context loading through the perceive-plan-act-reflect loop to termination or handoff, and where state must persist versus reset between invocations.
5. Agent Taxonomy
Classifies agent architectures — reactive, deliberative, hybrid, and multi-agent — and maps each classification to the production use cases and reliability tradeoffs it's best suited for.
6. Agent Design Principles
When a deterministic system beats an agentic one, how to choose and scope tools, prompt engineering, error handling, guardrails, and security considerations that apply before any code is written.
7. When NOT to Build an Agent
Covers the decision criteria for rejecting an agentic architecture in favor of a simpler deterministic pipeline — bounded task scope, latency and cost sensitivity, and auditability requirements that agents make harder to satisfy.
8. AI Agent Use Cases
Surveys production-proven agent use cases — customer support triage, code review, incident investigation, and research synthesis — with the common architectural shape each one shares underneath the domain-specific framing.
9. Enterprise Adoption Patterns
Covers how enterprises roll out agentic systems safely — human-in-the-loop gating, phased autonomy levels, audit logging, and the org-level governance structures that precede a full-autonomy deployment.
1. Perception
Covers how an agent ingests and represents its environment — structured tool outputs, unstructured text, multimodal inputs — and the encoding choices that determine what the planning stage can reason over.
2. Decision Making
Covers the decision-making layer that selects the next action from the perceived state — utility scoring, rule-based gating, and LLM-driven choice — and how confidence and risk thresholds shape when an agent should act versus escalate.
3. Planning
Covers agent planning strategies — task decomposition, hierarchical planning, and plan-and-execute versus ReAct-style interleaved planning — and the tradeoffs between upfront planning cost and adaptive replanning.
4. Reasoning
Covers the reasoning strategies an agent applies mid-execution — chain-of-thought, tree-of-thought, and tool-augmented reasoning — and how reasoning depth trades off against latency and token cost in a production loop.
5. Reflection
Covers self-evaluation loops where an agent critiques its own intermediate output before acting on it, the prompting patterns that implement reflection, and the measurable quality gains versus the added round-trip cost.
6. Self-Correction
Covers how an agent detects and repairs its own errors mid-task — retry-with-feedback loops, validator-driven correction, and the failure boundary where self-correction should hand off to a human instead of looping indefinitely.
7. Learning Loops
Covers how agents improve across invocations without full retraining — memory-based few-shot adaptation, prompt or policy updates from feedback signals, and the online-eval loop that turns production traces into improvement signal.
8. Agent State Machines
Covers modeling an agent's execution as an explicit state machine — states, transitions, and guards — as the pattern that makes agent behavior debuggable, testable, and resumable compared to an implicit prompt-driven loop.
9. Goal-Oriented Behavior
Covers how an agent maintains and decomposes a top-level goal across multi-step execution, tracks partial progress, and resolves conflicts between sub-goals without losing sight of the original objective.
10. Autonomous Execution
Covers the execution layer that carries a planned action through to completion without human intervention — action validation, rollback and compensation on failure, and the autonomy-level gating that determines how much an agent is trusted to do unsupervised.
1. Why Agents Need Memory
Frames the stateless-by-default nature of LLM inference and why an agent operating across multiple tool calls, sessions, or users needs an explicit memory subsystem rather than relying on the context window alone.
2. Context Windows
Covers context window mechanics -- token budgets, attention cost scaling, and the tradeoffs between stuffing history into the prompt versus offloading it to external memory as conversations grow beyond a model's context limit.
3. Working Memory
Covers the agent's working memory -- the mutable scratchpad of current task state, intermediate reasoning, and tool outputs that lives only for the duration of a single execution loop.
4. Short-Term Memory
Covers short-term memory as bounded, session-scoped conversation history -- sliding windows, summarization-on-overflow, and the tradeoffs of truncation versus compression when a session outlives the context budget.
5. Long-Term Memory
Covers persistent long-term memory that survives across sessions and restarts -- durable storage backends, write/consolidation policies, and how an agent decides what's worth remembering permanently versus discarding.
6. Semantic Memory
Covers semantic memory as structured factual and conceptual knowledge decoupled from any specific conversation, and how agents store and query general world/domain knowledge distinct from episodic event history.
7. Episodic Memory
Covers episodic memory as a log of specific past events and interactions -- what happened, when, and in what context -- and how agents use it for recall of prior incidents, user preferences, and precedent-based reasoning.
8. Memory Storage Architectures
Compares the storage architectures underpinning agent memory -- relational stores, key-value stores, document stores, and hybrid designs -- and the read/write access patterns that should drive the choice for a given memory type.
9. Vector Databases
Covers vector database fundamentals for agent memory -- embedding generation, ANN indexing such as HNSW and IVF, similarity metrics, and the recall/latency/cost tradeoffs relevant to a MAANG-level system design conversation.
10. Knowledge Graphs
Covers knowledge graphs as a structured alternative to vector similarity search -- entity-relationship modeling, graph traversal for multi-hop reasoning, and when graph-based retrieval outperforms embedding-based retrieval for agent memory.
11. Memory Retrieval
Covers retrieval strategies for pulling relevant memory back into an agent's context -- similarity search, recency/relevance/importance scoring, hybrid retrieval, and re-ranking before injection into the prompt.
12. Memory Compression
Covers techniques for compressing accumulated memory before it consumes context budget -- summarization hierarchies, reflection-based consolidation, and lossy versus lossless tradeoffs as an agent's history grows unbounded.
13. Memory Versioning
Covers versioning and conflict resolution for agent memory that changes over time -- handling contradictory updates, temporal validity windows, and rollback when a memory write turns out to be wrong.
1. Chain of Thought
Covers Chain-of-Thought prompting -- eliciting intermediate reasoning steps before a final answer -- why it improves multi-step task performance, and its limits on tasks requiring backtracking or exploration.
2. ReAct
Covers the ReAct pattern -- interleaving reasoning traces with tool-invoking actions in a single loop -- and why it became the default architecture for tool-using agents over pure chain-of-thought or plan-then-execute approaches.
3. Self-Consistency
Covers self-consistency decoding -- sampling multiple independent reasoning paths and taking a majority vote over final answers -- as a test-time technique for improving reliability without additional training.
4. Tree of Thoughts
Covers Tree-of-Thoughts search -- exploring multiple reasoning branches with lookahead and backtracking -- and when the added inference cost is justified over a single linear chain-of-thought pass.
5. Graph of Thoughts
Covers Graph-of-Thoughts reasoning, where intermediate thoughts can merge, refine, and feed back into each other as a DAG rather than a tree, and the problem classes where this generalization pays off over Tree-of-Thoughts.
6. Reflexion
Covers the Reflexion pattern -- an agent critiquing its own failed attempt in natural language and feeding that self-reflection back into the next attempt -- as a lightweight alternative to gradient-based learning from mistakes.
7. Plan-and-Execute
Covers Plan-and-Execute as a reasoning strategy -- front-loading a full plan in one reasoning pass before any tool result exists, versus ReAct's step-by-step interleaving of reasoning and observation -- and the stale-plan failure mode that ordering creates.
8. Program-Aided Language Models
Covers Program-Aided Language Models (PAL) -- offloading deterministic computation to generated code executed by an interpreter instead of having the LLM compute the answer directly -- and why this eliminates a specific class of arithmetic and logic errors.
9. LLM Compiler
Covers the LLM Compiler pattern -- planning a DAG of tool calls upfront and executing independent branches in parallel -- and the latency and cost wins over sequential ReAct-style execution for tasks with parallelizable sub-steps.
10. Debate & Critic Agents
Covers multi-agent debate and critic architectures, where separate agent roles argue opposing positions or critique a proposer's output, and the evidence for when this improves answer quality over single-agent self-reflection.
11. Hierarchical Planning
Covers hierarchical planning -- decomposing a goal into subgoals handled by higher- and lower-level planners at different abstraction levels -- and how this scales agent reasoning to long-horizon tasks that flat planning approaches struggle with.
1. Retrieval-Augmented Generation (RAG)
Covers the core RAG pipeline of indexing, retrieval, and generation, and why retrieval quality bounds answer quality regardless of how large the LLM's context window is.
2. Embeddings
Explains how embedding models turn text into dense vectors and the dimensionality, cost, and quality tradeoffs an architect weighs when picking a commercial versus open-source embedding model.
3. Chunking Strategies
Compares fixed-size, recursive, and semantic chunking strategies and how chunk boundary choices determine whether retrieved passages preserve the meaning needed to answer a query.
4. Vector Search
Covers the approximate nearest neighbor algorithms (HNSW, IVF) behind vector databases and the recall, latency, and memory tradeoffs involved in choosing an index type at scale.
5. Hybrid Search
Explains why combining dense vector similarity with sparse keyword search (BM25) outperforms either alone, and how to fuse and weight the two result sets.
6. Reranking
Covers cross-encoder reranking models that reorder an initial retrieval candidate set for precision, and when the added latency cost is justified in a production pipeline.
8. Agentic RAG
Covers RAG architectures where an agent decides when and what to retrieve, iteratively refining queries and evaluating retrieved evidence rather than retrieving once up front.
9. GraphRAG
Explains how knowledge-graph-structured retrieval captures entity relationships and multi-hop reasoning that pure vector similarity search misses.
10. Multi-Stage Retrieval
Covers pipelines that chain coarse-to-fine retrieval stages, from candidate generation through filtering to reranking, to balance recall and precision at scale.
1. Context Assembly
How the final prompt an agent actually sends gets built from disparate sources — system instructions, retrieved chunks, memory, tool schemas, and conversation history — and why where a piece sits changes how much the model attends to it.
2. Context Ranking
Covers scoring and ordering already-selected context fragments -- retrieved chunks, memory items, tool output, and prior turns -- by semantic similarity, recency, source authority, and prior usefulness before they compete for a fixed token budget, and the near-duplicate crowding failure mode that ranking by similarity alone produces.
3. Memory Selection
The policy layer between memory retrieval and context assembly -- deciding which of the memories retrieval surfaced are actually worth spending tokens on for this specific turn, and why over-including memory is its own failure mode, not just a cost line item.
4. Prompt Budgets
Allocating a fixed token budget across system prompt, tool schemas, conversation history, retrieved context, and memory -- concrete allocation math, what happens when the budget is exceeded, and why percentage-based budgets break the moment you swap context-window sizes.
5. Retrieval Policies
The decision layer that sits in front of Part 05's retrieval mechanics — whether to retrieve at all, how much to pull for a given query, and from which knowledge source, what over- and under-retrieving each cost you, and how Agentic RAG relocates the whole policy into the model's own reasoning loop.
6. Context Compression
Summarization, extractive pruning, and structured compression for fitting more signal into less context — and the risk every one of them shares: silently dropping the one detail the model actually needed this turn.
7. Prompt Compilers
Covers the emerging, deliberately-not-yet-standardized idea of treating context assembly as a compilation step -- a declarative spec of what a turn needs compiled through a coherent pass of ranking, budgeting, and compression -- instead of hand-assembled string concatenation that degrades as context sources multiply.
Agentic AI Engineering
A book-shaped table of contents for Agentic AI Engineering: where 'LLM application' becomes 'agent' — introduction to agentic AI, agent cognition, memory systems, planning & reasoning algorithms, tools & environment interaction, retrieval & knowledge systems, and context engineering. Book 2 of the AI Systems Engineering series.