Sitemap
ILLUMINATION

We curate & disseminate outstanding stories from diverse domains to create synergy. Apply: https://digitalmehmet.com/contact & https://illumination-curated.com

How to Add a Subgraph as a Node in LangGraph?

5 min readJul 19, 2026

--

In the previous article, we used Approach 1, where the subgraph is called from inside a node. That approach is useful when the parent graph and subgraph use different state schemas.

Here, we use Approach 2. The subgraph is added directly as a node because both graphs share the same state keys.

The example is the same: Getting Ready for Office, with Making Tea as the subgraph. Since both graphs use the status state, the compiled subgraph can be passed directly to add_node(). No wrapper function is needed.

When to Use This Approach

Use this approach when the parent graph and subgraph share the same state keys. The subgraph can read and update the parent’s state directly.

If the parent graph and subgraph use different state schemas, use Approach 1 instead.

The Subgraph

from typing_extensions import TypedDict, Annotated
from operator import add
from langgraph.graph.state import StateGraph, START

class TeaState(TypedDict):
status: Annotated[str, add] # shared key with the parent — enables direct add_node
water_ml: int
milk_ml: int
tea_leaves_tsp: int
sugar_tsp: int…

--

--

Nachiket Mehendale
Nachiket Mehendale

Written by Nachiket Mehendale

Exploring Generative AI and small ideas. Learning, reflecting, evolving.

ILLUMINATION
ILLUMINATION

Published in ILLUMINATION

We curate & disseminate outstanding stories from diverse domains to create synergy. Apply: https://digitalmehmet.com/contact & https://illumination-curated.com