Harnessing LLMs as Agents: What Does It Cost?

Anonymous Authors
Anonymous submission under review at ICLR 2027

Abstract

Language-model agents increasingly rely on harnesses that manage bounded context, persistent memory, tools, verification, and repeated execution, but existing notions of model capability do not quantify the computational resources these mechanisms consume. We develop a theory of these costs through the Language Model Agent Machine (LAM), a resource-bounded model that fixes the underlying semantic model while explicitly charging harness-level resources. Our theory yields four classes of results. Communication: LAM execution and red–blue pebbling are instancewise equivalent at the level of simultaneous call–transfer budgets, yielding the full discrete resource frontier and transferring classical I/O lower bounds to context–memory traffic. Access: memory interface changes asymptotic cost, including a Θ(n)\Theta(n) separation between random and non-speculative sequential access on pointer chasing and an exact single-stack FIFO frontier. Recomputation: bit-reversal DAGs require Θ(n2/(C+S)+n)\Theta(n^2/(C+S)+n) model calls with context capacity CC and persistent-memory capacity SS, quantifying when stored intermediate state avoids repeated semantic computation. Reliability: we derive tight stage-local sampling bounds, exact imperfect-verification costs, and a Young–Daly-type checkpoint law with a closed-form optimal verification interval. Controlled experiments and held-out evaluations on GPT-6 Astra compare development-derived communication and reliability predictions with measurements, including checkpoint optima and a held-out policy-selection tournament conditional on a programmatic segment check; held-out chained MATH additionally exposes an observed tradeoff between whole-task call granularity, logical input traffic, and reliability. Prescribed-schedule runs are reported separately as implementation checks. Together, these results provide a resource theory for the computational cost of language-model agent harnesses. Project page: https://anonymous1776research.github.io/LAM-ICLR2027/.

The Language Model Agent Machine

Modern language-model agents are computational systems built around a model, not isolated model calls: a harness manages context, persistent state, tools, verification, and repeated execution. Existing theory largely characterizes what models or agentic extensions can compute; what it does not characterize is the resource cost of realizing that computation through a harness. Two agents using the same underlying model can have the same semantic capability yet require asymptotically different numbers of model calls, context–memory transfers, memory operations, or verification steps. Universality is in fact cheap in our model, costing O(1)O(1) model calls and block movements per simulated Turing-machine step at a constant number of context blocks (Proposition 8, appendix). This paper therefore asks a different question: holding semantic capability fixed, what resources must a harness spend to execute a computation, and what is the optimal tradeoff among model calls, context, persistent storage, communication, and verification?

Four-panel overview: (a) a deployed language-model agent with context, tools, verifier and memory; (b) the LAM tuple of model interface, controller, active context, persistent memory, tool and verifier interfaces; (c) the tracked resources: calls, tokens, memory-interface operations, capacities and reliability; (d) the red–blue pebbling interpretation of a small computation DAG.
Overview of the Language Model Agent Machine (LAM). (a) A language-model agent interacts with active context, persistent memory, tools, and verifiers. (b) The LAM formalization separates the model interface, controller, active context, persistent memory, tool interface, and verifier interface. (c) We track model calls NN, token traffic TinT_{\mathrm{in}} and ToutT_{\mathrm{out}}, memory-interface operations, capacity limits, and reliability. (d) Red–blue pebbling interprets active-context blocks as red pebbles and persistent-memory blocks as blue pebbles, with transfers corresponding to context–memory communication.

Machine model. The LAM models harness-level execution, the prompt construction, state, memory, tools and verification around a model, not the model’s internal computation. Fix an input size nn and a finite alphabet Σ\Sigma; a semantic block is a fixed-width unit of task-relevant information, an element of Bn=Σb(n)\mathcal{B}_n=\Sigma^{b(n)}. A LAM is a tuple

Λ=(L, ctrl, X, M, Otool, Over),\Lambda=(L,\ \mathrm{ctrl},\ X,\ M,\ O_{\mathrm{tool}},\ O_{\mathrm{ver}}),

where LL is the model interface, ctrl\mathrm{ctrl} the harness controller, XX the active context (at most CC blocks available to the next model call), MM the persistent memory (at most SS blocks across calls, outside XX; a stored block must be retrieved into XX before a call can use it, the persistent copy staying in place), and OtoolO_{\mathrm{tool}} and OverO_{\mathrm{ver}} the tool and verifier interfaces. A call to LL consumes blocks in XX and inserts its output as a new block of XX, so a call takes at most C−1C-1 argument blocks. A tool returns a semantic block through an explicitly charged operation; a verifier returns a tag only (accept/reject), inserts no block, and may inspect all CC resident blocks. Each interface is a fixed map of its opcode and argument blocks alone: no interface sees the input, MM, or a block not passed to it. The controller is a finite control with tag and address registers that see block contents only through returned tags and decoded addresses, plus the occupancy pattern of XX and public step counters.

Value provenance (Definition 1). To separate harness orchestration from semantic computation, every semantic block must originate from an input, a declared constant, or a charged model or tool call. Copying, movement, and storage preserve this origin, while recomputation creates a new occurrence of the same computational value. The controller may route, copy, store, retrieve, and schedule existing blocks, but it cannot create semantic blocks otherwise. This restriction is load-bearing: it lets differences in execution cost be attributed to harness design rather than to a stronger underlying model.

What an execution is charged for.

CounterMeaning
NNNumber of model calls; tool and verifier calls are counted separately as NtoolN_{\mathrm{tool}}, NverN_{\mathrm{ver}}.
TinT_{\mathrm{in}}, ToutT_{\mathrm{out}}Total symbols supplied to, and produced by, model calls over the execution.
QblkQ_{\mathrm{blk}}Semantic blocks transferred between XX and MM, i.e. Θ(Qblk b(n))\Theta(Q_{\mathrm{blk}}\,b(n)) symbols of context–memory traffic.
QmoveQ_{\mathrm{move}}Unit head movements of a sequential interface; zero for random access. Qmem=Qblk+QmoveQ_{\mathrm{mem}}=Q_{\mathrm{blk}}+Q_{\mathrm{move}} is the total number of memory-interface operations.
QobsQ_{\mathrm{obs}}Observations of input blocks made outside model-call arguments: an address decoded from a block, its use as a tool or verifier argument, or its emission as output.
CC, SSCapacities of the active context and of persistent memory, in blocks.
ε\varepsilon, γ\gamma, δ\delta, cvc_vPer-transition error probability; probability gap between the correct successor and the most likely incorrect one; allowed overall failure probability; weighted cost of one verifier call.

Prior inference models as LAM parameter settings. The table is descriptive: the rows differ in which resource grows, and the comparison is one of resources rather than of computational power. TT is the number of reasoning steps.

ModelMemoryContext CCVerifierResource that grows
Direct inference–O(1)O(1)–nothing (N=1N=1)
Chain of thought–Θ(T)\Theta(T)–context
Managed context–O(1)O(1)–calls only
Memory-augmentedRAMO(1)O(1)–calls, memory I/O
Tool-augmentedanyO(1)O(1)–oracle queries
Verifier-assistedanyO(1)O(1)yesverifier queries
LAM (this work)anyanyoptionalall of them, jointly

Two classical theories anticipate two of these resources: the red–blue pebble game of Hong and Kung lower-bounds the traffic between a small fast memory and a large slow one, and reliable computation from unreliable components anticipates an agent whose transitions are expensive and imperfect. An agent exhibits both at once, and the LAM recovers and sharpens both classical theories: Theorem 1 transfers every Hong–Kung I/O lower bound instancewise to context–memory traffic, and Theorem 6 recovers the Young–Daly checkpoint law with its exact cost, a closed-form optimum and the class of rollback policies in which it holds.

What the LAM abstraction adds. The resource laws do not follow from their classical counterparts by renaming memory or checkpoint variables. Each requires an execution-level bridge between a harness trace and the corresponding mathematical object.

ResourceHarness-specific obstacleLAM result
CommunicationA harness may copy, evict, reload, and recompute physical block occurrences while the controller manages state outside the computation DAG.Value provenance yields an instancewise correspondence with red–blue pebbling and equality of the feasible (N,Qblk)(N,Q_{\mathrm{blk}}) budget region, hence the full discrete call–traffic Pareto frontier.
AccessEqual-capacity memories expose different admissible operations, and buffering or copying can invalidate ordinary stack or stream arguments.Random versus non-speculative sequential access has a Θ(n)\Theta(n) separation on pointer chasing, while FIFO retrieval admits an exact single-stack feasibility and traffic frontier.
RecomputationOnly active context participates directly in semantic calls, while persistent state must be explicitly recovered and the input may be delivered only once.Bit-reversal execution has optimal call complexity Θ(n2/(C+S)+n)\Theta(n^2/(C+S)+n), with an exact feasibility region and a matching linear-transfer construction.
ReliabilityErrors occur inside a dependent state trajectory and correctness feedback is itself a priced resource.Stage-local sampling is tight, imperfect verification has an exact error–cost law, and rollback admits a closed-form optimal checkpoint interval.

Results

The results isolate four harness costs: communication, access, recomputation and reliability. Each result states a design Problem, its Assumptions and its Conclusion. Comparisons hold the semantic oracle fixed; only the harness changes.

Numbering follows the submitted manuscript. Theorems 1 to 6 appear in the main text; the other results appear in the appendices.

Common definitions

Value provenance (Definition 1). Every semantic block originates from an input, a declared constant, or a charged model or tool call. The controller may route, copy, store, retrieve and schedule blocks, but never manufacture one. Under this axiom, the lower bounds concern the harness rather than the model.

Vertex-granular GG-evaluation (Definition 2). A vertex-granular evaluation of an LL-realisable DAG GG is a provenance-respecting LAM execution that produces the designated sinks of GG, where each charged semantic call implements at most one declared vertex operation of GG. The execution may copy, move, store, retrieve, evict and recompute values arbitrarily. Two conventions fix how sources enter:

Costs and capacities.

SymbolMeaning
NNNumber of model calls; written NmodelN_{\mathrm{model}} when distinguishing model and verifier calls
Tin,ToutT_{\mathrm{in}},T_{\mathrm{out}}Input and output symbols over all calls
QblkQ_{\mathrm{blk}}Blocks moved between context and memory
QmoveQ_{\mathrm{move}}Unit head movements of a sequential interface
QmemQ_{\mathrm{mem}}Total memory operations: Qblk+QmoveQ_{\mathrm{blk}}+Q_{\mathrm{move}}
QobsQ_{\mathrm{obs}}Observations of input blocks outside model-call arguments
C,SC,SContext and memory capacities, in blocks
Nver,cvN_{\mathrm{ver}},c_vNumber of verifier calls and weighted cost of one verifier call

The weighted model-and-verifier cost is

Cost=Nmodel+cvNver.\mathrm{Cost}=N_{\mathrm{model}}+c_vN_{\mathrm{ver}}.

Communication: replay or persist?

Theorem 1 (red–blue pebbling correspondence).

For memory-initialized vertex-granular evaluations, classical I/O bounds become context–memory traffic bounds, and the two models share the whole feasible resource region.

Problem. How much context–memory traffic is required to evaluate a fixed computation DAG?

Assumptions.

Conclusion. The correspondence works in both directions:

Hence the two models have the same feasible call–transfer budget pairs and the same discrete Pareto frontier. In particular,

min⁡Qblk=IOC,S(G),\min Q_{\mathrm{blk}}=\mathrm{IO}_{C,S}(G),

where IOC,S(G)\mathrm{IO}_{C,S}(G) is the minimum pebbling load-and-store count, attained by a random-access machine. Every red–blue I/O lower bound therefore lower-bounds context–memory traffic.

The correspondence is instancewise. It preserves every priced optimum

min⁡{λNN+λQQblk}\min\{\lambda_N N+\lambda_Q Q_{\mathrm{blk}}\}

for all λN,λQ≥0\lambda_N,\lambda_Q\ge0 (Corollary 9). It also preserves feasibility under every simultaneous call and transfer budget, hence the entire discrete Pareto frontier of (N,Qblk)(N,Q_{\mathrm{blk}}) (Corollary 10).

The evaluation-to-pebbling direction applies to every memory interface, counting pushes, pops, reads and writes as loads and stores.

Corollary 11 (communication bounds for two DAGs).

The correspondence gives concrete transfer bounds for grid and matrix-multiplication DAGs.

Problem. What traffic bounds follow for two standard computations?

Assumptions.

Conclusion. The optimal grid traffic is

Qblk=Θ ⁣(n2C+n).Q_{\mathrm{blk}}=\Theta\!\left(\frac{n^2}{C}+n\right).

For C≤nC\le n, this simplifies to Θ(n2/C)\Theta(n^2/C). A uniform tiled schedule driven by public structural counters attains the bound.

For matrix multiplication,

Qblk=Ω ⁣(n3C).Q_{\mathrm{blk}}=\Omega\!\left(\frac{n^3}{\sqrt{C}}\right).

Both statements concern block transfers for evaluating the prescribed DAG.

Proposition 12 (sequential input traffic).

On dependency-bounded chains, replay incurs a linear-factor input-traffic overhead.

Problem. What does replaying the full history cost compared with supplying only dependencies?

Assumptions.

Conclusion. Replay uses

Tin=Θ(n2b),T_{\mathrm{in}}=\Theta(n^2b),

whereas dependency-only prompting uses

Tin=Θ(nb).T_{\mathrm{in}}=\Theta(nb).

No vertex-wise evaluation of the chain has Tin<nbT_{\mathrm{in}}< nb. Dependency-only prompting is therefore optimal within a constant factor, while replay pays a factor Θ(n)\Theta(n) more.

Access: which interface?

Theorem 2 (demand-following pointer chasing).

Demand-following pointer chasing separates random access from sequential access.

Problem. What does direct addressing save when each read reveals the next address?

Assumptions.

Conclusion. A random-access LAM follows the kk pointers with Qblk=kQ_{\mathrm{blk}}=k and Qmove=0Q_{\mathrm{move}}=0:

For the non-speculative sequential class,

E[Qmove]≥3256 kn,\mathbb{E}[Q_{\mathrm{move}}]\ge\frac{3}{256}\,kn,

and hence

E[Qmem]=Ω(kn).\mathbb{E}[Q_{\mathrm{mem}}]=\Omega(kn).

This gives a Θ(n)\Theta(n) gap in memory operations per hop. Expectations include the random permutation and any execution randomness.

For the broader read-only class, the total head movement still satisfies

E[Qmove]≥2432048n≥n9\mathbb{E}[Q_{\mathrm{move}}] \ge\frac{243}{2048}n \ge\frac{n}{9}

for n≥16n\ge16 (Proposition 14, Corollary 15). This is a total-movement bound, not a per-hop bound.

Theorem 16 (query bandwidth).

Task query complexity lower-bounds the input bandwidth available to a harness.

Problem. How much input must a harness observe, regardless of its interface or adaptive address choices?

Assumptions.

Conclusion. Every deterministic LAM computing ff has an input on which

N(C−1)+Qobs≥D(f).N(C-1)+Q_{\mathrm{obs}}\ge D(f).

Every randomised LAM with error at most 1/31/3 on each input satisfies

max⁡xEx[N(C−1)+Qobs]≥R1/3(f).\max_x\mathbb{E}_x[N(C-1)+Q_{\mathrm{obs}}] \ge R_{1/3}(f).

The relevant quantity is query complexity, not global relevance. For the selector f(s,d1,…,dm)=dsf(s,d_1,\ldots,d_m)=d_s, all m+1m+1 inputs are relevant but D(f)=2D(f)=2. Parity of mm blocks instead has D(f)=mD(f)=m.

Theorem 17 and Corollary 19 (exact one-stack frontier for FIFO).

A single stack has an exact context–storage threshold for reproducing a stream in order.

Problem. What context and traffic does a one-stack implementation of FIFO require?

Assumptions.

Conclusion. Random access solves FIFOn\mathrm{FIFO}_n with C=1C=1, S≥nS\ge n and Qblk=2nQ_{\mathrm{blk}}=2n.

A one-stack LAM solves it if and only if

C≥⌈n+12⌉,S≥(n−C)+.\begin{aligned} C&\ge\left\lceil\frac{n+1}{2}\right\rceil,\\ S&\ge(n-C)_+. \end{aligned}

Here (n−C)+(n-C)_+ denotes the positive part of n−Cn-C. Every such machine makes at least 2(n−C)+2(n-C)_+ pushes and pops. A content-blind schedule attains the capacity and traffic bounds, so the frontier is exact.

If the write phase is instead copy-free streaming, C≥nC\ge n is necessary and sufficient.

Recomputation: persist or regenerate?

Theorem 3 (persistence versus recomputation).

On bit-reversal reuse, total semantic capacity controls the minimum call count within the feasible region.

Problem. How many model calls can persistent memory save on reused intermediates?

Assumptions.

Conclusion. In the feasible random-access setting, the minimum number of model calls is

N=Θ ⁣(n2C+S+n).N=\Theta\!\left(\frac{n^2}{C+S}+n\right).

The explicit bounds are

N≥132(n2C+S+n),N≤4(n2C+S+n).\begin{aligned} N&\ge\frac{1}{32}\left(\frac{n^2}{C+S}+n\right),\\ N&\le4\left(\frac{n^2}{C+S}+n\right). \end{aligned}

Every evaluation in the lower-bound class obeys the first inequality. A random-access LAM attains the upper bound with Qblk≤2nQ_{\mathrm{blk}}\le2n.

For n≥4n\ge4, an evaluation exists if and only if C≥3C\ge3 and C+S≥4C+S\ge4. Within this feasible region, N=Θ(n)N=\Theta(n) exactly when C+S=Ω(n)C+S=\Omega(n):

Thus, once feasibility is satisfied, the call bound depends on total semantic capacity rather than its split between context and memory; the split sets the transfer cost.

Reliability: sample, verify or checkpoint?

Consider a chain of nn semantic transitions. Given a correct state, a model call returns the intended successor with probability 1−ε1-\varepsilon; an undetected error propagates to the end. Let γ>0\gamma>0 be the probability gap between the correct successor and the most likely incorrect alternative, and let δ\delta be the allowed overall failure probability.

Each result below states its own independence and feedback assumptions.

Theorem 21 (sampling amplification, upper bound).

Independent sampling and plurality voting can control end-to-end failure.

Problem. How many samples per transition suffice for overall failure probability at most δ\delta?

Assumptions.

Conclusion. Taking m=O(γ−2log⁡(An/δ))m=O(\gamma^{-2}\log(An/\delta)) samples per transition gives overall failure at most δ\delta, using

N=O ⁣(nγ−2log⁡(An/δ))N=O\!\left(n\gamma^{-2}\log(An/\delta)\right)

model calls.

Theorem 4 (stage-local sampling lower bound).

On a hard stage-local family, adaptive sampling still pays a logarithmic overhead.

Problem. Can adaptive sampling avoid the overhead without any correctness signal?

Assumptions.

Conclusion. For n≥64δn\ge64\delta,

E[N]≥n4γ2log⁡n8δ.\mathbb{E}[N]\ge \frac{n}{4\gamma^2}\log\frac{n}{8\delta}.

This is an Ω(nγ−2log⁡(n/δ))\Omega(n\gamma^{-2}\log(n/\delta)) lower bound. Together with Theorem 21 (the binary family has A=1A=1), it fixes the order

Θ ⁣(nγ−2log⁡(n/δ))\Theta\!\left(n\gamma^{-2}\log(n/\delta)\right)

for sampling without feedback on this stage-local hard family.

Theorem 22 (perfect local verification).

Perfect local feedback gives zero-error execution with linear expected cost at fixed error and verifier cost.

Problem. What does a correctness signal before each commitment save?

Assumptions.

Conclusion. The execution terminates almost surely with zero error, and

E[Nmodel]=E[Nver]=n1−ε.\mathbb{E}[N_{\mathrm{model}}] =\mathbb{E}[N_{\mathrm{ver}}] =\frac{n}{1-\varepsilon}.

Its expected weighted cost is

E[Cost]=n(1+cv)1−ε,\mathbb{E}[\mathrm{Cost}] =\frac{n(1+c_v)}{1-\varepsilon},

which is Θ(n)\Theta(n) for fixed ε\varepsilon and cvc_v.

On the hard family of Theorem 4, this removes the Θ(log⁡(n/δ))\Theta(\log(n/\delta)) factor for constant γ\gamma and cvc_v. The gain comes from feedback, not from more sampling.

Theorem 5 (imperfect local verification, characterised exactly).

Repeated checks trade accepted-error probability against the cost of false rejections.

Problem. How do verifier errors and repeated checks determine reliability and cost?

Assumptions.

Conclusion. Define

at=(1−ε)(1−pr)t,bt=εpat,st=at+bt,qt=btst.\begin{aligned} a_t&=(1-\varepsilon)(1-p_r)^t,\\ b_t&=\varepsilon p_a^t,\\ s_t&=a_t+b_t,\qquad q_t=\frac{b_t}{s_t}. \end{aligned}

At a transition whose earlier accepted transitions are correct, the accepted candidate is wrong with probability qtq_t. The expected numbers of attempts and model calls are each 1/st1/s_t; the expected number of verifier calls is t/stt/s_t. Therefore,

Pr⁡[chain failure]≤nqt.\Pr[\text{chain failure}]\le nq_t.

Under the stationary law, the chain-failure probability is exactly

1−(1−qt)n,1-(1-q_t)^n,

and the expected costs are

E[Nmodel]=nst,E[Nver]=ntst,E[Cost]=n(1+tcv)st.\begin{aligned} \mathbb{E}[N_{\mathrm{model}}]&=\frac{n}{s_t},\\ \mathbb{E}[N_{\mathrm{ver}}]&=\frac{nt}{s_t},\\ \mathbb{E}[\mathrm{Cost}]&=\frac{n(1+tc_v)}{s_t}. \end{aligned}

The accepted-error odds satisfy

qt1−qt=ε1−ε(pa1−pr)t.\frac{q_t}{1-q_t} = \frac{\varepsilon}{1-\varepsilon} \left(\frac{p_a}{1-p_r}\right)^t.

Repeated checks lower these odds if and only if 0<pa<1−pr0< p_a<1-p_r. If pa=0p_a=0, one check makes them zero.

In the regime 0<pa<1−pr0< p_a<1-p_r, the smallest tt satisfying nqt≤δnq_t\le\delta gives

E[Nmodel]=Θ ⁣(n(n/δ)α),α=−log⁡(1−pr)log⁡((1−pr)/pa),t=Θ(log⁡(n/δ)).\begin{aligned} \mathbb{E}[N_{\mathrm{model}}] &=\Theta\!\left(n(n/\delta)^\alpha\right),\\ \alpha&=\frac{-\log(1-p_r)}{\log((1-p_r)/p_a)},\\ t&=\Theta(\log(n/\delta)). \end{aligned}

This is Corollary 25: false rejections drive the call overhead from repeated checking. Corollary 23 extends the law to candidate-dependent acceptance probabilities, and Corollary 24 to an arbitrary batch-acceptance event with dependent checks within an attempt; the candidate-dependent form is motivated by the verifier behaviour observed in the frontier-model experiments.

Theorem 6 (checkpoint law).

Periodic rollback has an exact cost and a closed-form continuous optimum.

Problem. How many transitions should run between expensive checks?

Assumptions.

Conclusion. Under independent errors, the expected weighted cost is exactly

T(k)=nk(k+cv)(1−ε)−k.T(k)=\frac{n}{k}(k+c_v)(1-\varepsilon)^{-k}.

With β=−log⁡(1−ε)\beta=-\log(1-\varepsilon), its positive-real minimiser is

k⋆=12(cv2+4cv/β−cv).k^\star= \frac12\left(\sqrt{c_v^2+4c_v/\beta}-c_v\right).

As cvβ→0c_v\beta\to0,

k⋆=cv/β(1+O(cvβ)).k^\star= \sqrt{c_v/\beta} \left(1+O(\sqrt{c_v\beta})\right).

If also ε→0\varepsilon\to0, then k⋆∼cv/εk^\star\sim\sqrt{c_v/\varepsilon}. For optimisation of the cost expression over positive integers, an optimum lies within one of k⋆k^\star, and a verifier cost linear in kk returns the optimum to k=1k=1.

This is the Young–Daly checkpointing law in whole-segment form, with an exact cost and closed-form optimum rather than a first-order approximation.

Under the hazard-bounded extension, E[T(k)]\mathbb{E}[T(k)] lies between T(k)T(k) evaluated at ε‾\underline\varepsilon and at ε‾\overline\varepsilon (Proposition 28).

Proposition 26 (joint local verification and segment rollback).

Local checking and segment rollback can be priced in one formula.

Problem. Should a harness check each step, check each segment, or combine both?

Assumptions.

Conclusion. Let gt=(1+tcv)/stg_t=(1+tc_v)/s_t be the expected weighted cost per locally accepted step, and let qt=bt/stq_t=b_t/s_t be its residual error. Then

T(t,k)=nk(k gt+cs)(1−qt)−k.T(t,k)=\frac{n}{k}(k\,g_t+c_s)(1-q_t)^{-k}.

With βt=−log⁡(1−qt)\beta_t=-\log(1-q_t), the continuous checkpoint optimum for βt>0\beta_t>0 is

kt⋆=cs2+4gtcs/βt−cs2gt,k_t^\star= \frac{\sqrt{c_s^2+4g_tc_s/\beta_t}-c_s}{2g_t},

clipped to [1,n][1,n].

Interior hybrids strictly beat both pure checkpointing and pure local checking in an explicit regime. The exact finite optimum is a small enumeration over integer (t,k)(t,k). Corollary 27 adds a price per semantic block transfer to the same formula.

The frontier-model tournament of Section 8 is a direct instance: its forecast winner and measured winner are both read off these formulas.

Design rules

Experiments

Although the primary contribution is theoretical, experiments play two roles. All model-based experiments use the same fixed GPT-6 Astra deployment. Held-out tests compare development-derived quantitative predictions or policy choices with disjoint evaluation data, covering communication, checkpointing and reliability. Implementation checks verify that prescribed schedules realize their analytically determined resource accounting; these are reported separately and are not treated as empirical tests of lower bounds. Development or calibration data and held-out evaluation data are disjoint; forecast parameters and policy-selection rules determined from the former remain fixed on the latter. Success rates use Wilson 95% intervals, token means use chain-level bootstrap intervals, and paired comparisons use exact McNemar tests.

Four panels: (a) held-out MATH final-answer and all-link success for four harness configurations with 95% intervals; (b) held-out checkpoint-policy tournament, success against weighted cost per arm with the 0.90 target line; (c) checkpoint cost T(k) against k at perfect-verifier prices 1, 4 and 16, forecast curves dashed and measurements solid; (d) bit-reversal implementation check, forecast and measured cost against prescribed call count by schedule type and problem size.
GPT-6 Astra evaluation: prospective predictions, held-out outcomes, and implementation checks. All model calls in panels (a)–(d) use the same fixed GPT-6 Astra deployment; panel (c) uses a programmatic perfect segment verifier at stipulated prices. Where predictions are shown, hollow markers and dashed lines denote development- or calibration-derived predictions, while filled markers and solid lines denote measurements with 95% intervals. (a) Held-out MATH final-answer and all-link success on 70 chains per condition. (b) Held-out checkpoint-policy tournament on 100 fresh chains per arm at measured verifier price cv=0.874c_v=0.874; the horizontal dashed line is the target success probability 0.900.90. (c) Checkpoint cost T(k)T(k) under stipulated perfect-verifier prices 1,4,161,4,16; forecast and measured minimisers coincide at each price. (d) Bit-reversal implementation check under enforced payload limits; marker shape denotes schedule type, colour denotes problem size nn, and hollow/filled markers denote forecast/measured cost.

Communication

As Proposition 12 predicts, the replay-to-dependency-only ratio of logical input traffic grows linearly with depth. For fixed-width state and record encodings the two policies obey the identities Tindep=nhT_{\mathrm{in}}^{\mathrm{dep}}=nh and Tinreplay=nh+b n(n−1)/2T_{\mathrm{in}}^{\mathrm{replay}}=nh+b\,n(n-1)/2, with per-step overhead hh and history-record width bb, and the measured logical traffic follows them across the evaluated depths.

SettingLogical input traffic, replay ÷ dependency-onlyWith exact-prefix caching
Synthetic chain, n=64n=647.1×7.1\times1.72×1.72\times
Development chained MATH, depth 1611×11\times3.05×3.05\times

Replay prompts share long prefixes, so logical traffic can overstate physical prefill when prefix caching is available; the exact-prefix accounting shows that caching narrows, but does not eliminate, the communication advantage of dependency-aware prompting.

Held-out MATH: traffic, success, and granularity

From the 207 eligible MATH-500 problems we build 100 depth-16 answer-dependent chains following Compositional GSM: chains 1–30 form the development set and 31–100 the held-out compositions. GPT-6 Astra is evaluated under four harness configurations: Direct, using one whole-chain call; full-history replay; dependency-only prompting; and dependency-only prompting with an accept/reject verifier. The routing protocol, traffic intervals and success forecasts are determined from the development chains and held fixed on the held-out compositions.

Condition (70 held-out chains)Final answer correctEvery link correctInput tokens per chain
Dependency-only + verifier70/7070/703,217
Replay67/7065/7035,124
Direct (one whole-chain call)65/7064/701,311

Dependency-only prompting with verification solves every held-out chain with every link correct, at a 10.9×10.9\times reduction in input tokens relative to replay. Direct uses the fewest input tokens, in a single call, with lower observed held-out reliability. Thus dependency-aware routing sharply reduces logical input traffic within stepwise execution, while Direct exposes a complementary granularity tradeoff.

Execution granularity is itself a resource choice. A sufficiently capable model may compress many logical dependencies into one semantic call, simultaneously reducing both call count and input traffic. This does not contradict the vertex-granular frontier: it changes the computational primitive being priced. Conversely, the stepwise conditions expose intermediate state to memory management and verification, yielding higher all-link reliability in the held-out evaluation. The choice of semantic-call granularity therefore determines which communication–reliability tradeoffs are available to the harness, and the vertex-granular theory characterizes the resource frontier of stepwise execution rather than of unrestricted whole-task calls.

Reliability: checkpoint forecasts and held-out policy selection

An arm is a policy of the reliability section on a length-16 modular-affine chain x←(a x+b) mod 1016x\leftarrow(a\,x+b)\bmod10^{16} with target failure probability δ=0.10\delta=0.10. Forecast quantities are fixed before evaluation and compared against held-out measurements and their 95% intervals. The deployment’s calibrated step error is ε^=0.049\hat\varepsilon=0.049, and its yes/no check costs cv=0.874c_v=0.874 solver calls in tokens. On a separate transfer set, unamplified chain success is forecast at 0.4480.448 and measured at 51/10051/100, while the in-chain step hazard is forecast and measured at 0.04890.0489.

Checkpoint law (controlled check). With a programmatic perfect segment verifier at stipulated prices cvseg∈{1,4,16}c_v^{\mathrm{seg}}\in\{1,4,16\}, checkpoint attempts per segment match the frozen predictions, the k=4k=4 cost forecast is reproduced, and the forecast and measured grid minimisers coincide at every price (k=4/8/16k=4/8/16; panel (c) of the figure above).

QuantityForecastMeasured
Attempts per segment, k=1k=11.0511.049
Attempts per segment, k=4k=41.2221.208
Attempts per segment, k=16k=162.2302.083
Weighted cost at k=4k=424.424.2 [22.3,26.3][22.3,26.3]
Cost-minimising kk at prices 1, 4, 164 / 8 / 164 / 8 / 16

Wrong-sample rates vary sharply across chain states, so a pooled homogeneous i.i.d. error model does not describe the observed sampling data; a model that preserves the observed state-dependent error structure describes held-out failures substantially better. The predeclared m⋆=15m^\star=15 voting arm nevertheless solves 6/66/6 chains with 0/960/96 wrong plurality decisions. Verifier errors are likewise candidate dependent, which motivates the candidate-dependent formulation of imperfect verification (Corollary 23).

Held-out policy tournament. The tournament compares the principal reliability mechanisms: unverified execution, sampling, local verification, segment rollback, and the joint local-verification–rollback policy. A decision rule calibrated on disjoint data is held fixed on 100 shared held-out chains per arm. At the primary setting (δ,cv)=(0.10,0.874)(\delta,c_v)=(0.10,0.874), the frozen decision rule selects rollback with k=4k=4. On the held-out chains, k=4k=4 is also the cheapest certified policy, with 1/1001/100 failures and weighted cost 25.225.2 [24.1,26.4][24.1,26.4], matching the frozen cost forecast of 25.225.2 (panel (b)). The segment check composes the public affine constants into x↦(Ax+B) mod 1016x\mapsto(Ax+B)\bmod10^{16} outside the priced semantic execution, so the result is a prospective test of checkpoint-policy selection conditional on that implemented interface.

Implementation checks

Bit-reversal schedules with the real model. The bit-reversal DAG Δnrev\Delta^{\mathrm{rev}}_n is instantiated with fixed semantic vertex operations; each model call receives only the blocks required by its scheduled vertex, and the controller enforces the prescribed context and persistent-memory capacities. Recomputing, persistent and resident schedules are compared together with a one-call Direct reference, with rule-specific error and token costs estimated on disjoint calibration data and held fixed. Every prescribed schedule reproduces its analytically determined call, recomputation and transfer counts exactly, without a capacity violation: persistent execution achieves linear model-call complexity with linear context–memory traffic, resident execution removes the transfer cost when all required state fits in context, and recomputing execution incurs the predicted additional semantic calls when persistent state is unavailable (panel (d)).

Controlled simulators. Deterministic simulators execute the constructive schedules of the communication, access and recomputation sections under the formal context and memory bounds, and a stochastic simulator implements the reliability policies with prescribed error laws. On grid DAGs the tiled schedule exhibits the Θ(n2/C)\Theta(n^2/C) communication scaling of Corollary 11, whereas row-major execution remains quadratic until a live row fits in context; on sequential chains, replay and dependency-only prompting reproduce the quadratic and linear input-accounting laws of Proposition 12; on pointer chasing, random access incurs one block read per pointer while demand-following sequential access pays for the intervening head movement, consistent with Theorem 2. For checkpointing, simulated retry costs closely follow the exact objective T(k)T(k) of Theorem 6 and the observed optimum tracks its closed-form minimiser; the square-root approximation is accurate only in its stated asymptotic regime.

Two panels: (a) model-call count N against total semantic capacity C plus S for the checkpoint construction on the bit-reversal DAG, with the theorem's two dashed bound curves; (b) call count against n without persistence (filled) and with sufficient persistence (open), with the dashed line 2n minus 1.
Recomputation implementation check. (a) Model-call count NN for the checkpoint construction of Theorem 3 on Δnrev\Delta_n^{\mathrm{rev}} as total semantic capacity C+SC+S varies. Dashed curves show the theorem’s bounds 132(n2/(C+S)+n)\tfrac1{32}(n^2/(C+S)+n) and 4(n2/(C+S)+n)4(n^2/(C+S)+n). (b) Call count as a function of nn without persistence (S=0S=0, filled) and with sufficient persistence (S=nS=n, open); the dashed line 2n−12n-1 is the persistent schedule.

Across the tested capacity regimes the checkpoint construction reproduces N=Θ(n2/(C+S)+n)N=\Theta(n^2/(C+S)+n), its measured counts satisfying N/(n2/(C+S)+n)∈[0.58,2.0]N/(n^2/(C+S)+n)\in[0.58,2.0] within the explicit constants of Theorem 3, with context–memory traffic Qblk≤2nQ_{\mathrm{blk}}\le2n. With sufficient persistent storage it uses exactly 2n−12n-1 model calls. The check also reproduces the feasibility boundary: at C=3C=3, no-persistence execution fails from insufficient semantic capacity, whereas adding one persistent block makes the schedule feasible.

Two log-log panels: (a) block transfers versus context capacity on a grid DAG for the tiled and row-major schedules against a Theta(n squared over C) reference line; (b) prompt blocks versus chain length for full-history replay and persistent memory.
Communication checks. (a) Block movements QblkQ_{\mathrm{blk}} on the grid DAG under a bounded semantic store: the tiled schedule follows the Θ(n2/C)\Theta(n^2/C) reference slope, whereas row-major traffic stays quadratic until a live row fits. (b) Exact policy accounting on a chain: full-history replay counts prompt blocks quadratically in chain length, persistent-state prompting linearly.
Two panels: (a) memory operations versus table size for RAM and STREAM interfaces in pointer chasing; (b) the same cost normalised by k times n, flat for STREAM and decreasing for RAM.
Access check. Pointer chasing under the demand-following, non-speculative policy of Theorem 2. Random-access block I/O is constant in the table size nn; the sequential (STREAM) memory-interface cost is linear in nn, so its cost normalised by knkn stays constant. The STREAM curve measures head motion, QmoveQ_{\mathrm{move}}, the quantity Theorem 2 bounds.
Two panels: (a) weighted cost versus chain length for stage-local sampling, local verification and no amplification; (b) checkpoint cost per step versus verification interval for several epsilon and verifier-cost settings, with simulation markers on exact curves and dashed leading-order optima.
Reliability checks. (a) Weighted cost against chain length: the prescribed sampling budget pays the logarithmic tax, local verification is linear, and the unamplified chain spends nn calls and almost surely fails. (b) Markers are simulation and curves are the exact T(k)T(k) of Theorem 6; dashed lines show the leading cv/ε\sqrt{c_v/\varepsilon} approximation, which requires both ε≪1\varepsilon\ll1 and cvε≪1c_v\varepsilon\ll1.

Conclusion

LAM makes agent-harness architecture a mathematical object whose resource requirements can be bounded, compared, and optimized while semantic capability is held fixed. Across communication, memory access, recomputation, and reliability, the framework yields exact feasible regions, lower bounds, and closed-form resource tradeoffs. The experiments compare frozen predictions with measurements while also exposing the scope of the theory: dependency-aware routing sharply reduces logical input traffic within stepwise execution, whereas held-out chained MATH shows that a whole-task call can use still less input traffic at lower observed reliability, outside the vertex-granular frontier. Together, these results separate semantic capability from the resource cost of realizing that capability through an agent harness. LAM therefore provides a resource theory of agent execution: harness architecture determines which call, memory, communication, and reliability tradeoffs are achievable even when the underlying semantic model is held fixed.

What accompanies the submission

All theoretical results are stated with their assumptions and proved in the appendices: Theorems 1 to 6 in the main text, and the remaining propositions, corollaries and lemmas, including the exact single-stack normal form, the candidate-dependent and batch-acceptance verification laws, the joint verification–rollback policy and the conditional-hazard checkpoint envelope, in Appendices A to E. Appendix F reports the controlled execution checks and Appendix G the GPT-6 Astra protocol, communication and cache accounting, reliability calibration, dependence diagnostics, the held-out tournament and the bit-reversal implementation check. The supplementary material releases the simulation code, the frontier-model harness, the theorem-target problem set, the figure-generation scripts, raw request logs, frozen experimental configurations and result files, together with the protocols, prompts, model settings, datasets, seeds and other parameters needed to reproduce the reported experiments.

BibTeX

@inproceedings{anonymous2027lam,
title = {Harnessing LLMs as Agents: What Does It Cost?},
author = {Anonymous Authors},
booktitle = {Submitted to the International Conference on Learning Representations (ICLR)},
year = {2027},
note = {Under review}
}