Skip to course content
Free LangGraph course

LangGraph for Agentic Workflows

Unit 01.03: Recognising a workflow that is still linear

A surprising share of production "agents" are functions with a graph wrapped around them. The test for telling them apart takes ten seconds.

Does control flow depend on a run-time result?

That is the whole test. Not whether the workflow calls a model, not whether it uses tools, not whether it feels agentic. Only: does the sequence of steps depend on something computed while running?

The code applies it to five workflows.

WORKFLOWS = [
    ("read a file, summarise it, write the summary out", False),
    ("summarise, then have a reviewer approve before publishing", True),
    ("classify a ticket, then route to one of four handlers", True),
    ("call an API, parse the response, format it as a table", False),
    ("draft, critique, revise until the critique passes", True),
]

print(f"{'workflow':52} needs a graph?")
for description, needs_graph in WORKFLOWS:
    print(f"{description:52} {'yes' if needs_graph else 'no -- a function will do'}")

linear = sum(1 for _, g in WORKFLOWS if not g)
print(f"\n{linear} of {len(WORKFLOWS)} are plain functions pretending to be agents.")

# The test is not "is it AI" or "does it call a model". It is: does control
# flow depend on a result computed at run time? If not, a function is clearer,
# cheaper, and easier to test than any graph.

Two of the five are plain functions. "Read a file, summarise it, write the summary" calls a model and is completely linear - the model is a step, not a decision. "Call an API, parse, format" is the same shape.

The three that need a graph each have something a function cannot express: a human gate, a four-way route computed from a result, and a revise loop with a termination condition.

The mistake this prevents

The mistake is counting model calls as evidence of complexity. A workflow with four model calls in a fixed order is a four-line function. A workflow with one model call whose result decides what happens next is a graph. The number of calls tells you about cost; the dependency tells you about structure.

Takeaway

Ask whether control flow depends on a run-time result. If it does not, a function is clearer, cheaper and easier to test than any graph - however much model machinery is inside it.