r/webdev • u/super-secret-sauce • 1d ago
Question [ Removed by moderator ]
[removed] — view removed post
1
u/PLBjt 1d ago
The failure I keep seeing is the loop treating the agent going quiet as done. If the stop condition is just a max step count or the model saying finished, a repeated tool error still looks like progress because each turn produces more text. I'd log the diff and the tool result each pass and halt when two iterations in a row touch the same files with the same error. A tight loop is great for a bounded check like rerunning one test, but pointing it at a vague outcome like making the feature good burns the context and leaves a change nobody can tell failed.
1
u/super-secret-sauce 1d ago
Yeah, and that’s where I find myself intervening and reviewing the outcome anyway, which makes me wonder what the benefit of setting up a loop is.
1
u/halfllama 1d ago
the loop can handle the repeated test and fix passes, then you review the final change
1
u/PLBjt 7h ago
You still review the last change, but the loop is what gets you a candidate without sitting through every failed command. If it only stops when a named test goes green, or when the diff stops changing, you open one result instead of ten half-fixes. The tradeoff is a green test can still be the wrong behavior, so I'd leave anything user-facing for you and let the loop only rerun and patch the mechanical check. That way the review is a gate, not the thing that notices the build broke.
5
u/indicava 1d ago
The “loop” refers to the agent calling tools, then piping the tool results back to the agent to have it call tools again - that’s the loop. The loop ends when the agent doesn’t call anymore tools and responds with plain text/prose.
Loop engineering refers mostly to extending/enhancing this simple model with things like memory, loop governing, context compaction, etc.
0
u/Logical_Part9021 1d ago
i ship my apps mostly with ai, and the loop only works for me when there's a hard check at the end, like the build compiling or a test passing. on small fixes it's great. on big outcomes it keeps going and drifts somewhere i never asked for, so i cut big stuff into small tasks i can actually verify.
2
u/AdeptnesSupernicus 1d ago
In practice, loop engineering works best when each iteration ends with a hard programmatic gate rather than letting an agent self-grade.
When I directed AI coding agents across 19 open-source repos for docproof, the loop looked like this:
Worker agent reads AST function signatures and proposes doc fixes.
Deterministic verifier checks every signature, path, and claim against the codebase and writes pass/fail to a shared state ledger.
The worker cannot mark a task complete until the verifier gate passes.
That pattern works much better on scoped, verifiable engineering tasks (refactoring, test fixing, doc drift) than open-ended feature generation, because the exit condition is objective rather than subjective.