Hello !
This is not a bug or a question.
I’d like to propose a small but useful enhancement to the execution metadata.
I propose adding a new metadata field, langgraph_writers, which indicates which parent node(s) caused the current node to execute during this step.
This improves debugging, visualization, and execution-flow tracing—especially in complex graphs where a node may be triggered by multiple upstream nodes.
Current Behavior
Currently, langgraph_triggers shows trigger types like “branch:to:C2”, but does NOT show which specific node(s) wrote the state that caused this node to execute. This makes it difficult to trace causality in complex graphs with multiple writers.
When debugging or visualizing complex graphs, it’s difficult to know:
- Which exact upstream node triggered the execution
- How execution paths propagate
- How control flow moves across branching structures
Example After Modification
New metadata field langgraph_writers such as:
# Current metadata
{'langgraph_triggers': ('branch:to:C2', )}
# Proposed metadata
{'langgraph_triggers': ('branch:to:C2', ), 'langgraph_writers': ('node_A', 'node_B')}
Why this is useful
We can also do a lot more things with this metadata.
- Understanding execution flow
- Debugging branching logic
- Visualizing complex graph structures
- Explaining graph behavior to users
Such as tracking edges that are done or currently activated.
Implementation Notes
I added 10~15 lines in _algo.py and _loop.py to collect parent nodes based on the writers in the previous step.
If the team thinks this direction is appropriate, I’d be happy to open a PR.
