Skip to content
be-human.ai
← Back to the journal

Harness fundamentals

Prompt Caching for AI Agents: Cut Repeated Cost Without Stale Rules

Prompt caching reuses the processed start of a repeated agent prompt. Learn how to order it, version it and keep cached rules from going stale.

Be Human typographic cover with the title: Prompt Caching for AI Agents: Cut Repeated Cost Without Stale Rules
Conceptual illustration created with AI · Be Human

Prompt caching lets a model provider reuse the processed form of a long, unchanged beginning of a request, such as system instructions, tool definitions and reference text. A company agent then pays to process that repeated material once instead of on every call, while the changing task data is processed fresh. The saving holds only when the cached prefix stays stable, which means the instructions behind it must be versioned, tested and retired on purpose.

Key takeaways

  • Prompt caching reuses the processed start of a request, so repeated instructions and reference text cost less to process on each call.
  • Only content that stays identical from request to request can be reused, so stable rules belong at the top and variable task data belongs at the end.
  • Every change to instructions, tool schemas or the model version produces a different prefix, so cache behavior must be tracked against the same release record as the rules.
  • Each run should log the prefix version it used, so a wrong answer can be traced to the exact rules that produced it.
  • Judge the savings by cost per completed task and by consistency on a fixed test set, and never treat the cache as a source of truth.

What prompt caching does inside a company agent

A company agent resends much the same material on nearly every turn: a role description, the rules for what it may and may not do, tool definitions, the output format and often a long policy or reference document. Without caching, the model processes all of that again each time. With prompt caching, the provider keeps the processed form of an unchanged beginning of the request and reuses it when the next request starts with exactly the same content. The variable part, such as the customer message or the ticket under review, is appended after the cached prefix and processed fresh.

The mechanism depends on order. Caching works on a prefix, so anything you want reused has to sit at the top and stay identical. A timestamp, a session identifier or a retrieved paragraph placed near the start changes the prefix on every call, and the cache then helps very little. A practical split is to keep role, policy, tool definitions, format rules and slow-changing reference material in the stable part, and to keep the customer message, the current record, the current date and task-specific retrieved snippets in the live part. The Anthropic documentation on prompt caching describes this prefix behavior in detail and is worth reading before you design the request layout.

Why repeated context is a cost problem

Cost in an agent rarely comes from one call. A single task can involve several model calls, each carrying the full context again, and a loop that retries or checks its own work multiplies that. The useful unit is cost per completed task, not cost per request. FinOps practice treats unit economics as linking spend to a business output, and that framing fits agents well: a cheaper prompt that causes more retries and more escalations is not a saving.

Prompt caching targets the repeated part of that spend. It does not fix a badly scoped task or an agent that loops without limits, so it belongs next to a context budget for each model call and to step and spend caps in the harness. Start by deciding what each call should carry, using the guidance on context budgets for model calls, and then decide which part of that context is stable enough to cache.

Why a cache can outlive its rules

This is the risk that deserves the most attention. A cache is useful because it reuses an earlier result, and an earlier result is only correct while the text behind it still matches the policy you want the agent to follow. If the instructions change but an older prefix is still assembled, reused and served, the agent keeps following rules that nobody intends anymore, and its answers look normal enough that no one questions them.

Illustrative scenario: a support team lowers the maximum discount an agent may offer and updates the instruction file on a Friday. The harness reads the file at startup, but the deployment still builds part of the prefix from a copy of the old file kept in a shared configuration folder. For several days, some conversations receive the old discount and others receive the new limit, depending on which instance handled the session. Nothing crashes, and the cost dashboard looks normal. The inconsistency only appears when someone compares answers across sessions, which is why consistency needs its own check.

How to version cached prompts

Versioning turns the cached prefix from a hidden copy into a traceable artifact. The goal is that every prefix can be tied to one set of instructions, one set of tool schemas and one model identifier, and that the harness records which set produced each run. A practical sequence looks like this:

  • Give each instruction file, tool schema and reference block its own version identifier.
  • Assemble the prefix from those versioned parts in a fixed order, so the same versions always produce the same text.
  • Write the combined prefix version into every run log, next to the model identifier.
  • Treat any change to the prefix as a release, with a test run and a named approver.
  • After each release, verify which prefix is actually in use, instead of assuming that older entries have been dropped.
  • Retire old versions deliberately and record each retirement in the change log, so a rollback restores the rules and the prefix together.

The same discipline applies to tool names and schemas, which are easy to forget because they look like configuration rather than instructions. The versioning guidance for prompts, tool schemas and models covers how to release them as one unit.

What to check before and after each prefix change

A prefix change should pass a short, repeatable check before it reaches live work. Keep the list small enough that someone will run it every time:

  • Run a fixed set of test cases, including the policy edge cases, and compare the answers with the previous release.
  • Confirm that the tool names in the prefix match the tools the harness actually registers.
  • Check that outputs still pass the schema the downstream system expects.
  • Confirm that the prefix version in the logs matches the version in the release record.
  • Watch cost per completed task and latency for a period after the release, and investigate any sudden change instead of accepting it.
  • Keep the previous release ready so that a rollback can be completed in one step.

A small, fixed evaluation set is the simplest way to make the first check repeatable. The Anthropic engineering article on evals for agents explains how to design cases that measure outcomes rather than surface wording. When a check fails, the replay log fields for a bad run tell you what to record so the failure can be reproduced.

How Be Human keeps cached rules current

In managed operations, Be Human keeps each agent's instructions, tool schemas, memory references and approval rules as versioned files in a reviewable workspace, assembles the stable prefix from them in a fixed order, and records the prefix version with every run. Changes to the prefix pass through the same review path as changes to tool permissions, and monitoring compares the version in production with the version on record, so drift appears as an event to investigate rather than as a surprise in a customer conversation. The work is scoped to one useful role at a time, so the stable part stays small enough to test.

If you are unsure which of your agent tasks would benefit from a stable, versioned prefix, the free Be Human AI diagnostic is a practical way to find the first task worth handing to an agent.

Frequently asked questions

Does prompt caching change what the agent says? It should not change the rules the agent follows, because caching only reuses the processed form of text that is identical to an earlier request. The practical risk is staleness rather than randomness, since an old prefix can keep outdated rules alive after you edit them. Verifying the prefix version after each release removes most of that risk.

Can I cache tool definitions and reference documents together with the instructions? Yes, as long as they are stable and placed at the top of the request in a fixed order. Tool schemas change when you add or rename tools, so they belong in the same release record as the instructions. Long reference texts that change often should stay in the live part of the request.

Is prompt caching the same as agent memory? No. Memory is what the agent keeps or retrieves about the business, customers or past work, and it is governed by what the harness is allowed to store. Prompt caching only reuses the processing of text you send again, so it does not decide what the agent remembers or whether that memory is correct.

When should a team skip prompt caching? Skip it when the stable prefix is small, when the text near the top changes on every request, or when the task runs only occasionally. In those cases the saving is small and the versioning work may cost more than it returns. Measure cost per completed task before and after, and keep the setup only if the results support it.

Your next step

See where an AI agent fits in your company first.

Take the free Be Human AI diagnostic. A few questions about your work show which task to hand to an agent first, what it needs to know and where a person approves.

Be Human editorial guidance. Examples are illustrative unless explicitly attributed. Sources provide background; implementation choices depend on your workflow.

Less busywork. More room for you.

Bring us the work you wish you had time for.

Book a call to try a personalized AI agent free for 7 days ↗Or take the free AI diagnostic →