← All posts

Cutting our ambient agent cost by 50%

OpenAI is now using a 30 min prompt cache TTL. It cut costs for our ambient agents by 50%.

On this page
Get started

OpenAI is now using a 30 min prompt cache TTL. We analyzed our telemetry to see what that could mean for our ambient agents. It cut costs for them by 50%.

Ambient agents main cost is idle time

Ambient agents run in the background, watch for events and act when something needs attention. They’re a popular pattern (e.g. Instinct, Muse, Dots, … Struct) because they do things proactively. Their day is a series of bursts - act, wait, wake up again - and they’re long lived.

Struct is a teammate for dev teams that sets up their production monitoring, escalates issues and helps them resolve those issues. We have a network of ambient agents that have ranging traffic patterns. Some process high volumes of events continuously, all day. Others work with more sporadic requests.

OpenAI’s longer cache TTL made the biggest difference in the sporadic case. An example is an agent collaborating with a dev team that might wake to investigate an escalation, later to answer a dev’s question, and also routinely wake to babysit a deployment. When these agents have been idle for too long (past the cache TTL), they take a big hit to cost if they try to keep carrying the context.

Prompt caching lets a provider reuse the “prefix” of a prompt: the instructions, tools and conversation history that the next request adds new messages to. A cache read makes reprocessing that “prefix” cheap. Only new events are full cost.

Bridging idle time with the longer cache TTL

Anthropic offers a 5 min cache that costs 1.25x the standard input token cost to write to and a 1 hr cache that costs 2x input token cost for writes. OpenAI is now using a 30 min TTL. Each hit refreshes the TTL.

For a concrete example, compare Fable 5.1 with GPT-6 Astra. Their input, output and cache-write prices are the same at the context sizes in this example. Fable has the cheaper cache read right now.

Take this example where alerts, developer messages, deployment webhooks and scheduled checks wake an agent over a few hours:

Assume the agent starts with 100k tokens of existing context. Each of the nine turns adds 10k new input tokens and generates 10k output tokens, with the full conversation carried forward. The prompt grows from 110k tokens on the first turn to 270k on the ninth. A hit reads the cached history and writes the new input plus the previous response; a miss rewrites the full prompt.

Cache

Input: cache reads + writes

Output

Total

5 min, Fable

$13.78

$4.50

$18.28

30 min, Astra

$7.00

$4.50

$11.50

1 hr, Fable

$9.51

$4.50

$14.01

The 30 min window covers the 18 min, 8 min and 20 min follow-ups, cutting the total cost by 37% compared with Fable’s 5 min cache, including output. 1 hr adds no hits across the 75 min break, but charges more for writes.

Results on Struct’s production traffic

We pulled Struct’s telemetry for some of these more sporadic agents. We grouped the time between their wake ups:

Gap between wake ups

% of wake ups

Under 5 min

72.5%

5–30 min

15.9%

30 min–1 hr

4.8%

Over 1 hr

6.7%

The 30 min window covers about 88.5% of these gaps, compared with 72.5% for 5 min. Extending it to 1 hr covers 93.3%, but incurring Anthropic’s 1 hr cache penalty ($20/1M tokens) was not worth it for our workload. Remember, the penalty is incurred on every cache write, even if you don’t need it for an hour.

After moving to the OpenAI 30 min cache, we measured:

  • Cache miss rate: 24.2% → 9.2%.
  • Cache-write tokens per message: down about 62%.
  • Agent cost per message: down about 55%, roughly half.

Measuring your traffic is key to finding the right solution here. I’ve been thinking about optimizing our agents a lot, so DM me on LI/email if you’d like to chat more about this!

Continue reading

All posts →