Chapter 3: Workflow First, Agent Second¶
Every time a team builds an agent, they should first ask: would a workflow do the job? This chapter makes the comparison concrete by implementing the same task both ways and measuring the differences.
What this chapter covers¶
- The deterministic workflow -- building a reliable pipeline for document question answering
- The bounded agent -- the same task with LLM-driven decision making
- Same task, two ways: the comparison -- accuracy, latency, cost, and debuggability metrics
- Design guidance: when to choose which -- decision criteria for workflows vs agents
- Planning and single-agent design -- state management and bounded autonomy
- Failure modes specific to this chapter -- what breaks when you choose wrong
Code companion¶
The working code for this chapter is in src/ch03/:
workflow.py-- Deterministic workflow implementationagent.py-- Bounded agent implementationstate.py-- State managementcompare.py-- Side-by-side comparison runner
See the Architecture Comparison for evaluation results.
Get the full chapter¶
The complete chapter text is available in the book.