Velamuvi AIAcademy

Lesson 9 of 9 · Patterns

Workflows vs Agents

Workflow, agent or hybrid? Use a decision checklist, compare cost and reliability, and design hybrids that call an agent only where flexibility is needed.

  • 5 min read
  • Intermediate
  • Reviewed
In this lesson you will learn
  • Compare workflows and agents on control, cost and reliability
  • Use a checklist to choose an architecture for a task
  • Design a hybrid with a workflow backbone and agent steps
  • Estimate the cost difference between designs

A spectrum, not a choice of two

Systems range from fully fixed to fully autonomous:

DesignWho decides the stepsExample
Single LLM callNobody: one stepSummarise this email
WorkflowYour code, in a fixed orderClassify → extract → draft → check
Workflow with agent stepsCode, with one flexible stepFixed pipeline, plus an agent for hard cases
AgentThe model, step by stepInvestigate a bug, research a topic

A checklist

Each question points towards a workflow or an agent. Count the answers:

Try it yourselfPython
QUESTIONS = [
    ("Can you write the steps down before starting?", "workflow"),
    ("Do the steps depend on what is found along the way?", "agent"),
    ("Must the result be the same every time, for audits?", "workflow"),
    ("Is the task open-ended (research, debugging, investigation)?", "agent"),
    ("Are speed and cost per run important (high volume)?", "workflow"),
    ("Can mistakes be checked and fixed along the way?", "agent"),
]

def recommend(answers):
    votes = {"workflow": 0, "agent": 0}
    for (question, points_to), yes in zip(QUESTIONS, answers):
        if yes:
            votes[points_to] += 1
    if votes["workflow"] == votes["agent"]:
        return votes, "hybrid: a workflow with an agent step where flexibility is needed"
    return votes, max(votes, key=votes.get)

tasks = {
    "Extract fields from 10,000 invoices a day": [True, False, True, False, True, False],
    "Investigate why a customer's orders keep failing": [False, True, False, True, False, True],
    "Answer support emails, with odd cases needing research": [True, True, False, False, True, True],
}
for task, answers in tasks.items():
    votes, choice = recommend(answers)
    print(f"{task}\n   {votes} -> {choice}")

Invoice extraction is a clear workflow: known steps, high volume, auditable. Investigating failing orders is a clear agent: the next step depends on what the logs show. Support emails split evenly, and that's the signal for a hybrid: a workflow handles the common emails, and an agent takes the ones that need investigation.

Hybrids in practice

A hybrid usually looks like this:

  1. A router or classifier decides how hard the case is.
  2. Easy cases go through a fixed workflow: fast, cheap, predictable.
  3. Hard cases go to an agent with tools and a budget.
  4. Both paths end with the same checks (validation, approval rules) before anything is sent.

Common mistakes

Practice exercise

Price a hybrid design: a cheap workflow for most cases and an agent only for the hard ones.

Your solutionPython
tickets = 20_000            # per month
hard_share = 0.1            # 10% need investigation
workflow_cost = 0.002       # dollars per ticket through the fixed workflow
agent_cost = 0.05           # dollars per ticket through the agent

# Compare: every ticket through the agent, vs a hybrid where only the hard ones go
# to the agent and the rest use the workflow. Print with 2 decimals:
# All agent: $0.00
# Hybrid: $0.00
Knowledge check

Most support tickets follow a known pattern, but about 10% need investigation across several systems. What design fits best?

Summary

  • Designs range from single calls to workflows, hybrids and agents.
  • Use a checklist: known steps, audits and volume point to workflows; open-ended, discovery-driven tasks point to agents.
  • Hybrids route easy cases through a workflow and hard ones to an agent, with shared checks.
  • Start simple, and add autonomy only where it clearly helps.

Course complete

You now know the components of an agent, how to build a robust control loop, manage state and checkpoints, write agent prompts, and apply the main patterns (ReAct, plan and execute, reflection and routing), and how to choose between workflows, agents and hybrids. Next: Agentic AI Fundamentals looks at levels of autonomy and keeping humans in control.

Finished reading? Tick it off to track your progress.