Agentic AI with LangChain and LangGraph / Module 5 · Knowledge: retrieval, RAG and LCEL / Module project, part 1: why text-to-SQL breaks in production, and an airline analytics agent's design Contents Module 5 · Knowledge: retrieval, RAG and LCEL Contents of the book Module 0 Welcome to the class Trailer: the course, the map, and the excursion desk you will build free, coming What an LLM is, and what makes something an agent free, coming Setup from zero: Python, uv, VS Code, the libraries and your .env file free, coming Module 1 Talking to a model Before the first call: what a chat model is and what one call really sends free, coming Your first model call coming Messages, roles and prompt templates coming Streaming and batching coming LCEL, part 1: join steps with the pipe (prompt | model | parser) coming Images and PDFs: multimodal input coming Any model: reasoning, local models with Ollama, proxies and call settings coming Inside a chat model call: from invoke() to the provider and back (optional) coming Module 2 Tools and structured output How a model 'uses' a tool: the contract on the whiteboard coming Tools: giving the model hands coming Tool calling by hand: the loop without magic coming Server-side tools: when OpenAI runs the tool (needed for Capstone 2) coming Structured output: forms, not essays coming Inside tool calling: schemas, hidden arguments, streamed arguments and structured-output methods (optional) coming Module 3 Your first agent What an agent is made of: the loop, the harness and the stop rule coming create_agent: the loop, built for you coming Watching an agent think: streaming steps coming Memory for one conversation coming Tracing with LangSmith: see every step coming A tiny eval harness: ten cases and a scorer coming State, context and ToolRuntime coming Agent answers as data: response_format coming Inside create_agent: the graph it builds, its state and how it decides to stop (optional) coming Module 4 Reliability and middleware: shaping the loop Why agents fail in production, and where a harness can step in coming Settings, errors and model profiles coming Tokens, money, caching and rate limits coming Middleware: hooks around the loop coming Dynamic prompts coming The built-in toolbox: limits, retries and fallbacks coming Guardrails and personal data coming Human in the loop: approve before you act coming Summaries and context engineering coming The rest of the built-in middleware, and middleware as a class coming Inside the middleware stack: hooks as graph nodes, wrap order and the retry-fallback trap (optional) coming Module project: a customs-declaration assistant with guardrails, approvals and limits coming Module 5 Knowledge: retrieval, RAG and LCEL Why models need your documents: the retrieval pipeline on the board coming Documents, loaders and splitters coming Embeddings and vector stores coming Retrievers: search as a reusable part coming Two-step RAG: always retrieve, then answer coming Agentic RAG: let the agent decide when to search coming LCEL, part 2: output parsers, retrieval chains, retries and fallbacks coming A SQL agent: create_agent answers questions from a database coming Inside retrieval: what a vector store holds, how a search is scored, and keeping the index fresh (optional) coming Module project, part 1: why text-to-SQL breaks in production, and an airline analytics agent's design coming Module project, part 2: build the airline analytics agent, lock it down and measure it coming Module 6 Connect, test and read old code Beyond one script: protocols, memory that outlives a chat, and tests that cost nothing coming Async, servers and your first MCP server coming Remote MCP servers, the old adapter, and trust coming MCP in depth: auth, rich tool results and connections coming Long-term memory across conversations coming Testing agents without paying coming Reading old LangChain code: migrating chains, agents and memory (for returning viewers) (optional) coming Module project: a wind-farm maintenance dispatcher over MCP, with memory and a $0 test suite coming Module 7 LangGraph foundations Why graphs? Your first StateGraph coming Reducers: rules for writing on the clipboard coming Messages in graph state: your first LLM node coming Branching: conditional edges and routing coming Loops and the recursion limit coming Command: update and jump in one return coming Inside compile(): how a StateGraph becomes a Pregel program of actors and channels (optional) coming Module project: a city services request router as a hand-built graph coming Module 8 Agents and workflows in LangGraph Who decides the next step? Control flow in workflows and agents coming The agent loop by hand: ToolNode coming Parallel branches: fan-out and fan-in coming Map-reduce with Send coming Six workflow patterns, and workflow vs agent coming Thinking in LangGraph: a design method coming Inside parallel steps and Send: one super-step, many tasks, and who wins a write (optional) coming Module project, part 1: why supply-chain planning breaks agents, and a disruption planner's design coming Module project, part 2: build the disruption planner with Send, parallel branches and a code check coming Module 9 Persistence and memory Why a graph needs a memory of its own runs: threads, checkpoints and stores coming Checkpointers and threads coming Checkpointer backends: SQLite and Postgres coming Reading and editing the past coming Durable execution: surviving crashes coming Short-term memory: trim, delete, summarize coming Runtime context and config coming Long-term memory stores coming What to remember: semantic, episodic and procedural memory coming Inside a checkpoint: channel values, versions, pending writes and the serializer (optional) coming Module project, part 1: why memory-driven tutors fail, and the design of a tutor that remembers each learner coming Module project, part 2: build the tutor that remembers each learner, and prove memory helps coming Module 10 Humans in the loop and time travel Where the human goes: pausing, deciding and rewinding as a design problem coming interrupt() and resume coming Approve, edit, reject, and many interrupts at once coming Debugging: breakpoints and time travel coming A custom SQL agent as a graph, with a human checking each query coming Mid-course build: a hand-made graph with controls you built yourself coming Inside interrupt(): the exception, the saved writes and how resume values find their place (optional) coming Module project, part 1: why claims automation is hard, and a claim desk that waits for people coming Module project, part 2: build the claim desk: photos, policy, fraud checks, approvals, days-long waits and an audit replay coming Module 11 Streaming, reliability and the engine room Production habits for graphs: showing progress, surviving failure and proving it works coming Streaming modes and event streaming v3 coming Async graphs coming When things break: retries, timeouts, error handlers and drain coming Node caching: do not cook the same dish twice coming The Functional API: the same powers in plain Python (staff track) coming Testing graphs coming Inside the stream: how tokens, updates and events leave the run loop (optional) coming Module project: a nightly mobile-money reconciliation pipeline that survives failures coming Module 12 Multi-agent systems and Deep Agents Why more than one agent? Context, teams and parallel work coming Input, output and private schemas, then subgraphs coming Multi-agent patterns, and leaving langgraph-supervisor coming Handoffs by hand, the docs' state-machine handoff, and interrupts across agents (langgraph-swarm optional, outside the docs) coming The skills pattern: load knowledge only when it is needed coming Deep Agents 1: the harness, the plan and the filesystem coming Inside subgraphs and handoffs: namespaces, bubbling pauses and Command.PARENT (optional) coming Module project, part 1: why incident response breaks agents, and the design of an SRE incident commander coming Module project, part 2: build the incident commander: triage, log search, runbooks, approvals and incident memory coming Module 13 Observe and evaluate with LangSmith Why agents need observability and evaluation: runs, traces, datasets and judges on the board coming Tracing a LangGraph app coming Tracing your own code: @traceable, trace and RunTree coming Custom model and retriever runs, model metadata, files and images coming Where traces go and how many: projects, agents, replicas, conditional tracing and sampling coming Labels and links: tags, metadata, run names, distributed tracing and OpenTelemetry coming Keeping personal data and secrets out of traces, and counting the cost coming Finding the trace that matters: views, filters and query syntax coming Traces as data: export, threads, the LangSmith MCP, bulk export, Insights and custom apps coming Datasets, experiments and the Prompt Hub coming Prompts as versioned artifacts: templates, tools, models and the Playground coming Managing prompts: environments, owners, code, caching and GitHub sync coming Datasets in depth: versions, splits, schemas, imports and attachments coming Running and comparing experiments: async, local, retries, CI gates and the comparison view coming Evaluations without evaluate(): the REST API, OpenTelemetry and uploaded experiments coming Judges: LLM-as-judge, pairwise and trajectory evals coming Evaluator shapes: many scores, categories, summaries, composites and ready-made judges coming How good is good enough? Error analysis, golden sets, statistics and judge checks coming Evaluating the steps: single-step, intermediate-step and graph-node evals coming Managing judges: shared evaluators, dataset binding, spend caps, alignment and corrections coming Annotation queues and human feedback coming Production monitoring: online evals, dashboards and alerts coming Feedback from real users: thumbs, presigned links, assertions and review queues in code coming Automations and online evaluators in depth: rules, webhooks, thread judges and tuned judges coming (Optional) LangSmith for a team: organisations, workspaces, roles, secrets, data retention, limits and cost coming Evals in CI and backtesting: the LangSmith pytest plugin and replaying production coming The same evals and traces without LangSmith: RAGAS, DeepEval, Langfuse and Phoenix coming Beyond prompts and judges: fine-tuning with Smithtune and sandboxed evals with Harbor (optional) coming (Optional) Distilling a small model for routing and tool calls coming Module project, part 1: why negotiation agents are hard to trust, and how to evaluate one coming Module project, part 2: build and evaluate the negotiation desk: traces, datasets, trajectory checks, judges, a CI gate and monitoring coming Module 14 Attack your own agent: security, guardrails and red teaming The two OWASP lists on one board: what can go wrong with an LLM app, and what extra goes wrong when it has tools coming Prompt injection and jailbreaks, step by step: direct, hidden in documents, hidden in tool results coming Stopping an agent from leaking data through its own tools coming Guardrail frameworks as middleware: Llama Guard, NeMo Guardrails, Guardrails AI and Presidio in the loop coming Running model-written code safely coming Red teaming by hand and by machine: garak, PyRIT and promptfoo coming Attacks on memory and between agents coming Module project, part 1: why a payments-disputes agent is a target, and its security design coming Module project, part 2: red-team and harden the disputes desk, and ship the gate in CI coming Module 15 Deploy The new names, and what the Agent Server does coming langgraph.json, the CLI and Studio coming Calling your agent: SDK and RemoteGraph coming Agent Server in depth 1: assistants, runs, double texting and the streaming API coming Agent Server in depth 2: customising the server coming (Optional) Tool Gateway: one governed door between your agents and their MCP tools coming Who is calling? Authentication and access control on the Agent Server coming Deployment options and pricing coming Operating deployments 1: build, test like production, ship and watch coming Operating deployments 2: control plane, data plane, scale and encryption coming The free path: serving without LangSmith coming Module project, part 1: why compliance reviews are hard to automate, and a KYC desk designed for the Agent Server coming Module project, part 2: run the KYC desk on the Agent Server: background runs, webhooks, crons, interrupts, auth and audit traces coming Module 16 Run it on your own infrastructure: deployment, scale and operations A production FastAPI service around a graph: streaming, auth, workers and safe retries coming Postgres and Redis under load: checkpointers that do not fall over coming Docker and Kubernetes for agents coming One graph, three clouds: AWS, Google and Microsoft managed agent runtimes coming A model gateway: one door to every model, with budgets per customer coming Load testing an agent: how many users before it breaks, and what it costs coming Releasing a new prompt or model safely: shadow, canary, A/B and rollback coming When the agent misbehaves in production: incident response coming Rules for agent builders: EU AI Act, NIST AI RMF and India's DPDP, in plain words coming Module project, part 1: why a KYC desk must run inside the bank's own cloud, and its platform design coming Module project, part 2: run the KYC desk on Kubernetes behind a gateway, load-test it and rehearse an incident coming Module 17 Deep Agents in depth The harness up close: four parts, every parameter, and building it from scratch coming Models, harness profiles, tools and images in a deep agent coming Backends and permissions: where a deep agent's files live, and who may touch them coming Sandboxes: letting a deep agent run code without touching your computer coming LangSmith Sandboxes: snapshots, service URLs, download links, the auth proxy and mounts coming Skills: know-how a deep agent opens only when it needs it coming Memory and context engineering in a deep agent: what it starts with, what it keeps, what it forgets coming Retrieval in a deep agent, and an agent configured by files: RAG and the content builder coming LangSmith Context Hub: versioned agents and skills, promotions and commit webhooks coming Subagents in depth: custom, compiled, general-purpose and forked, and a deep research agent coming Interpreters and dynamic subagents: let the agent write the loop coming Async subagents: background jobs the supervisor can check, steer and cancel coming Steering a deep agent: approvals, grading rubrics, and a weekly review end to end coming Watching a deep agent work: streaming, event streaming and tracing subagents coming Taking a deep agent to production: tenants, sandboxes, secrets, memory scope and fault tolerance coming Deep agents in editors and frontends: ACP and AG-UI (optional) coming Deep Agents Code (dcode): a terminal coding agent you can read, steer and extend coming Managed Deep Agents 1: an agent as a folder of files, from mda init to mda deploy coming Managed Deep Agents 2: memory, sandbox, identity, connections, Slack and webhooks, schedules and evals coming Managed Deep Agents 3: patterns (watch mode, goals, dreaming, swarm), browser use, subagents and your own frontend coming (Optional) A browser agent you can trust: Playwright or a managed browser, and injection from web pages coming Module project, part 1: why codebase migrations break coding agents, and a deep-agent migrator's design coming Module project, part 2: build and evaluate the deep-agent migrator on a real repository coming Module 18 Faces for agents: frontends and generative UI (optional) Faces for agents 1: useStream, the generative UI spectrum and a deployed chat page (optional) coming Faces for agents 2: rendering messages and controlling runs (optional) coming Faces for agents 3: history, headless tools, graph views and Deep Agents UIs (optional) coming Module 19 Capstone projects Capstone 1 of 3: a multi-tenant regulatory research assistant that corrects its own retrieval coming Capstone 2 of 3: a due-diligence research desk with parallel specialist researchers coming Capstone 3 of 3 (finale): a payments disputes and refunds platform on demo day coming Bonus: decision models in the disputes triage, with the Jev model and OpenAI's Decisions API coming Bonus: decision models that read images, with Box answers coming Bonus: a voice agent, the sandwich way (optional) coming (Optional) Voice agents in production: latency budget, interruptions and phone lines coming Module 20 Staff level and interviews The landscape: where LangChain and LangGraph fit coming The engine room: Pregel, channels and shipping changes safely coming Cost and operations at scale coming Agent security architecture coming The agent system design interview, live coming Build your own: custom checkpointers, stores and LangChain integrations coming Module project, part 1: a design review at ten times the volume: the design document and the cost model coming Module project, part 2: the design review's threat model, evaluation plan and rollout coming The four exam areas and how to keep learning coming Module 5 · Knowledge: retrieval, RAG and LCEL
Module project, part 1: why text-to-SQL breaks in production, and an airline analytics agent's design A lesson of Module 5, Knowledge: retrieval, RAG and LCEL: Module project, part 1: why text-to-SQL breaks in production, and an airline analytics agent's design. About 13 minutes of video.
This lesson is being recorded and is not released yet Lessons are published in book order. Everything published later is included when you buy the course.
See the contents of the book or read what the course covers .