INQUIRING LINE

For AI agents doing repeat coding or support work, which memory-reuse trick actually saves the most time and money?

Which caching strategy works best for coding agents and support tasks?

This explores which ways of reusing context (prompt caching, KV-cache management, and higher-level reuse of skills and workflows) save the most cost and time for AI agents doing repetitive work like coding or customer support. The corpus doesn't compare coding and support head to head, but it does say clearly what makes caching pay off and what quietly breaks it.


This explores which ways of reusing context save the most cost and time for agents doing repetitive work like coding or support. The corpus has no head-to-head test of coding versus support agents. What it shows is that the right strategy depends less on the task type and more on one thing: how much of what you send the model stays exactly the same from one turn to the next. A benchmark across OpenAI, Anthropic and Google found that prompt caching cuts agent API costs by 41–80% and shortens the wait for the first token by 13–31%. The catch is that caching the whole context by default can make things slower, because you pay to cache conversation content that will never be reused Does prompt caching actually reduce agentic LLM costs?. The approach that holds up is to put stable material (system instructions, tool definitions, reference documents) at the front and cache only that front portion. Let the changing parts of the conversation sit after it, uncached.

That principle explains a less obvious trap. If an agent discovers its tools on the fly, as MCP-style setups often do, the tool list at the start of the prompt keeps changing. Cache hits require that starting portion to match exactly, so every new tool wipes out the savings. The fix proposed in Does dynamic tool discovery break prompt caching benefits? is to keep a small, fixed set of general-purpose functions and let the agent write code for anything new. Flexibility moves out of the prompt and into the generated code. This matters for coding agents, which tend to pile on tools. Support agents usually have a stable set of policies and knowledge-base documents, so they are natural candidates for long cached prefixes.

When caching works, it changes how you should measure cost. A 115-day case study of a long-running agent environment found that 82.9% of all tokens were cache reads Do persistent agents really cost less per token?. At that point, price per token stops being the useful number. Cost per finished piece of work (a merged fix, a resolved ticket) is what tells you whether the setup is efficient. A related cost lever is model choice: much routine agent work can go to small models at 10–30× lower cost Can small language models handle most agent tasks?.

The more surprising point is that the strongest form of caching may not be token caching at all. It is caching what the agent has learned to do. Agent Workflow Memory extracts reusable sub-task routines from past runs and builds bigger routines out of smaller ones. It improved results by 24–51% on web-agent benchmarks, and the gains grew as new tasks looked less like the training tasks Can agents learn reusable sub-task routines from past experience?. VOYAGER does something similar with a searchable library of runnable code skills Can agents learn new skills without forgetting old ones?. For support work, that would look like resolution playbooks. For coding, it would look like reusable scripts and helper functions, which is a layer What happens to code that agents create and then share? flags as promising but under-studied.

One warning before you treat any shared store as a cache: agents will use it as memory whether you planned for that or not. In one evaluation, short-lived agents turned a shared package repository into memory that outlived each individual agent Can ordinary infrastructure become unplanned agent memory?. Any persistent cache of skills or artifacts is also a channel agents can write to, so it needs the same oversight as a deliberately designed memory system. In short: cache a stable front portion of the prompt, keep the tool set fixed, and invest in reusable workflows. The corpus suggests that last layer is where savings keep building over time.


Sources 8 notes

Does prompt caching actually reduce agentic LLM costs?

A benchmark across OpenAI, Anthropic, and Google found caching reduces API costs 41–80% and improves time-to-first-token 13–31% in multi-turn agentic tasks. However, naive full-context caching can increase latency by caching dynamic content that will never be reused.

Does dynamic tool discovery break prompt caching benefits?

MCP-style dynamic tool discovery breaks prompt caching because tool definitions in the prefix must match exactly for cache hits. Using a fixed set of reusable functions plus code generation for dynamic capabilities preserves cache benefits while maintaining flexibility.

Do persistent agents really cost less per token?

A 115-day case study found 82.9% of tokens were cache reads. When context persists and reuses, the meaningful cost denominator becomes completed artifacts, not individual tokens.

Can small language models handle most agent tasks?

SLMs handle the repetitive, well-defined language tasks that constitute most agent work at 10–30× lower cost than LLMs, making heterogeneous architectures (SLMs by default, LLMs selective) the economically rational design pattern.

Can agents learn reusable sub-task routines from past experience?

Agent Workflow Memory induces sub-task routines at finer granularity than full tasks, abstracts example-specific values, and compounds them hierarchically. This produces 24.6% relative gain on Mind2Web and 51.1% on WebArena, with larger gains as train-test gaps widen.

Show all 8 sources
Can agents learn new skills without forgetting old ones?

VOYAGER demonstrates that storing executable skills in an embedding-indexed library and composing complex skills from simpler ones allows agents to learn continuously while avoiding the forgetting that occurs with weight-update-based methods. Environmental feedback refines skills while an automatic curriculum drives continual exploration.

What happens to code that agents create and then share?

Among three agentic code layers, agent-created artifacts that persist and are shared remain understudied. Key open challenges—evaluation, verification, regression prevention, shared state consistency, and safety oversight—all converge on this layer, suggesting it may be where future autonomy gains emerge.

Can ordinary infrastructure become unplanned agent memory?

During a 2026 evaluation, short-lived AI agents repurposed a shared package repository as memory by writing and reading exploit findings across agent lifespans. The agents converted ordinary infrastructure into persistent state without deliberate memory system architecture.

Papers this line draws on 8

The research behind the notes this line reads — ranked by how closely each paper relates.