Workflows vs. agents

token in flightunhandled edge case
WorkflowInputLLM₁LLM₂LLM₃OutputAgentInputLLMSearchEditOutput
  1. Workflow: predefined code path, deterministic hops.
  2. Agent: model-directed control flow and tool selection.
  3. An unhandled edge case breaks the static path.
  4. The agent re-plans at runtime, paying in turns and latency.
Notes & references

Use when

Workflows for predictable decomposition; agents for open-ended tasks.

Avoid

Autonomy where a single augmented LLM call suffices.

# Workflow: your code decides the path
def handle(task):
    return polish(draft(outline(task)))

# Agent: the model decides the path
def handle(task):
    while not done:
        action = llm.next_action(history)
        history.append(run(action))