Skip to main content
Module 1: Foundations

Workflow or agent?

Build the flowchart when you can; reach for an agent only where the model must choose the steps — and most production systems mix both.

Before you reach for an agent, ask a cheaper question: does this task even need one? Many jobs people label "AI agent" are better built as plain workflows, and knowing the difference saves you weeks.

A workflow follows a path you defined in advance. The steps are fixed; you wrote them. The model might fill in a step — classify this ticket, summarize this document — but you decided the sequence. Control flow lives in your code.

An agent lets the model choose the steps. You give it a goal and tools, and it decides what to do next based on what it sees. Control flow lives in the model's reasoning.

The trade-off is simple and honest. Workflows are predictable, cheap, easy to test, and easy to debug — but they only handle situations you anticipated. Agents handle open-ended situations and adapt — but they're less predictable, cost more per run, and are harder to test because the path changes every time.

A rule of thumb worth internalizing: if you can draw the flowchart, build the flowchart. Reach for an agent only when you genuinely can't enumerate the steps ahead of time — when the right next action depends on what earlier steps turn out to reveal.

Consider a refund request. If your policy is "under $50 and within 30 days, approve; otherwise escalate," that's a workflow — two branches, no agent needed. The model can read the email and extract amount and date, but the decision is a rule you own. Now suppose the request is "the customer is unhappy for reasons that vary wildly and you must investigate across orders, shipping, and prior tickets." The path isn't knowable up front. That's where an agent earns its cost.

In practice, the cleanest production systems are rarely pure either way — they're mostly deterministic workflow with a small agentic core where judgment is actually required. Stripe calls its hybrid setups "blueprints": structured scaffolding with model-driven steps slotted into the places that need flexibility. The structure gives you predictability and testability; the agentic pieces give you adaptability exactly where it pays off. The art is keeping the agentic surface as small as the problem allows.

This connects straight back to the golden rule. Every place you hand control to the model is a place you now need guardrails and verification. So the most reliable design move is often to not make something an agent: pin down everything you can as plain code, and let the model choose steps only where choosing is the actual value.

Example instruction for the agentic core of a hybrid: "You may read orders, shipping records, and past tickets. Propose a resolution and the reason. Do not issue any refund or send any message — output your recommendation for a human to approve."

Notice the recommendation is read-only by default. The expensive, risky part stays behind a human.

Try it

Pick a task from your own work you've imagined automating. Draw it as a flowchart. If you can finish the flowchart, mark it "workflow" and circle the one or two boxes (if any) that truly need the model to choose. If you genuinely can't finish it, write one sentence explaining what makes the next step unknowable.

Stay in the loop

Enjoying the free lessons? Get an email when we publish new courses and updates — no spam, unsubscribe anytime.

Discussion (0)

Ask a question or share what worked for you. Comments are reviewed before they appear.

Log in to join the discussion and ask questions about this lesson.

No comments yet. Be the first to start the discussion!