LLMs, GenAI, RAG, agents, evaluation · insight-0629
Write the workflow in code when the steps are known, and use the model only at fuzzy steps
- Evidence type
- practitioner heuristic
- Difficulty
- easy
- Roles
- Applied AI, ML engineer, Data scientist
- Industries
- aviation, e-commerce
Summary: situation, action, reason, boundary
Situation
A team proposes an autonomous agent for a process whose steps are already documented, such as refund eligibility checks or disruption rebooking.
Action
Encode the known sequence as a deterministic workflow, call the model only where judgement on unstructured input is needed (classify the request, extract fields, draft a message), and validate each output before the next step.
Reason
Anthropic's agent guidance distinguishes workflows (predefined code paths) from agents (model-directed control) and recommends the simplest solution that works, noting that agents trade latency and cost for flexibility.
Boundary
Repeatable business processes with known branches and compliance needs.
Symptom or risk
The agent skips or reorders mandatory steps on some runs, costs more per case, and is hard to test or audit.
Exceptions
Open-ended tasks where the number and kind of steps cannot be predicted, such as research or debugging.
Trade-offs
Workflows need code changes for new branches; agents adapt but need stronger guardrails and evaluation.
Pitfalls
Calling a fixed prompt chain an agent, or an agent a workflow, in design reviews; name which component decides control flow.
Lessons and concepts
Claims and their sources
Anthropic's engineering guidance separates workflows (LLMs and tools orchestrated through predefined code paths) from agents (LLMs directing their own process and tool use) and advises starting with the simplest solution.