Skip to course content
Free LangGraph course

LangGraph for Agentic Workflows

Unit 08.02: Telling a user what is happening now

The gap between a node name and a status message is small to write and large in how the system reads.

A label map, and the position in the sequence

Two rules. Node names are function names and need mapping to human labels. And a status without a position tells the user nothing about how long is left.

The code prints a labelled, numbered progress sequence.

LABELS = {
    "research":  "Looking through the source documents",
    "draft":     "Writing a first version",
    "review":    "Checking the draft against the sources",
    "publish":   "Saving the result",
}

events = ["research", "draft", "review", "publish"]
total = len(events)
for i, node in enumerate(events, 1):
    print(f"[{i}/{total}] {LABELS[node]}")

print("""
Two rules. Map node names to human labels -- "research" is a function name and
"Looking through the source documents" is a status. And show the position in
the sequence, because "step 3 of 4" tells a user how long is left and
"Checking the draft" does not.

Keep the labels in one dictionary next to the graph. Scattered through the node
bodies they drift out of date the first time a node is renamed.
""")

"[2/4] Writing a first version" carries two pieces of information that "draft" does not: what is happening in the user's terms, and how much of the workflow remains.

Keeping the labels in one dictionary next to the graph is the part that survives. Scattered through node bodies, they drift out of date the first time a node is renamed or reordered, and nobody notices because nothing tests a status string.

The mistake this prevents

The mistake is generating status text with a model call. It costs a call per step to produce a string you could have written once, it introduces latency into the progress reporting itself, and it can describe the step wrongly. Status labels are static text.

Takeaway

Map node names to human labels in one dictionary, and always include the position in the sequence. Both are static text and neither should involve a model.