Agent Architecture and Orchestration
Loop Engineering — Patterns
Loop engineering › Patterns
Durable backlog with leased claims
Problem. Scheduled agents encounter the same eligible issue, or an abandoned claim leaves an issue permanently stuck.
Approach. Normalize discoveries to stable work identities and claim an item atomically with an owner, attempt identifier, and expiry. Persist outcomes on that item instead of manufacturing a new item for each wakeup. Before reclaiming an expired lease, check any external operation that may still be running. Reject writes from an obsolete owner using an ownership generation or equivalent store-enforced check.
Trade-off. Leases make progress recoverable but do not cancel an old worker's side effects. Backend reconciliation and operation deduplication remain necessary when ownership changes.
Rework with explicit feedback and a finite allowance
Problem. A draft fails a checker, but repeated vague instructions to improve it produce different wording without correcting the defect.
Approach. Return failed criteria with evidence and the checked artifact revision. Permit a fixed number of revisions within a shared cost/time envelope. Keep the acceptance contract unchanged unless an authorized person revises the task. If the feedback shows a missing prerequisite rather than a correctable artifact defect, move the item to waiting or review.
Trade-off. Strict allowances may stop a solvable task. Preserve partial artifacts and failed checks so a later authorized continuation does not lose the investigation.
Human ownership of the outer acceptance policy
Problem. An agent fleet satisfies narrow tests while gradually working on the wrong priorities or optimizing away useful review.
Approach. Version scope, priority rules, and acceptance criteria independently of generated artifacts. Sample both accepted and rejected work for human review. Use those observations to propose controller changes, evaluate the changes on representative cases, and release an authorized policy revision. Production workers may suggest adjustments but cannot promote their own completion shortcuts into acceptance rules.
Trade-off. Review consumes scarce attention. Reserve it for policy changes and representative outcomes rather than requiring a person to narrate every inner model turn.
No-work is a classified outcome
Problem. Repeated wakeups consume model calls even when the backlog has no eligible item.
Approach. Check eligibility in ordinary code before launching an expensive agent. Record whether no work, an unmet prerequisite, or an exhausted allowance prevented dispatch. Resume on a relevant event or the next intended schedule, and notify only on outcomes the user's notification policy calls actionable.
Trade-off. Eligibility checks need fresh enough source state. A stale cache can suppress legitimate work, so monitor discovery lag separately from agent completion quality.