AI Agents
Software that reasons, calls tools, and acts on its own, instead of a model that only answers one prompt. Thirty-three lessons from the agent loop through tools, memory, multi-agent architectures and the frameworks used to ship them, to evaluating and deploying agents safely.
What are AI agents?An AI agent perceives, decides, and acts in a loop toward a goal — a different shape from a model that only answers one prompt.The agent loopPerceive, reason, act, observe: the repeating cycle that lets an agent take several steps toward a goal instead of one.Agents vs. workflowsA fixed pipeline where code decides the next step is a workflow; a true agent is one where the model decides, including when to stop.When to use an agentA practical test for whether a task's unpredictability is worth an agent's cost, latency, and occasional wrong turns.Chain-of-thought promptingAsking a model to reason step by step before answering, so its own intermediate tokens become working memory it can condition on.ReAct: reasoning and actingInterleaving explicit reasoning with tool calls and their results, so each observation reshapes the next thought instead of planning blind.Tree of thoughtExploring several candidate reasoning paths at once, scoring and pruning them, instead of committing to one linear chain from the start.Self-critique and reflectionAn agent reviewing its own draft or plan against the goal, catching a specific flaw, and revising before continuing or finalizing.What are tools?Giving a model a function it can call turns it from a text generator into something that can fetch real information and act in the world.Tool definitions and schemasA tool is only as useful as its description — the name, prose, and JSON schema that tell a model when to call it and how to fill in its arguments.Native function callingModern LLM APIs return a structured tool call instead of free text, so you no longer have to parse a model's words and hope they are machine-readable.Error handling for tool callsTool calls fail, time out, and return garbage, so a reliable agent needs retries, backoff, and a hard stop — not blind faith that every call succeeds.What is the Model Context Protocol?Anthropic's open standard for wiring LLM apps to tools and data — it turns N times M integrations into N plus M.MCP hosts, clients, and serversThe three roles in MCP's architecture, and how a chat app, its built-in client, and a separate tool server fit together.Building an MCP serverWhat it actually takes to write an MCP server that exposes a tool — a name, a schema, a function, and a process a client can connect to.MCP vs. custom integrationsWhen MCP's standardization earns its overhead, and when a direct, custom tool integration is simply the better call.Short-term vs. long-term memoryWhat fits in an agent's context for the current task versus what gets deliberately saved to an external store for next time.Conversation and episodic memoryThe difference between keeping a chat transcript around and extracting specific, reusable facts from past conversations.Vector memory and RAG for agentsHow embeddings and a vector database let an agent retrieve semantically relevant memories on demand instead of keeping everything in context.Memory compression and forgettingWhy an agent must deliberately summarize or discard old memory, and the concrete strategies for deciding what survives.RAG agentsRetrieval as a decision the agent makes mid-task, not a fixed step that always runs once before generation.The planner–executor patternDeciding the whole sequence of steps up front versus one step at a time, and why some designs do both.Multi-agent systemsSpecialized agents collaborating on a task, and the real, debated tradeoff between that and one well-designed agent.Graph and DAG orchestrationModeling an agent's workflow as explicit nodes and edges, with branching and shared state, instead of one implicit loop.LangChain and LangGraphWhy a chain-composition library grew a second, graph-based layer on top of it once agents needed to loop, branch, and remember state.LlamaIndex for agentsA retrieval-first framework grew agent features on top of its indexing strength, which shows in exactly which agents it's the strongest choice for.CrewAI and AutoGenTwo different mental models for coordinating multiple agents — a role-based crew versus agents that message each other like a group chat.Provider-native agent SDKsModel providers now ship their own first-party agent tooling — the fastest path to a working agent, at the price of being locked to that provider.Evaluating agent performanceJudging an agent means judging the whole trajectory it took, not just whether the final answer happened to be correct.Tracing and observabilityLogging every prompt, tool call, and intermediate step an agent takes, so a human can actually tell why it did what it did.Human-in-the-loop evaluationCheckpoints where a human approves, edits, or answers a question before a risky agent action proceeds, instead of letting it act fully alone.Deploying and scaling agentsWhat changes when an agent has to run as a real service under concurrent load, instead of as a script on one machine.Guardrails for agentsConstraining what an agent is actually allowed to do, so a mistake or a manipulated input can't turn into a consequential real-world action.
What an agent actually is
- What are AI agents?An AI agent perceives, decides, and acts in a loop toward a goal — a different shape from a model that only answers one prompt.
- The agent loopPerceive, reason, act, observe: the repeating cycle that lets an agent take several steps toward a goal instead of one.
- Agents vs. workflowsA fixed pipeline where code decides the next step is a workflow; a true agent is one where the model decides, including when to stop.
- When to use an agentA practical test for whether a task's unpredictability is worth an agent's cost, latency, and occasional wrong turns.
How an agent decides what to do next
- Chain-of-thought promptingAsking a model to reason step by step before answering, so its own intermediate tokens become working memory it can condition on.
- ReAct: reasoning and actingInterleaving explicit reasoning with tool calls and their results, so each observation reshapes the next thought instead of planning blind.
- Tree of thoughtExploring several candidate reasoning paths at once, scoring and pruning them, instead of committing to one linear chain from the start.
- Self-critique and reflectionAn agent reviewing its own draft or plan against the goal, catching a specific flaw, and revising before continuing or finalizing.
Giving a model hands
- What are tools?Giving a model a function it can call turns it from a text generator into something that can fetch real information and act in the world.
- Tool definitions and schemasA tool is only as useful as its description — the name, prose, and JSON schema that tell a model when to call it and how to fill in its arguments.
- Native function callingModern LLM APIs return a structured tool call instead of free text, so you no longer have to parse a model's words and hope they are machine-readable.
- Error handling for tool callsTool calls fail, time out, and return garbage, so a reliable agent needs retries, backoff, and a hard stop — not blind faith that every call succeeds.
A standard way to wire up tools
- What is the Model Context Protocol?Anthropic's open standard for wiring LLM apps to tools and data — it turns N times M integrations into N plus M.
- MCP hosts, clients, and serversThe three roles in MCP's architecture, and how a chat app, its built-in client, and a separate tool server fit together.
- Building an MCP serverWhat it actually takes to write an MCP server that exposes a tool — a name, a schema, a function, and a process a client can connect to.
- MCP vs. custom integrationsWhen MCP's standardization earns its overhead, and when a direct, custom tool integration is simply the better call.
What an agent carries between steps
- Short-term vs. long-term memoryWhat fits in an agent's context for the current task versus what gets deliberately saved to an external store for next time.
- Conversation and episodic memoryThe difference between keeping a chat transcript around and extracting specific, reusable facts from past conversations.
- Vector memory and RAG for agentsHow embeddings and a vector database let an agent retrieve semantically relevant memories on demand instead of keeping everything in context.
- Memory compression and forgettingWhy an agent must deliberately summarize or discard old memory, and the concrete strategies for deciding what survives.
Patterns for stringing steps together
- RAG agentsRetrieval as a decision the agent makes mid-task, not a fixed step that always runs once before generation.
- The planner–executor patternDeciding the whole sequence of steps up front versus one step at a time, and why some designs do both.
- Multi-agent systemsSpecialized agents collaborating on a task, and the real, debated tradeoff between that and one well-designed agent.
- Graph and DAG orchestrationModeling an agent's workflow as explicit nodes and edges, with branching and shared state, instead of one implicit loop.
What you reach for instead of hand-rolling it
- LangChain and LangGraphWhy a chain-composition library grew a second, graph-based layer on top of it once agents needed to loop, branch, and remember state.
- LlamaIndex for agentsA retrieval-first framework grew agent features on top of its indexing strength, which shows in exactly which agents it's the strongest choice for.
- CrewAI and AutoGenTwo different mental models for coordinating multiple agents — a role-based crew versus agents that message each other like a group chat.
- Provider-native agent SDKsModel providers now ship their own first-party agent tooling — the fastest path to a working agent, at the price of being locked to that provider.
Trusting an agent with real traffic
- Evaluating agent performanceJudging an agent means judging the whole trajectory it took, not just whether the final answer happened to be correct.
- Tracing and observabilityLogging every prompt, tool call, and intermediate step an agent takes, so a human can actually tell why it did what it did.
- Human-in-the-loop evaluationCheckpoints where a human approves, edits, or answers a question before a risky agent action proceeds, instead of letting it act fully alone.
- Deploying and scaling agentsWhat changes when an agent has to run as a real service under concurrent load, instead of as a script on one machine.
- Guardrails for agentsConstraining what an agent is actually allowed to do, so a mistake or a manipulated input can't turn into a consequential real-world action.