Agentic AI

LangGraph components

State schemas, chains inside graphs, tools, the ReAct agent, memory and streaming.

The parts that turn a chatbot graph into an agent. The module starts with the state itself: the same graph over a TypedDict, a dataclass and a Pydantic model, and what each one checks. Then a model gets tools inside a graph: ToolNode runs what the model asks for and tools_condition routes to it, first as a router that decides once, with one tool and then with search tools for arXiv, Wikipedia and the web. One edge back from the tools to the model turns the router into a ReAct agent that acts, observes and reasons until it can answer. A checkpointer gives the agent a memory per conversation thread, and streaming shows each step and token as it happens, ending with the whole agent in one script with Gemini. Run the notebook cells in order, and try each practice task before you open its solution.

Lessons

  1. 1State schemas: TypedDict, dataclass and PydanticThe same graph over a TypedDict, a dataclass and a Pydantic state: how nodes read each one, what happens with a missing key or a wrong type, Pydantic's validation and conversion and what the state keeps, a comparison table, how to choose, interview questions and two practice tasks.
  2. 2Tools in a graphThe four ideas behind a graph with tools, messages with names, a chat model in a node, binding a tool, the messages state, a node that only asks for a tool, ToolNode and tools_condition, what each does inside, why the result is a router and not yet an agent, interview questions and two practice tasks.
  3. 3A chatbot with multiple toolsThe arXiv and Wikipedia tools and their size limits, web search with Tavily and its replacement package, binding several tools, the router graph with three tools, three questions and the tool each one took, how a model chooses among tools and what goes wrong, interview questions and two practice tasks.
  4. 4The ReAct agent graphReAct and where the name comes from, the one edge that turns a router into an agent, the tools and the graph, runs with one and several tool rounds, parallel tool calls and what goes wrong with them, steps and recursion limits, this graph compared with create_agent, interview questions and two practice tasks without a model.
  5. 5Memory with checkpointersWhy the agent forgets, MemorySaver and compile, threads and thread IDs, three turns of one conversation, what a checkpointer saves and when, the chatbot with memory, in-memory and database checkpointers, long-term memory with a store, interview questions and two practice tasks.
  6. 6StreamingWhy stream, updates and values on the chatbot with memory and on a graph without a model, several modes at once and the v2 format, tokens with the messages mode, astream_events and what one model call emits, which method to use, the ReAct agent with memory in one script with Gemini, interview questions and two practice tasks.