Hasty Briefsbeta

Bilingual

Building Agentic Workflows in Python with LangGraph

10 hours ago
  • LangGraph represents an agent as a graph with state, nodes, and edges; state is a shared TypedDict, nodes are functions that update state, edges define execution order.
  • MessagesState provides built-in message history with add_messages reducer to accumulate conversation automatically.
  • Model calls are placed inside a node; tools are registered using @tool decorator and bound to the model via bind_tools.
  • ToolNode handles tool execution; tools_condition routes graph between model and tool nodes in a ReAct loop.
  • A checkpointer (e.g., InMemorySaver) persists conversation state across separate graph invocations using a thread_id.
  • The standard ReAct pattern involves two model calls per tool use: one to decide the call, one to interpret the result.