Thesis FinanceToken cost optimization

57% lower model cost in an offline replay

We changed how an investing agent reused context and sent tool data to its model. A recorded offline replay used 11 captured production turns. It computed a drop from $2.09 to $0.90 per options turn.

By Ali AghaUpdated

The number this case stands on−57%Model cost per options turn in an offline replay. $2.09 before. $0.90 after. No live before-and-after was recorded.Cache breakpoints let later steps reuse context. Smaller tool results reduced the input sent to the model.

Fact card

System
Thesis Finance. An investing assistant that uses tools to answer portfolio and options questions.
Scope
The context and options data sent back to the model at each step.
Method
Review the traces. Change cache use and tool output. Test the code. Replay the captured work.
Evidence limit
11 captured production turns. The record reports an offline replay. No live before-and-after was recorded.
Thesis Finance method: identify repeated context, change caching and tool output, then compare an offline replay.
Method overview. The results and their limitations are documented below.

One answer included several paid calls

An options answer could take several model steps. Each step read context from earlier steps and tool results. The trace review found the same large input being billed again within a turn.

An options-chain result also held duplicate data and unused fields. The full app payload was reaching the model. A better prompt alone would still leave that source of cost in place.

For the same check on another system, follow the guide to tracing growing agent costs.

We changed two boundaries

We changed what reached the next model call. Other parts of the app kept the full tool data.

  • Cache reuse within a turn. We added rolling cache breakpoints to the model adapter. Later calls could reuse a shared prefix. The code capped the marker count. It repaired requests that went over the cap.
  • Smaller tool results. We built a trimmed copy for the model. It dropped duplicate raw data and unused source fields. It rounded numbers and narrowed the expiry window. Other app callers kept the full payload.
  • Contract checks. Tests checked cache markers and rules for the trimmed data. If that step failed, the app could use the full payload and report the error.

How the replay was checked

The team captured a baseline of 11 production options turns. The shipped code replayed the data changes and computed the costs. This used captured work. It was not a controlled before-and-after on new live traffic.

The checks measured the size of the options payloads. They checked that other tools passed through unchanged. Code tests checked cache use and the data rules. Those tests do not prove that each final answer would be just as useful.

Before a wider rollout, use a separate cost-and-quality comparison with acceptance rules and live observation.

What the record shows

MeasureResultHow we know
Model cost per options turn$2.09 → $0.90Computed in the recorded offline replay of 11 captured production turns; about 57% lower
Options payload size2.5–6× smallerRecorded comparison after the model-facing projection
Other tool payloadsUnchangedNon-options tools were byte-identical in the recorded replay

An earlier cost model projected a different result on one turn. That is not the headline here. We use the narrower replay result from the record.

What this result does not establish

  • A live saving. No live before-and-after was recorded. We do not claim this replay caused a lower monthly bill.
  • Equal answer quality. Smaller payloads and passing code tests are useful checks. The final answers still need their own review.
  • A result for every task. This change targeted options-heavy turns. It does not forecast savings for short, single-call tasks. It is not an average for the whole service.
  • A saving for another company. Its context, tools, models and cache use need their own baseline.

What to try on your own agent

Start with one costly task. Inspect what each model step reads. Split the bill into uncached input, cache reads, cache writes and output. Look at the tool data sent to the model. The app screen alone may not show it.

Test a smaller payload or better cache use on the same saved tasks. Keep needed fields and sources. Compare useful results, full-run cost, time and human review. Then test the change on live work.

Use the free agent cost calculator to organize your starting numbers and download a worksheet.

Questions a buyer asks about this case

Was the 57% reduction measured on live traffic?
No. It is a computed cost drop in a recorded offline replay. The replay used 11 captured production turns. No live before-and-after was recorded.
Did the replay prove answer quality stayed the same?
No. The tests checked payloads and code behavior. They did not fully test answer quality. The final answers and live result still need checks.
Would a cheaper model have solved it?
A model change is another test to run. This work addressed repeated context and large tool results. Compare each change on full tasks before choosing.

Provenance

Based on the July 24–25, 2026 investigation record. The shipped cache and projection code and its tests support the method. The cost figures come from that record. Raw replay files are not part of this public case. Private traces, client data, total spend and usage volumes are withheld. Last updated October 14, 2026.

If a workflow in your company looks like this one, tell us which. We will say on the first call whether it is worth fixing.

Book a call