Hi everyone,
I’ve been building a visualizer for LangGraph (using Streamlit) and encountered a limitation when trying to visualize the specific “path” (or edge) of execution.
The Problem
Currently, the metadata tells us which node is executed , but it lacks context on what triggered it.
In complex graphs with branching logic or multiple upstream nodes, knowing that “Node C is activated” isn’t enough—we need to know whether it was triggered by “Node A” or “Node B”.
Without this, we can visualize active nodes, but we cannot highlight the active edges.
The Proposed Solution
I propose adding a metadata field: `langgraph_writers`.
This tracks which upstream node(s) wrote the channel updates that caused the current node to run. Proposed Metadata Structure:
metadata = {
"langgraph_step": step,
"langgraph_node": name,
"langgraph_triggers": triggers,
# ... existing fields
"langgraph_writers": writers # <--- NEW: Tracks the source of the update
}
This indicates which upstream node(s) wrote the channel updates that caused the current node to run.
Why this matters
- Visualizers: It becomes possible to draw lines/edges showing the flow of data, not just the active states.
- Debugging: In multi-branch workflows, developers can instantly trace why a specific node was activated.
Proof of Concept
I have already implemented a prototype by adding just ~10-15 lines of code to algo.py and loop.py. It successfully tracks writers in multi-writer/branching scenarios.
Metadata: {
‘langgraph_step’: 2, ‘langgraph_node’: ‘B2’, ‘langgraph_triggers’: (‘branch:to:B2’,), ‘langgraph_path’: (‘__pregel_pull’, ‘B2’), ‘langgraph_checkpoint_ns’: ‘B2:d5b2d952-c589-2194-14e8-c40d12f6332d’, ‘langgraph_writers’: (‘A’,) } # We can see "A" -> "B2" edge is working now !
Video Demo
Here is the video showing highlighting the EDGES.
I believe this small addition would greatly enhance the developer experience for debugging and tooling. If this sounds good to the team, I am ready to open a PR immediately !
