AGENT LOOP ECONOMICS MATRIX
CHECKING LOCAL ENGINES

What does one completed agent task really cost?

Model planning, coding, testing, review, rework, and failure as one loop. The result exposes true completion economics, not just per-call price.

Transition model

Each origin repeats one cost and duration; its outgoing probabilities must total exactly 1.

from,to,probability,cost_usd,seconds
The whole loop changes the answer.Run the model to resolve visits, absorption, restarts, cost, and time from one matrix.

Completed-task decision

NO RESULT YET

0%
Completion per run0.00%
Runs / success0.0000
Baseline cost / success$0.000
Comparison cost / success$0.000
Baseline duration0.0s
Comparison duration0.0s

Results remain unavailable until a valid model is calculated.

VALIDATED CSVTRANSIENT QABSORBING RFUNDAMENTAL NEXPECTED VISITSCOMPLETION ECONOMICS VALIDATED CSVTRANSIENT QABSORBING RFUNDAMENTAL NEXPECTED VISITSCOMPLETION ECONOMICS

The matrix is the audit trail.

Calculate a valid loop to inspect why stages recur, how success absorbs probability, and which work actually drives completed-task cost.

Expected stage visits N not solved

Transition evidence Q + R

Fundamental matrix N = (I - Q)-1

Observed interpretation 1 / 3

Agent Loop Economics: Absorbing Markov Chains

Read the explanation

Agent pipelines do not execute in a single forward pass. Each stage carries retry probabilities that loop back to previous steps. The fundamental matrix N equals the inverse of identity minus transient transitions Q. This directly solves the expected number of times an agent enters each stage. Clicking Calculate Loop computes the matrix. Halving model price cuts per-run costs, but true completed-task expense depends on restarts from failure.

Absorbing Markov Chains in Agent Loop Economics

How do stage retries and failure rates compound into the true cost and duration of a completed AI agent task?

AI agent workflows rarely proceed in a pure linear sequence; instead, code generation, testing, and review stages frequently loop back for rework or terminate prematurely. This tool models multi-step agent architectures as an absorbing Markov chain. By partitioning stage transitions into transient states (internal stages like Plan, Code, Test, and Review) and absorbing states (such as Done and Failed), the model calculates the fundamental matrix N = (I - Q)⁻¹. This reveals the expected number of times each stage will be revisited and determines overall completion probabilities, total expected compute cost, and latency per successful output.

This calculator assumes transition probabilities between stages are stationary and memoryless (Markovian), whereas real agent runs often experience context accumulation, prompt bloat, and correlated failure modes across iterations. Additionally, the comparison multiplier (0.5 cost) and throughput gain (54%) represent user-specified scenarios rather than empirical benchmarks for any specific LLM provider or orchestration framework.

Try a worked example

Using the bundled sample workflow (Plan, Code, Test, Review with terminal states Done and Failed), leave the parameters at their default values and click 'Calculate loop'. The engine constructs the transient transition matrix Q and absorbing matrix R, solving N = (I - Q)⁻¹. The dashboard updates the status to 'LOOP ECONOMICS SOLVED', demonstrating that Code is visited more than once per task attempt due to downstream test and review failures, and computes the exact runs per success required to absorb into the Done state.

Canonical Transition Matrix & Fundamental Matrix N

In absorbing Markov chain theory, the transition matrix P is arranged in canonical form by placing transient states first and absorbing states last: P = [[Q, R], [0, I]], where Q represents transition probabilities between transient stages and R represents transitions from transient stages directly into absorbing states. Introduction to Probability (Grinstead & Snell), Chapter 11: Markov Chains

The fundamental matrix is defined as N = (I - Q)⁻¹ = I + Q + Q² + ... . Each entry N_ij provides the expected number of visits to transient state s_j given that the agent execution started in state s_i. Summing the entries of row i gives the total expected steps before absorption. Introduction to Probability (Grinstead & Snell), Chapter 11: Markov Chains

Absorption Probabilities and Effective Cost per Success

The matrix of absorption probabilities into terminal states is given by B = N R, where entry B_ij represents the probability that a process starting in transient state s_i is eventually absorbed into absorbing state s_j. Introduction to Probability (Grinstead & Snell), Chapter 11: Markov Chains

When an agent fails to reach success, the task must either abort or restart from the beginning. If the probability of successful absorption per attempt is p_success, the expected total runs per completed task equals 1 / p_success. Multiplying the expected cost of an individual run by 1 / p_success yields the true economic cost per delivered output, demonstrating why small improvements in reliability often decrease overall budget more than per-token model discounts.

Sources and further reading
Super generates helpful tools and automates fact-checking across the internet proactively. If you enjoyed this tool, build your own with Super and share it with a friend.