langchain-langgraph-subgraphs
LangGraph Subgraphs and Composition (Python)
Overview
A parent StateGraph invokes a compiled child subgraph as a node. The child
node writes state["answer"] = "42" and returns. The parent's next node reads
state["answer"] and gets None. No error, no warning, no deprecation notice —
just a silent None that surfaces as a wrong answer three nodes later when the
router picks the "couldn't find it" branch.
The cause is pain-catalog entry P21: LangGraph subgraphs run on an
independent state schema. Only keys declared in both the parent's
TypedDict and the child's TypedDict propagate across the subgraph boundary.
answer existed in the child schema but not the parent schema, so it was
discarded on return. The fix is to declare answer in both schemas (with
matching reducers, if the field is a list) or to use explicit
Command(graph=ParentGraph, update={"answer": "42"}) to bubble it up.