Open Loop vs. Closed Loop: Understanding Workflow and Super Agent Through Loop Engineering
Right after writing LLM Wiki and Agent Knowledge Management, I read an essay on Loop Engineering that snapped several loose ideas into focus. If the previous post asks how knowledge gets verified and refined through use, Loop Engineering asks how tasks get verified, corrected, and completed through execution.
Along the way, it reframes one of the most recurring debates in agent engineering: should you orchestrate work with a deterministic Workflow DAG or a dynamically routing Super Agent?
Viewed through Loop Engineering, they are not rival camps at all. They correspond to two distinct kinds of loops: Closed Loops (bounded delivery) and Open Loops (open-ended exploration).
1. What Loop Engineering Actually Fixes
Day-to-day work with coding agents usually still looks like manual babysitting:
Human writes prompt -> Agent runs -> Human inspects -> Human adds follow-up -> Agent runs again
The agent writes code and runs commands, yet checking the result, judging the gap, choosing the next step, and starting the next turn still sits on the human. Watch three or four parallel sessions like this and your attention fragments within an hour.
Loop Engineering's core thesis is simple: move the check-and-continue step inside the loop, letting the agent compare execution results against the goal and form the next turn itself (self-prompting). Humans step back to owning goals, boundaries, and key decisions.
A complete iteration follows a clean cycle:
Goal -> Discovery -> Plan -> Execute -> Verify -> Deliver on pass / Iterate on fail
Two pieces determine whether this cycle actually converges — plus a third when tasks grow complex:
- Verification decides when to stop. A vague wish must become concrete acceptance criteria. For adding test coverage, that might mean: targeted tests pass, typecheck passes, and no existing tests regress. When verification fails, feed the exact errors back into the next iteration rather than telling the agent to "try harder."
- External Memory keeps the next round connected. Progress, failure lessons, and remaining work cannot live only inside an ephemeral chat window. Writing them to external files or structured state lets the next round resume without repeating dead ends or forgetting constraints.
- An Orchestrator converges complex work. Once a task splits across multiple agents, an orchestrator breaks down work, dispatches workers, gathers outputs, runs verification, and updates cross-round state. Parallelism is optional; unified convergence is its real job.
2. Open Loop vs. Closed Loop: Two Shapes of Iteration
The framework draws a sharp line between open exploration and bounded delivery:
| Dimension | Open Loop (Super Agent) | Closed Loop (Workflow) |
|---|---|---|
| Goal | Open-ended; direction refined mid-flight | Clear and bounded |
| Next step | Discovered autonomously by the agent | Advances toward a fixed target |
| Stop condition | Fuzzy; requires external budget limits | Stops once acceptance criteria pass |
| Cost | Hard to predict | Relatively bounded |
| Best fit | Exploring opportunities, research, triage | Bug fixes, test coverage, repeatable delivery |
Two concrete examples make the split unmistakable:
- Adding tests to a utility library (Closed Loop): audit coverage gaps, split work by module, write tests and fix bugs, run the test suite and typecheck; loop on failure, deliver when green.
- Ongoing e-commerce growth (Open / Periodic Loop): an orchestrator reads
next_stepsfrom the previous cycle, assigns agents to pick topics, build lead-gen tools, and prepare marketing actions, then summarizes results and writes updatednext_stepsfor the next cycle. There is no "all tests green" finish line, so humans define per-cycle outputs, cadence, and boundaries. Even the original essay notes that rankings like topic priority are advisory — never make the agent the final arbiter, and keep human approval on high-stakes actions like sending emails.
The rollout advice is pragmatic: start with a small Closed Loop, get verification and state persistence solid, and only then widen exploration, multi-agent orchestration, and scheduled triggers.
3. Where This Meets Knowledge Management (LLM Wiki)
Put this next to LLM Wiki and Agent Knowledge Management and the structural symmetry jumps out:
- Knowledge management asks: how does knowledge get validated, corrected, and refactored through use?
- Loop Engineering asks: how does a task get validated, corrected, and finished through execution?
Their most direct bridge is external Memory — with one warning worth underlining: logging task progress and failure notes is not the same as building reliable domain knowledge. Run logs are full of branch-specific workarounds and transient errors. Promoting task experience into durable team knowledge still requires preserving sources, applicability context, and review through real use or human inspection.
There is an even deeper connection around stopping criteria. In the knowledge-management discussion, models struggled to self-judge when a wiki page was "good enough." That is the exact reason Loop Engineering leans so heavily on objective tooling:
- Tasks verifiable by tests, compilers, or linters fit automated Closed Loops cleanly.
- Tasks that depend on domain judgment (compliance reviews, architectural tradeoffs, marketing priorities) still require human feedback.
4. A Boundary Worth Keeping: Objective Checks Do Not Guarantee Convergence
One point in the Loop Engineering essay deserves a skeptical margin note: it ties "objective acceptance criteria" a little too tightly to "reliable convergence and predictable cost."
In practice, clear verification makes failures visible and stop conditions unambiguous, yet it neither guarantees the agent can actually fix the bug nor caps the bill. Test suites themselves can also miss edge cases, or a model stuck on a flaky failure can burn dozens of turns going in circles.
Shipping automated loops safely requires three engineering rails beyond acceptance criteria. Here is how I implemented them in CrewDesk — each pattern transfers cleanly to any agent runtime:
1. Mandatory rework budgets and human escape hatches
Early on, I built file-driven while loops that could spin all night on a broken branch. Replacing free-form cycles with an acyclic forward DAG plus explicit rework edges (kind: "rework") fixed that by requiring a budget at parse time — a rework edge without a budget is rejected before execution starts:
{
"from": "verify_fix",
"to": "fix_failure",
"kind": "rework",
"when": { "==": [{ "var": "passed" }, false] },
"budget": { "maxAttempts": 2, "onExhausted": "human" }
}
When attempts run out, onExhausted: "fail" terminates cleanly with the final error; onExhausted: "human" pauses and sends the attempt diffs and failure reasons to the human inbox to grant one more attempt or stop. Scheduled triggers also trip a circuit breaker after 3 consecutive failures.
2. Append-only attempt ledgers instead of overwritten state files
Overwriting a single progress file makes postmortems painful once a process crashes or retries three times. Storing each execution round as an append-only row in SQLite (marking prior attempts superseded without erasing them) while sharing one isolated Git worktree between the fixer and independent verifier lets the engine derive retry state straight from disk after any crash.
3. One host conversation tree so Open and Closed Loops can switch mid-task
Real work rarely stays purely Open or purely Closed from start to finish:
- An Open Loop investigation with a front-desk Super Agent finds the root cause, then transitions straight into a Closed Loop fix → verify → signoff workflow.
- A Closed Loop pauses at a human gate or budget limit, the human changes direction, and the team needs to switch back to Open Loop exploration without losing the shared worktree or history.
Bolting a separate workflow canvas beside a chat UI forces humans to copy context manually every time a task crosses that line. In CrewDesk (ADR 0086), both live on the same parent-child conversation tree and shared Git worktree:
- Front-desk PA
dispatchis the Open Loop ("manual driving"). - Workflow DAGs attach to the same host conversation (
parentConversationId = hostConversationId), and deterministic script nodes append a 0-token synthetictool_use/tool_resultmessage pair into the host ledger — so both the UI and any subsequent PA takeover inherit the exact same context and code state.
5. Takeaway
Loop Engineering is not about letting agents run unattended forever. It is about replacing constant human nudging with a structured iteration framework anchored by reliable verification, external state, and hard budget/approval guardrails:
- Start with small Closed Loops where tools (tests, typecheck, linters) can verify progress objectively, backed by explicit rework budgets and circuit breakers.
- Keep open-ended exploration and domain judgment in Open Loops, where humans set direction and approve irreversible actions.
- Share one workspace and conversation ledger across both so switching modes mid-task is seamless — and promote task notes into long-term Wiki knowledge only after adding provenance, applicability context, and verification.
Related Reading & ADRs:
- Companion post: LLM Wiki and Agent Knowledge Management: Preserving Context, Meaning in Use, and the Recall vs. Maintenance Boundary
- Evolution notes: From Agent Loops to Loop Engineering: Why CrewDesk Replaced Ad-Hoc Loops with an Acyclic Workflow Engine
- ADRs: ADR 0042 (Rework as New Attempts) · ADR 0084 (Shared Worktree Workflows) · ADR 0086 (Unify PA and Workflow Tree)