DOC · AGENTIC-LOOP / ECONREV · v1.1BY · M. VALDERRAMACLASS · REFERENCE

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

loop back · re-enter with updated stateRETRIEVEmemoryflat $ROUTEtier?WASM · Haiku · OpusACTtool / infer$$ tokensOBSERVEground truth$ envCOHERE?stressPASSOUTPUTHALT · refuseavoids downstream $$$
live signal path routing / cheap or flat cost where tokens burn gate: halt to save spend

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.

01

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.

30-50% fewer tokens *
02

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).

avoids $$$ tail *
03

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.

flat vs. rising *
04

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.

cheaper / call *

* 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.

Where the economics flip negativeAll this routing, gating, and memory infra has fixed overhead: you pay to run the router, compute the coherence metric, and maintain the store. On high-frequency, low-complexity tasks, plain deterministic code beats both workflows and agents. There's a break-even: the system only wins once routing savings plus avoided-hallucination costs exceed that overhead. Below it, the "smart" system is just more expensive.

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.

Canonical formAEQ = Business Value Delivered / Tokens Consumed

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.

LayerWhat it measuresHow
PromptSystem-prompt tokens as a share of total: overhead paid on every iterationExact tokenizer count before the call
OrchestrationUnnecessary calls, retries, and re-derivation of known stateCalls and tool-output tokens vs. an optimized baseline
OutputVerbosity beyond what the answer requiresOutput 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:

Loop-native readingAEQ-L = successful outcomes, incl. correct refusals / cumulative tokens across all iterations, retries & cleanup
  • 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.
Measurement rule. The loop's own model never grades its own efficiency. AEQ instrumentation is tokenizer-exact and model-independent: token counts, call counts, iteration counts, gate decisions, latency. Outcome and halt-correctness judgment come from outside the loop's model family. The same standard this architecture applies to its coherence gate applies to its measurement layer.

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.

Why the rubric is locked before the run.AEQ Grid runs model by query-class cells against a pass bar fixed before anything executes, records tokens, latency and pass/fail per cell, and grades with a judge from a different vendor family. It answers whether a given model is adequate for a given workload class, which is a question about a pair, not about a model. A surprising result is only evidence if the bar it cleared was set before the result existed.

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 classqwen3.5 (9.7B, 4-bit)gemma4 (12B, 4-bit)
Retrievalpass 3/3fail
Analytical rankingfail 3/3, same wrong rankingfail
Synthesispass 3/3pass
Quantitative derivationpass 3/3pass
Distractor trapfail, never produced an answerfail

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 this does to lever 01Routing down to a smaller model assumes the ordering cheaper-but-worse holds. On this workload it did not. Size did not order capability and neither did precision, so a router built on parameter count is tuning against an assumption rather than a measurement. Lever 04 gets verified here. Lever 01 gets a warning.

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.

The rule that falls out. Capability is per-class and per-workload, not per-parameter-count and not per-precision. The pair, model and workload, is what gets measured, never the spec sheet. "Use the biggest model" is not a control either: on the distractor class the frontier model fell for the trap three times out of three, and every family and size fell for it at least once.