Deep research agent loops
Planner/critic loops with budgets, memory ranking, and stop conditions.
Deep research agent loops
Business constraint
An agent explores many documents under a time/token budget. Must not loop forever or thrash the same dead ends.
Naive v0
While true: retrieve → generate → repeat. Unbounded tool calls. Memory is a flat list.
Failure drill
Cost blowups. Duplicate fetches. Oscillation between two docs. No audit trail of why it stopped.
Evolution path
Iteration 1
Explicit state machine: plan → act → observe → critique → stop. Budgets on tokens, wall time, and tool calls.
Iteration 2
Memory store with ranked eviction (lab memory-rank). Idempotent tool results keyed by args hash.
Iteration 3
Backpressure: when tools are slow, shrink plan breadth. Persist run state for resume.
Implementation cut
Stop conditions are part of the product. Persist artifacts. Make runs replayable from the event log.
Numbers
Median tool calls/run. Duplicate tool rate. Budget exhaustion vs success rate.
Pattern tags
Self-check
- Why unbounded loops fail economically?
- What belongs in run state?
- How does memory ranking help?
- What is a good stop condition?
- How do idempotent tools reduce thrash?
Walkthrough
Recordings will appear here when published. Until then, work the failure drill and lab locally — pause after each iteration and write the metric that moved.
Lab package: see /systems/labs/memory-rank/.