The Agentic Loop, as an Economics ProblemRoute compute energy to the cheapest sufficient path, and know when to stop.
Strip the branding off any agent-orchestration product and the engine is the standard agent loop: reason, act, observe, repeat until a stopping condition fires. Most of what gets bolted on top is really a cost-control device: a gate that decides where money gets spent, and where it stops. This page reads one such system, RuVector / Claude-Flow, that way, and shows where the measurement instrument goes.
Signal path
The loop & its gates: where cost accrues
What's old vs. what's the claim
~80% established loop · ~20% a real, well-aimed idea
The loop is the default established
Reason -> act -> observe -> repeat is the ReAct + Reflexion lineage, the industry-standard agent pattern. Routing simple work to cheap models and steering behavior with markdown spec files (Cursor rules, CLAUDE.md) is the same pattern most teams already run.
The external gate is the twist the claim
Naive retry loops fail when the model grades its own homework and talks itself into wrong answers. The pitch: gate the loop with a deterministic, math-based coherence check plus a structured memory that lives outside the model. "Refuse rather than lie" is that gate firing.
Cost model
How the economics actually play out
Total cost = Σ (iterations) × (context tokens + output tokens) × (model tier). Two things blow it up: too many retries, and context that grows every loop. Every mechanism below is a lever against one of those.
Right-size the compute: MoE routing
Don't pay reasoning-model prices for mechanical work. A WASM booster handles transforms at ~$0; only architectural reasoning reaches Opus. This is the single biggest lever.
Halt early: the coherence gate
Stopping an incoherent run saves the marginal loop cost and the far larger downstream cost of acting on a hallucination (bad tool call, wrong code, human cleanup).
Stop re-paying for context: external memory
Read state from a vector+graph store instead of re-stuffing full history into the prompt each loop. Turns a growing per-loop token bill into roughly flat retrieval. RVF copy-on-write (512 MB -> ~2.5 MB child) is the storage version.
Cut the unit cost: quantization
Int8 weights (3.92x memory reduction) and Flash Attention (2.49-7.47x speedup) lower the price of every inference. Infra-side, not loop-side.
* Figures marked with an asterisk are the RuVector / Claude-Flow project's own published claims, reproduced here as the subject of analysis. They have not been independently measured by the author, and the closing section proposes the protocol that would measure them.
The instrument
Where AEQ plugs in
AEQ (Agent Efficiency Quotient) is the gauge that tells you which side of break-even you are on. It is an architecture quality metric, not a cost metric. Token prices fall over time; three things do not get cheaper: latency compounds across chained steps, bloated prompts degrade instruction-following, and every wasted token displaces tool output, history, or reasoning room in a finite context window.
The numerator is not scored on an absolute scale. It is held constant by an equivalence rubric: two runs are compared only when they deliver the same substantive answer. When value is equal, the token delta between architectures is, by construction, pure architectural waste. AEQ reads that waste across three independently addressable layers.
| Layer | What it measures | How |
|---|---|---|
| Prompt | System-prompt tokens as a share of total: overhead paid on every iteration | Exact tokenizer count before the call |
| Orchestration | Unnecessary calls, retries, and re-derivation of known state | Calls and tool-output tokens vs. an optimized baseline |
| Output | Verbosity beyond what the answer requires | Output tokens vs. a capped equivalent-content baseline |
Single-turn, hybrid simulation (tokenizer-exact inputs, estimated outputs): same model, same query, same answer, a 4.68x token spread between optimized and bloated architectures. In a later dual-provider run the same bloat pattern held on both vendors (2.04x on one, 5.51x on the other), which is the evidence that the waste belongs to the architecture rather than to any one model.
For a loop, the numerator generalizes from "same answer" to "successful outcome," where a correct HALT counts as value preserved (the avoided downstream cost of acting on a hallucination). That gives the loop-native reading:
- Every gate becomes A/B-testable against one number. If the coherence gate raises AEQ-L it pays for itself; if it lowers it, you are below break-even and deterministic code wins.
- Break-even stops being a guess. Routing tiers and gate thresholds become tunable against a single measured value.
- Known limit: AEQ was validated on single-turn interactions, where the minimum necessary work is knowable in advance. In a loop it generally is not. AEQ-L is the proposed adaptation, and it is stated here as a proposal awaiting measurement, not a finding.
Measured, not claimed
What lever 04 actually returned
Lever 04 above says quantization cuts the unit cost, on the project's own published figures. That is a claim about price. The question it leaves alone is whether the compressed model still answers correctly, and that one was measured. A 4-bit quantized 3B model passed three rubric cells its own fp16 parent failed, on the identical rubric and the same workload.
Paired weights pinned by digest. Same rubric, same workload, same judge. Precision was the only variable. The compressed model derived the answer correctly and its full-precision parent confabulated.
A result that flatters the author is the one most likely to be a bug, so it was audited as one first: chat template, sampling configuration, stop-token handling and inference stack, each checked against the run artifacts. Then it was re-run on freshly pulled weights sixteen days later. The quantized model reproduced its correct derivation character for character. The parent reproduced its confabulation structurally. Three runs out of three each way.
It was not isolated. A 7B model failed a quantitative class by fabricating internally consistent numbers while a 3B model pulled the correct inputs and divided them correctly. A later run of current open-weight models on a 16 GB desktop showed the same shape:
| Query class | qwen3.5 (9.7B, 4-bit) | gemma4 (12B, 4-bit) |
|---|---|---|
| Retrieval | pass 3/3 | fail |
| Analytical ranking | fail 3/3, same wrong ranking | fail |
| Synthesis | pass 3/3 | pass |
| Quantitative derivation | pass 3/3 | pass |
| Distractor trap | fail, never produced an answer | fail |
The smaller model certified more classes than the larger one. Its trap failure was a mode worth naming: it spent the entire output budget reasoning and never answered, which a production deployment would guard with a token-budget alarm.
What it does not mean: local models are not ready. Neither open-weight model certified across the full menu, so the cheap API tier remains this workload's certified floor, and local latency ran 280 to 335 seconds per answer against 4 to 8 seconds over API. The registered prediction was also partly wrong. Quantitative derivation was expected to be the likeliest local failure and both models passed it perfectly, with the failures landing in analytical ranking and retrieval instead. The run report records that too.
The defensible statement is narrower and still useful: a model with no per-token price certified on three of the five classes. Read through the playbook in The Cost of a Question, that is a split menu, three classes servable at zero marginal compute where latency tolerates it, with a certified cheap API tier behind the rest.