Workflows vs. agents
token in flightunhandled edge case
- Workflow: predefined code path, deterministic hops.
- Agent: model-directed control flow and tool selection.
- An unhandled edge case breaks the static path.
- 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))
- Building effective agentsAnthropic
- A practical guide to building agentsOpenAI
- Workflows and agentsLangChain
- 12-factor agentsHumanLayer