Not Every Node in Your Agent Needs an LLM
From the publisher’s feed, collected in the ZeroLabs newsroom.
A design pattern for building agent pipelines you can actually reason aboutLook at the last agent diagram you drew. Count the boxes. Now count the boxes that call an LLM.If those numbers match, you have a problem. No amount of better prompting will fix it.The habit is everywhere. Classification — LLM. Routing — LLM. Retrieval ranking — LLM. Validation — LLM-as-judge. Repair — LLM. Every node is a model call. The whole pipeline collapses into one shape: a chain of probabilistic steps, each capable of failing in its own way, with no deterministic ground anywhere.It feels powerful. It’s also fragile, slow, and hard to debug under pressure. Something goes wrong, you don’t know which call failed, you start adjusting prompts. That’s not engineering. That’s guessing with a thesaurus.Most agent tutorials skip the question that matters:Which steps in this pipeline actually require reasoning, and which just require the right answer?The answer is almost never what people assume.What you lose when every node is a model callThree things break down, all at once.You lose determinism where it’s free. An intent classifier choosing between four options rarely needs a heavyweight reasoning model. If your domain is indexable, mapping a concept to a document section shouldn’t need embeddings. A check for whether a function exists in your API doesn’t need an LLM-as-judge. It needs a lookup. When you route these through a model anyway, you’re paying tokens, latency, and a fresh chance of failure for a problem that already had a deterministic answer.You lose diagnosability. When the pipeline produces a bad output, you can’t tell what failed. Did the classifier misroute? Did retrieval pull the wrong context? Did the generator hallucinate? Did the LLM-as-judge wave it through? Every node is opaque in the same way. Debugging becomes archaeology: read the trace, guess at the failure point, tweak a prompt, hope.You lose the ability to fail gracefully. Probabilistic checks don’t know they’re wrong. An LLM validator that occasionally rubber-stamps a hallucinated function call won’t tell you it did. A deterministic check would. That difference — silence versus a flag — is the difference between catching broken code and shipping it.None of this is news to anyone who’s run an agent in front of real users. It’s the gap between the tutorials and the production reality. Frameworks make chaining LLM calls easy. Production teaches you that easy and right aren’t the same.The fix isn’t to use fewer LLMs. The fix is to ask, for every node: should this step think, or should it check?Match the tool to the taskUse an LLM where the task requires reasoning. Use code where the task requires a verifiable answer.That’s the whole shift. It sounds obvious. It almost never gets built that way.Here’s why it matters. LLMs and code fail in opposite ways. LLMs are good at ambiguity and bad at certainty. Code is the reverse. A pipeline that uses code where it should use an LLM produces brittle, rule-bound systems that can’t handle real input. A pipeline that uses an LLM where it should use code produces fragile, expensive systems that fail in unpredictable places. The only stable architecture puts each tool on the side of the line where its weakness doesn’t matter.Here’s what that looks like in practice. The agent I’m describing has six phases. Three use an LLM. Three don’t.1. Route — THINK. A small LLM call classifies the user’s intent — write new code, review existing code, explain a concept, generate documentation. Intent classification is genuinely ambiguous; users phrase the same request five different ways. This is a thinking task. An LLM earns its keep here.2. Retrieve — CHECK. Once intent and concepts are extracted, the pipeline looks up the relevant documentation sections from a concept-to-chapter map and pulls keyword-matched excerpts. No similarity search needed here — the mapping is deterministic and the keyword match is mechanical. If you can index your domain cleanly, deterministic retrieval beats probabilistic retrieval. If you can’t, use embeddings — but keep validation deterministic.3. Generate — THINK. The main LLM call produces code using the narrowed context. There’s no deterministic pipeline that reliably turns messy intent into correct code across real input. The LLM is doing what only an LLM can do.4. Validate — CHECK. Two deterministic checks run on the generated output. The API validator confirms every referenced function exists in the actual API registry. The grammar checker confirms the code parses. Both have right answers. Run them as code, not as a model call.5. Repair — THINK. If either validator flags an issue, the offending output plus a structured error report goes back to an LLM whose only job is to patch the specific failure. Repair under structured feedback is a reasoning task, and that’s where an LLM belongs.6. Respond — CHECK. A formatter assembles the final answer along with any warnings the validators produced. Pure assembly, no reasoning required.Six phases, three LLM calls, three deterministic steps. The decisions aren’t about which model to use or how to prompt it. They’re about where the line falls between think and check. Everything else is bookkeeping.Naming the patternOnce you can validate, you can gate. Once you can gate, you can repair. Once you can repair, you need a bound.That progression is the whole pattern: the Bounded Validate–Rewrite Loop.Validators give you a way to say yes or no about an LLM output, with certainty. That capability alone is just measurement. Connect it to a gate and now bad outputs can’t pass. They have to go somewhere. Repair is the natural answer: send the failing output back to an LLM with a structured error, ask for a targeted patch, validate again. And the moment you have a repair cycle, you need a cap on it. Two attempts, then surface the failure rather than spin forever. Otherwise repair becomes its own outage.A minimal trip through the loop. The model emits a tool call. A schema validator rejects the arguments. The rewrite model patches only the call, not the whole chain. That’s the architecture working as designed.The shape generalizes anywhere an LLM produces output with a property that can be mechanically checked. A few examples that aren’t code generation:• A SQL-writing agent. The LLM proposes a query. A deterministic check confirms every referenced table and column exists in the schema. If not, the original query plus the schema error goes back for repair.• A tool-using agent. The LLM emits a tool call. A schema validator checks the arguments against the tool signature. Bad arguments trigger a targeted rewrite, not a regeneration of the entire reasoning chain.• A structured-output agent. The LLM emits JSON. A schema validator confirms the shape and types. Repair, not retry.• A document-generation agent. The LLM drafts content with citations. A deterministic check confirms every cited source exists in the corpus. Hallucinated citations get patched.In each case the structure is the same: free-form generation, then mechanical verification, then targeted repair under structured feedback. The LLM stays where its strength is — producing plausible candidates. Code stays where its strength is — answering with certainty.And if you can’t validate it, don’t let the agent act on it.This doesn’t solve “valid but wrong.” It makes “invalid” rare and visible — which is what makes the wrong-but-valid cases tractable for human review.What you get is a system you can reason about. When something fails, you know where. When the LLM hallucinates, you catch it before it leaves the building. When the rewrite loop can’t fix something, it tells you, instead of pretending.That’s the upgrade. Not fewer LLMs. Better placement.None of this is new. Production agent builders have been converging on it from different directions: deterministic orchestration, guardrail patterns, verification loops, structured retry. What I’ve tried to do here is compress it into one node-level question you can ask of any pipeline you’re building.The question to ask of your own pipelineOpen your agent diagram. For each node, ask one question: should this step think, or should it check?Most nodes have an obvious answer the moment you stop assuming the LLM is the default. Classification is thinking. Schema validation is checking. Generation is thinking. Existence lookups are checking. Repair is thinking. Assembly is checking.Once you’ve labeled every node, count how many checking steps in your current pipeline are routed through an LLM. That number is the size of the upgrade available to you.Reliable agents aren’t built with better prompts or bigger models. They’re built by drawing a clear line between the steps that guess and the steps that verify — and putting an LLM only on the side of the line where guessing is the right answer.The question isn’t whether to use LLMs. It’s where to stop.Not Every Node in Your Agent Needs an LLM was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.