What is the difference between an agent and a workflow?
Agents and tools · Intermediate 3
Short answer
A workflow runs model calls and tools along steps fixed in code, so its path is predictable. An agent lets the model decide its own next step in a loop: think, call a tool, observe the result, repeat until done. Agents handle open-ended tasks but are harder to predict, test and keep cheap.
Deeper answer
Anthropic's widely cited write-up draws this line and recommends the simplest thing that works: a single well-prompted call, then a workflow such as prompt chaining, routing or evaluator-optimizer, and only then an agent. Many "agents" in production are really workflows with a few model decisions, which is often the right call.
A good answer names the trade-off: agents add flexibility at the cost of latency, cost, debugging effort and risk. Use them when the steps cannot be known in advance, and add guardrails: step limits, tool permissions, logging and human approval for risky actions.
What a strong answer covers
- A workflow follows steps fixed in code
- An agent lets the model choose its next step in a loop
- Agents suit open-ended tasks
- Agents are harder to predict, test and keep cheap
Answer it out loud in the mock interview about 1 min
Follow-ups to expect
- Give an example task where a workflow is better than an agent.
- What guardrails would you add to a production agent?
Common mistakes
- Calling every LLM app an agent
- Choosing an agent without saying why a simpler workflow would not work
Learn it
- What are common failure modes of agents, and how do you guard against them?
- What kinds of memory can an agent have, and how do you implement them?
- Your agent ran overnight and ran up a large API bill. What probably happened, and what do you change?
- How would you design a harness for an agent that has to work on one task for several hours?
- What are computer-use or browser agents good for, and what are their risks?
- What is context engineering, and why does it matter for agents?
- An agent completes a task correctly most of the time but sometimes goes badly wrong. How do you debug it?
- What makes a good tool for an agent?
- Design an agent that handles refund requests for an online store.
- You changed your agent's harness. How do you prove the change made it better?
- What are verification gates in an agent harness, and how would you add them to a coding agent?
- How does tool calling work?
- When should an AI agent ask a human for approval before acting?
- Explain state, nodes, edges and checkpoints in LangGraph.
- What are planning and reflection in agents, and when do they help?
- Two coding agents use the same model, but one solves far more of your tasks. Why could that be, and how would you find out?
- What is an agent harness, and what is harness engineering?
- What is the Model Context Protocol, and why does it matter?
- When is a multi-agent system worth it, and what are the risks?