Interactive engineering lab

LangGraph stream routing: child config, subgraphs and release

LangGraph stream routing: child config, subgraphs and release. See which child graph tokens reach a caller in LangGraph 1.2.18 to 1.2.22 and where a consumer files them.

By Sandeep Belgavi · Published 2026-11-15

Synthetic fixtures computed locally. No model, graph runtime, GPU, scheduler or production service is contacted.

Experiment workspace

Decision trace

    The question this experiment answers

    Hansini's help desk interface at Belgavi's Book Store streams a LangGraph agent: a parent node called delegate invokes a child graph whose node draft writes a reply token by token, then the parent node reply answers the customer. The interface puts the parent's tokens in a chat bubble and the child's tokens in a side panel. Which token chunks reach the caller in LangGraph 1.2.18, in 1.2.19 to 1.2.21, and in 1.2.22, depending on how the child is invoked and whether the caller streams with subgraphs=True? And where does each chunk end up when the consumer routes by namespace or by node metadata?

    Change one assumption at a time

    Start from fixed_release_namespace_consumer: LangGraph 1.2.22, a child with its own thread_id, subgraphs=True and a consumer that routes by namespace. All 7 child chunks arrive, but under the root namespace, so all 7 land in the parent bubble. Switch the consumer to node metadata and every chunk is filed correctly. Then set the release to 1.2.19-1.2.21: no child chunk arrives, only the delegate node's whole message, yet the final-result check still passes. Change the child config to inherit and the regression disappears. Finally pick 1.2.18 with subgraphs off to see the leak that the 1.2.19 change was meant to stop.

    Expected outcomes

    With 7 child chunks and 5 parent chunks: fixed_release_namespace_consumer delivers 12 events, 7 child chunks, all 7 in the parent bubble, and fails the stream check. fixed_release_node_consumer delivers the same 12 events and passes. regression_own_thread_id delivers 6 events, no child chunk and 1 whole child message, and fails the stream check while the final-result check passes. regression_inherit_control delivers 7 child chunks under the delegate namespace and passes. old_release_leak_without_subgraphs delivers 7 child chunks to a caller that did not ask for them and fails. fixed_release_without_subgraphs delivers 6 events and passes. own_checkpoint_ns_fixed behaves like the own thread_id case.

    Reading the decision trace

    The first line restates the setup. Each later line is one messages event in the order the caller received it: which node produced it, whether it is a token chunk or a whole message, the namespace it carried, and where the consumer filed it. Lines marked WRONG were filed in the wrong place. The last line gives both test verdicts and lists every problem the stream check found. Use Next step to walk through the stream one event at a time, and Export JSON to save the inputs, the rows, the trace and these limits.

    What this teaches

    A test that only compares the final result passes in every release here; only a test on the event stream sees the regression, the leak and the misfiling. The fix restored delivery but kept the child's own namespace, so routing on node metadata or on tags you set yourself is more robust than routing on namespace shape. The companion article walks through the pull requests and a stream contract test.

    Limits of this model

    The delivery table covers one shape that was measured offline with a fake chat model: a child graph invoked synchronously inside one parent node, stream_mode messages, Python, LangGraph 1.2.18 to 1.2.22. tools events, checkpoint_id, runnables with their own configurable, async streaming, other stream modes, nested children, Send tasks and @task calls are not modelled, although the 1.2.22 change covers some of them. Task ids in namespaces are shown as <task-id>. The model reproduces recorded behaviour; it does not run LangGraph.

    Views are my own and do not represent any employer, past or present.