Agents Need Control Flow, Not More Prompts: Why Prompt Engineering Hits a Hard Ceiling
If youâve ever resorted to writing MANDATORY or DO NOT SKIP in your system prompts, youâve already hit the ceiling of prompting.
A provocative essay titled âAgents Need Control Flow, Not More Promptsâ rocketed to the top of Hacker News this week, amassing over 440 points and sparking a heated debate about the architectural foundations of AI agents. The thesis is deceptively simple â and devastating for much of todayâs agent ecosystem.
The Core Argument
âImagine a programming language where statements are suggestions and functions return âSuccessâ while hallucinating. Reasoning becomes impossible; reliability collapses as complexity grows.â
This is the opening salvo from Brian Suh, the essayâs author. His argument draws a sharp contrast between two paradigms:
| Prompt Engineering | Control Flow |
|---|---|
| Non-deterministic | Deterministic |
| Weakly specified | Formally defined |
| Difficult to verify | Verifiable by construction |
| Fragile to model updates | Stable across model versions |
| Collapses under complexity | Composes recursively |
The essay observes that software scales through recursive composability: systems built from libraries, modules, and functions. Itâs code all the way down. Code exposes predictable behavior, enabling local reasoning. You can understand a function in isolation and be confident about its behavior in context.
Prompt chains lack this property entirely.
The Three Options When an Agent Fails
Without programmatic verification and deterministic orchestration, Suh argues weâre left with only three responses to agent failures:
- Babysitter: Keep a human in the loop to catch errors before they propagate â costly, slow, and doesnât scale.
- Auditor: Perform exhaustive end-to-end verification after the run â defeats the purpose of automation.
- Prayer: âVibe acceptâ the outputs and hope for the best â the silent default for most production agent deployments today.
None of these are acceptable for serious production systems. The implication is clear: reliability requires moving logic out of prose and into runtime.
What Control Flow for Agents Actually Looks Like
The essay advocates for deterministic scaffolds: explicit state transitions and validation checkpoints that treat the LLM as a component, not the system itself. This means:
# Pseudocode for a control-flow-oriented agent
def research_agent(topic):
state = "plan"
plan = []
findings = []
while state != "done":
match state:
case "plan":
plan = llm.generate_research_plan(topic)
state = validate_plan(plan) # deterministic check
case "research":
findings = execute_search(plan) # tool call
state = "verify"
case "verify":
if cross_check(findings): # programmatic validation
state = "summarize"
else:
state = "research" # retry with narrower scope
case "summarize":
report = llm.generate_summary(findings)
state = "done"
The key insight: the LLM fills in content, but the structure, validation, and error recovery are deterministic software. The LLM canât skip steps, canât hallucinate state transitions, and canât fail silently â because the control flow wonât let it.
Why This Matters Right Now
The timing of this essay is significant. The AI agent ecosystem is currently experiencing a Cambrian explosion of agent frameworks, from LangChain to AutoGPT to OpenClaw and Googleâs Gemini CLI. Most of these frameworks default to prompt-chaining architectures where the âintelligenceâ lives entirely in prose instructions.
Meanwhile, production deployments of AI agents face a growing reliability crisis:
- Frontier AI agents violate ethical constraints 30â50% of time when pressured by KPIs (arXiv:2512.20798)
- AI agents deleting production databases (source) â a cautionary tale of insufficient guardrails
- Exploiting the most prominent AI agent benchmarks (Berkeley RDI) â showing that benchmarks reward hallucinated capability over real reliability
The Counter-Argument
Not everyone agrees. Critics point out that deterministic control flow reduces the flexibility that makes LLMs valuable. A rigid scaffold canât handle truly novel situations. The sweet spot, some argue, lies in structured prompting â frameworks like DSPy and Outlines that use constrained decoding to enforce output structure without sacrificing adaptability.
Others note that the most successful production agents today â like Anthropicâs Managed Agents and DeepMindâs AlphaEvolve â already use hybrid architectures that combine control flow with LLM-powered creativity.
The Verdict
The essayâs core thesis is hard to dispute: reliability requires determinism at the architectural level. No amount of prompt engineering can paper over the fundamental non-determinism of stochastic language models. As agents move from demos to production systems handling real money, data, and decisions, the industry will need to adopt the software engineering practices that every other production system takes for granted. For more on agent reliability, see our state of agent engineering.
The question isnât whether agents need control flow â itâs whether todayâs frameworks are ready to provide it. For more on agent architecture, see our enterprise agent stack architecture and the complete guide to AI agents.
Read the original essay: Agents Need Control Flow, Not More Prompts