What signal tells you to use a fixed LCEL chain instead of an agent loop?
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Describe when a fixed LCEL chain (DAG pipeline) is the better choice over an agent loop. State the single most important question to ask when choosing between them.
Prefer a fixed chain unless the execution path must change based on intermediate results; the decisive question is whether all steps are known at design time.
Think of it like two ways to cook dinner. A chain is a recipe card you follow top to bottom every time: chop, fry, plate. You always do the same steps in the same order, so you know exactly how long it takes and what it costs. An agent is a chef with no recipe who tastes the food, decides what to do next, and keeps adjusting until it is right. The chef is more flexible, but you cannot predict how long they will take or how much they will spend. If your dinner is always the same dish, the recipe card wins every time. You only need the improvising chef when you genuinely do not know the steps in advance, because what you find halfway through changes what you do next.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Define the chain versus agent distinction as control flow ownership, state the decisive question about intermediate results, walk the latency, cost, and reliability tradeoffs, then close with the default to simplest rule and when to escalate from a chain to a full loop.
| Dimension | Fixed chain (LCEL / DAG) | Agent loop |
|---|---|---|
| Control flow | Engineer decides at design time | Model decides at runtime |
| Execution graph | Static, same every run | Dynamic, depends on observations |
| Latency | Bounded and predictable | Unbounded, scales with step count |
| Cost | Fixed LLM call count | Compounds super linearly with steps |
| Debugging | Reproducible, flat failure surface | Emergent, hard to reproduce |
| Use when | Steps known up front | Path depends on intermediate results |
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Reaching for an agent by default because it sounds powerful. Most production tasks have a fixed graph, so a chain is cheaper, faster, and far easier to debug.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.