Workflows or agents interview questions
6 questions with model answers
- junior 1
- mid 3
- senior 2
6 workflows or agents questions asked in AI engineer, ML engineer and applied AI engineer interviews, each with a model answer you can say out loud in a minute or two: 1 junior, 3 mid-level and 2 senior. The lesson Workflows or Agents: Who Decides the Next Step teaches the ideas behind them.Updated
Model answer
Who chooses the next step. In a workflow, predefined code paths orchestrate the model and tools. In an agent, the model directs its own process and tool use.
Scroll sideways to see the whole diagram
Anthropic: workflows are systems where models and tools are orchestrated through predefined code paths. The model does steps; code decides their order.
Text version
- Anthropic: workflows are systems where models and tools are orchestrated through predefined code paths. The model does steps; code decides their order.
- Workflows offer predictability and consistency for well-defined tasks.
- Agents are systems where the model dynamically directs its own process and tool use.
- That suits open-ended problems where the number of steps can't be predicted, at the price of higher cost and the potential for compounding errors.
Workflows suit well-defined tasks; agents, open-ended ones where the number of steps can't be predicted.
Model answer
- Prompt chaining: fixed steps, with checks between.
- Routing: classify, then a specialised path.
- Parallelisation: independent parts at once, or voting on repeated runs.
- Orchestrator–workers: a model splits the task and delegates.
- Evaluator–optimiser: generate, critique, revise.
Scroll sideways to see the whole diagram
Prompt chaining: a fixed sequence of calls, each working on the last one's output. Code can check the output between steps.
Text version
- Prompt chaining: a fixed sequence of calls, each working on the last one's output. Code can check the output between steps.
- Routing: classify first, then send the input down a path built for its kind. Module 05's query routing is one example.
- Parallelisation: split a task into independent parts run at once (sectioning), or run the same task several times and combine the answers (voting).
- Orchestrator–workers: a model decides the subtasks at run time, so it's closer to an agent, but the structure around it is fixed.
- Evaluator–optimiser: generate, critique, revise. Anthropic notes it works when there are clear evaluation criteria and iteration measurably helps.
Model answer
So a bad plan is rejected before anything runs. Otherwise a plan that can't reach the goal can burn hours of calls, or perform a write you can't undo.
Validate with heuristics in code (every tool exists, under a step limit) or a model judge; regenerate on rejection.
Model answer
Catchable from the plan: an invalid tool, invalid parameters, too many steps, or a forbidden order like a refund before a policy check.
Not catchable: wrong parameter values, like refunding the original charge instead of the duplicate. Those values come from earlier results, so check them at call time.
Model answer
Its own limit: maximum attempts, time and cost. When a model judges a loop's exit condition, nothing guarantees it's ever met.
In ordinary software conditions are exact; in agents the model decides them, so every loop gets a bound enforced in code.
Model answer
Decide the level of automation per action, in advance: reads run; small refunds run; large refunds wait for approval; deletions never. Enforce it in the tool wrapper.
Approval pauses need durable state so the task resumes later. Often the best design runs a workflow for known cases and sends only the rest to an agent.