AI Agents¶
Intermediate → Advanced · 9 topics
After RAG, agents are the other big GenAI hiring topic. An agent is an LLM that decides what to do next: which tool to call, what to search, when it's done. Instead of following a script, it works in a loop. That makes agents powerful for open-ended tasks, and harder to make reliable, safe and affordable. This series builds one from scratch, then adds everything production agents need.
# Every example on these pages runs offline with the Python standard library: the "LLM" is scripted, so you
# can watch the agent loop step by step. Code that needs an API key or a framework is marked "no-run".
| # | Topic | Sub-topics |
|---|---|---|
| 1 | What an agent is | Workflows vs agents · the agent loop · components · levels of autonomy · why reliability compounds · when not to build one |
| 2 | ReAct from scratch | Thought → Action → Observation · the prompt · parsing · stop sequences · tool errors · step limits · ReAct vs native tool calling |
| 3 | Planning | Plan-and-execute · task dependencies · re-planning on failure · reflection · ReWOO · when to plan up front |
| 4 | Memory | Short-term window and summaries · long-term memory store · episodic memory · what to remember · privacy |
| 5 | Tools and MCP | Tool registry and argument validation · errors as observations · choosing among many tools · MCP servers and clients |
| 6 | Agents in LangGraph | Prebuilt agents · custom agent graphs · state design · guard nodes · checkpoints · streaming steps · subgraphs |
| 7 | Multi-agent patterns | Supervisor · handoffs · hierarchical teams · parallel fan-out · debate · shared state · cost of more agents |
| 8 | Evaluating agents | Final answer vs trajectory · tool-call accuracy · task success · efficiency · test suites · regression in CI |
| 9 | Safety and human approval | Threat model · least privilege · approval gates · budgets · sandboxing · prompt injection through tools · audit logs |
flowchart LR
U[Goal] --> L{LLM decides}
L -->|call a tool| T[Tool] --> O[Observation] --> L
L -->|needs approval| H[Human] --> L
L -->|done| A[Answer]
M[(Memory)] <--> L
Before you start
Agents build on structured output & tool calling (the tool loop) and LangGraph (state, checkpoints, interrupts). When plain SDK code is better has a 40-line agent you can compare with the ones here.
Back to: Notes overview