How graph nodes map to UI cards
A LangGraph graph defines a series of nodes, each responsible for a specific task. For example, a research pipeline might have:- Classify: categorize the user’s query
- Research: gather relevant information
- Analyze: draw conclusions from the research
- Synthesize: produce a final, polished response
Setting up useStream
Wire upuseStream as usual. The key properties you’ll use are messages
(for streaming content routing), values (for completed node outputs), and
getMessagesMetadata (for identifying which node produced each token).
Define a TypeScript interface matching your agent’s state schema and pass it as a type parameter to useStream for type-safe access to state values, including custom state keys for each pipeline node. In the examples below, replace typeof myAgent with your interface name:
Routing streaming tokens to nodes
As the agent streams, each message is annotated with metadata that identifies which graph node produced it. UsegetMessagesMetadata to extract the
langgraph_node value and route tokens to the correct card:
The
streamMetadata.langgraph_node field is set automatically by LangGraph.
You don’t need any special configuration on the backend. Just stream messages
as usual, and the metadata is included.Determining node status
Each node can be in one of four states: not started, streaming, complete, or idle. You derive the status from two sources: the streaming content map (for active nodes) andstream.values (for completed nodes):
Building the pipeline progress bar
A horizontal progress bar at the top gives users a bird’s-eye view of the entire pipeline. Each step is a labeled segment that fills in as nodes complete:Building collapsible NodeCard components
Each node gets its own card that shows the status badge, content (streaming or final), and a collapsible body for long outputs:Streaming vs. completed content
There are two sources of content for each node, and picking the right one matters for a smooth UX:
The pattern is: show streaming content for live updates, fall back to the
committed state value once the node is done.
Putting it all together
Here’s the full card list that combines routing, status detection, and card rendering:Use cases
Graph execution cards work well for any multi-step pipeline where visibility matters:- Research pipelines: classify → gather sources → analyze → synthesize a report
- Content generation: outline → draft → fact-check → edit → publish
- Data processing: ingest → validate → transform → aggregate → export
- Code generation: understand requirements → plan architecture → write code → review → test
- Decision workflows: gather context → evaluate options → score alternatives → recommend
Handling dynamic pipelines
Not all graphs have a fixed set of nodes. Some pipelines add or skip nodes based on the input. Handle this by checking which state keys actually have values:If your graph has conditional branching (e.g., skip “Research” for simple
factual queries), the skipped nodes will never appear in the streaming content
or state values. Your pipeline progress bar should reflect this by dimming or
hiding skipped steps.
Best practices
- Define nodes declaratively. Keep your
PIPELINE_NODESarray as a single source of truth that maps node names, state keys, and display labels. - Prefer streaming content for active nodes. It gives users immediate feedback. Only fall back to committed state values after the node completes.
- Auto-collapse completed nodes. In long pipelines, auto-collapse finished cards so users can focus on the currently active step.
- Show estimated timing. If you have historical data on how long each node takes, display a time estimate to set user expectations.
- Add a global progress indicator. Complement per-node cards with an overall progress bar (e.g., “Step 2 of 4”) at the top of the pipeline view.
- Handle errors per node. If a node fails, show the error in its card without collapsing the entire pipeline. Other nodes may still complete successfully.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

