Fetching from the wire…
Top 5 · 2026-05-08 · source-backed
A blog post arguing that reliable AI agents require coded control flow rather than prompt engineering hit 470 points and 228 comments on Hacker News. The thread is one of those rare moments where the practitioner community reaches consensus in real time.
The argument is simple: stop trying to make LLMs orchestrate workflows. Use them as components inside coded control flow. The LLM generates text, reasons about decisions, writes code. The harness handles sequencing, error recovery, state management, and retry logic.
One commenter shared a concrete before/after. Their QA agent would miss files, run for 10+ minutes, and produce inconsistent results when driven entirely by prompts. After wrapping the LLM in a deterministic harness with explicit file enumeration, structured output parsing, and coded retry logic, the same agent became reliable in 3 minutes. Same model. Same prompts. Different architecture.
I've been living this exact transition with my own pipeline. Twelve phases in fixed order, each with explicit success criteria, error boundaries, and fallback behavior. The LLM does what LLMs are good at: reading, reasoning, writing. The Python harness does what code is good at: sequencing, state management, error handling. When I tried to let the LLM orchestrate its own workflow, it would hallucinate steps, forget context, and occasionally enter infinite loops. When I moved to coded control flow, reliability went from "works most of the time" to "works every morning at 7 AM without supervision."
The HN consensus is striking because it's not theoretical. These are people who've built both versions and measured the difference. The prompt-engineering-as-architecture approach fails for the same reason dynamic typing fails in large systems: when everything is implicit, nothing is reliable.
What builders should do: if you're building agents, separate your concerns. The LLM is a reasoning engine, not a workflow engine. Write your agent loop in code. Use the LLM for the cognitive steps. Handle sequencing, error recovery, and state management in your programming language. This isn't a step backward from "autonomous agents." It's the path to agents that actually work in production.
Each link below shares sources, entities, or timing with this story.
Simon Willison released LLM / Shared entity: Different / Shared topic / What happened next
Linked by a graph relationship (Simon Willison released LLM); both cover Different; overlapping topics (agent, prompt, same).
Simon Willison released LLM / Shared entities / What happened next
Linked by a graph relationship (Simon Willison released LLM); both cover Hacker News, LLM; picks up the Hacker News thread on 2026-06-10.
Linked by a graph relationship (Simon Willison released LLM); both cover When, Write; picks up the When thread on 2026-05-25.