Create

Sign in to ReadmeX

or

How we handle your data: Privacy Policy

ReadmeX

Your AI reading companion

What would you like to catch up on?

Pick a briefing, or ask your own question.

Your community and people briefings stay personal to you.

Story

LangGraph Tutorial: Separating State and Control Flow

AI summary

This tutorial explains how LangGraph separates state updates from graph routing: nodes return incremental dictionaries, while field-level reducers determine whether values are overwritten or appended. It also shows how routers and path_map implement conditional loops, and how checkpointer identity keys support persistence and human-in-the-loop workflows. The article highlights pitfalls including missing thread_id values and state replay during resume.

In-depth insight

The tutorial gives LangGraph developers a practical model for understanding reducer-driven state updates, conditional routing, checkpointing, and human-in-the-loop behavior, along with several failure modes they may encounter.

两条线:LangGraph 如何把状态流和控制流拆开

一、一个字段被覆盖,一个字段留住了

lab_02 搭的是一张会绕圈的图:draft 先写个初稿,expand 每轮往里补一段,router 看长度够不够,不够就绕回去。我在 State 里定义了三个字段:

class State(TypedDict):
    topic: str
    result: str                                  # 无 reducer
    history: Annotated[list[str], operator.add]  # 有 reducer

两个节点返回的东西长得一样,都是 dict:

return {"result": result, "history": [f"expand_node: 第 {round_no} 轮加工后, len(result)={len(result)}"]}

#LangGraph#LangChain

Original · 22 min readRead the original
Group chat

No comments yet. Start the conversation.