Skip to content

Subgraph Direct

Sudhanshu edited this page Nov 11, 2026 · 1 revision

Direct Compiled Subgraph (Shared State)

flowchart TD
 S([START: CompanyState]) --> HR["HR_Welcome_Node"]
 HR --> IT["IT_Subgraph_Node: compiled graph"]
 subgraph SG["IT compiled subgraph shares CompanyState"]
  ES([START]) --> EMAIL["Create_Email_Node"] --> LAP["Assign_Laptop_Node"] --> EE([END])
 end
 IT -. "runs with same state schema" .-> ES
 EE --> F([END: CompanyState])
Loading

example_subgraph_direct() shares CompanyState(employee_name, hr_notes, it_notes) between its HR parent and IT child. The compiled IT graph is directly attached as a node: hr_builder.add_node("IT_Subgraph_Node", it_subgraph).

The parent HR node writes hr_notes. The child creates a sample email and laptop assignment, updating it_notes. State is shared, so no input/output mapping wrapper is needed. Compare Wrapper Subgraph.

Clone this wiki locally