
Same Prompt, Every Turn: Prompt Caching for Agents on Amazon Bedrock
AI agents resend their instructions, tool definitions, and conversation history on every model call. This walkthrough shows how to cache that repeated part for Claude on Amazon Bedrock, keep it unchanged, and confirm cache reads, with production results from SIXT.
An AI agent relies on a large language model (LLM) - provided for example by Amazon Bedrock - to decide what to do next: call one of its tools or answer the user. For each decision, the agent's application sends the model a new inference request: one for the user's message, then one after each tool result, until the model writes the final answer. Each request repeats the system instructions, the tool definitions, and the conversation so far. Without a cache, the model processes all of it again every time, which adds delay, and you pay the standard input-token rate for it. This article shows how to mark the reusable part so Amazon Bedrock can cache it, how to keep that part unchanged, and how to check that Amazon Bedrock uses the cache.
With explicit prompt caching, which this walkthrough uses, you mark where the reusable part ends with a cache marker. Amazon Bedrock stores the start of the request up to that point, called the prefix, and can read it from the cache when a later request starts with exactly the same content. The Amazon Bedrock documentation calls the marker a cache checkpoint. For Claude models, it is a
cache_control field (Messages API and InvokeModel) or a cachePoint block (Converse API); OpenAI GPT-5.6 and later models use a different field. This article uses an orchestrator agent prompt as the example and Claude Opus 5.5 as the model.At SIXT, instrumentation in a production agent showed that the model repeatedly received the same context. Caching that context offered a direct way to reduce customer wait. The customer measurements stay in the customer story section; the earlier sections explain the general pattern.
Why the static prefix is the first place to look
A cache marker alone doesn't change what the model sees. In this walkthrough, however, I also move values that the agent's application writes into the prompt and that change every turn (in this example, the session ID, the current time, and the customer's tier) after the reusable instructions. That can change how the model interprets them, so run the same answer-quality and business-behavior tests as for any prompt change.
An orchestrator agent is this article's example, not a requirement. Caching works per model request: the orchestrator's requests share one entry for its tools and instructions, each sub-agent with its own instructions builds its own, and a request reads only an entry whose prefix matches its own exactly (see the next section). What to cache first depends on how the agents are arranged:
Type | What happens? | What to cache first |
|---|---|---|
Single-agent loop | One agent chooses each tool or action | Its instructions and tool definitions |
Router or dispatcher with handlers | The router picks one handler, which finishes the request | Each handler's reusable beginning; the router only if its prompt is large enough |
Orchestrator with sub-agents | The orchestrator plans steps, calls sub-agents or tools, and combines the results | The orchestrator's reusable beginning, then frequently used sub-agents |
Sequential pipeline | Application code chains model requests, each with its own instructions and the previous step's output as input | Each step's instructions; the step's input goes after the marker |
Retrieval-augmented generation (RAG) call | Retrieval adds different document chunks for each question | Stable instructions and tools; the chunks go after the marker, because they differ per question |
An extra request outside the main loop, for example to summarize the conversation, reads the orchestrator's entry only if it keeps the same model, tools, and system instructions and puts its own task in the messages after them. With Claude Opus 5.5, a side request with its own system prompt or without the tools must also remove the thinking blocks, the reasoning parts of earlier replies, from the history it replays (see "When the conversation grows").
How prompt caching works on Amazon Bedrock
Amazon Bedrock processes the three sections of a Claude request as one sequence, always in the order
tools , system , messages , according to the Amazon Bedrock prompt caching guide .Writing a cache entry. When a request reaches a marker and no matching entry exists, Amazon Bedrock stores the processed prefix as a cache entry, provided the prefix meets the model's minimum, and the response reports these tokens as cache writes. Because the sections form one sequence, a marker at the end of
system also covers the tools, and the minimum counts everything before the marker. The entry lasts until its time to live (TTL) runs out.Reading a cache entry. A later request reads the entry only when its prefix matches exactly (same model, tools, system instructions, and earlier messages), and the response reports those tokens as cache reads. Changing an earlier section invalidates every later one: editing a tool definition also invalidates the cached
system and messages content. Amazon Bedrock also stores an entry on the server that processed the request : a request that another server handles, for example in another region, or that arrives before an identical request has started its response, writes a new entry instead. An orchestrator that sends several requests with the same new prefix at once can therefore pay the write price several times; send one first and the rest once it has started its response.Who can read it. Cache entries are scoped to an AWS account and region and might be shared across requests within them, according to the AWS Machine Learning Blog post on Amazon Bedrock prompt caching . In my tests, one AWS Identity and Access Management (IAM) role read an entry that another role had written, and a new conversation read an earlier one's entry.
What this means for the layout of a request, in processing order, next to a typical layout like the walkthrough's first code example:
Request part | Typical layout | Layout optimized for caching |
|---|---|---|
tools | Tool definitions, sometimes assembled in a varying order | The same definitions in the same order every time, for example sorted by name |
system | Values that change per turn (in this example, session ID, current time, and customer tier), then the agent instructions | Only the reusable agent instructions and the tool playbook (guidance on when to use which tool), ending with the fixed cache marker |
messages : earlier turns | History, sometimes re-rendered or edited before each request | History stored exactly as sent, with a moving cache marker on its last block |
messages : newest turn | The user's question | The values that change per turn (in a RAG call, also the retrieved chunks), then the user's question |
In the typical layout, the session ID and the time make every request differ right after the tools, so a marker at the end of
system never finds an entry. In the optimized layout, everything before the fixed marker repeats across sessions, and everything before the moving marker repeats across the turns of one conversation.On Amazon Bedrock, Claude models support only explicit caching: a request without cache controls isn't cached. Implicit caching, which needs no marker, is available for some other models, such as Amazon Nova and OpenAI GPT models; each model card shows which kinds a model supports. This walkthrough places the markers itself, because I know where the reusable instructions end; with automatic caching, Claude can also place one for you (see "When the conversation grows").
Limits vary by model. "Min" is the smallest cumulative prefix before a cache marker, as listed in the prompt caching guide; where a model card differs, the card is authoritative. Every model listed allows up to four cache checkpoints per request:
Model | Model ID | Min | TTL |
|---|---|---|---|
Claude Opus 5.5 | anthropic.claude-opus-5-5 | 512 | 5m / 1h |
Claude Sonnet 5.5 | anthropic.claude-sonnet-5-5 | 512 | 5m / 1h |
Claude Opus 5 | anthropic.claude-opus-5 | 512 | 5m / 1h |
Claude Opus 4.8 | anthropic.claude-opus-4-8 | 1,024 | 5m / 1h |
Claude Opus 4.7 | anthropic.claude-opus-4-7 | 4,096 | 5m / 1h |
Claude Sonnet 5 | anthropic.claude-sonnet-5 | 1,024 | 5m / 1h |
On
bedrock-runtime , the Claude Opus 5.5 model card lists in-region inference only in eu-west-2 (London); elsewhere, use a geo or global inference profile ID (see "Prerequisites"). In eu-west-1 , for example, a request with the bare model ID is rejected because on-demand throughput isn't supported.In-region inference isn't automatically the better choice: it can use only one region's capacity, and under high demand Amazon Bedrock can return a transient capacity error such as HTTP 503, which the Anthropic Python SDK retries twice by default before the call fails. For persistent capacity errors, the scaling and throughput best practices recommend cross-region inference where the model supports it, which can in turn increase cache writes at times of high demand.
Key limits to remember:
- Request type: Caching works with on-demand inference, not the batch inference API.
- Mixed lifetimes: 1-hour and 5-minute markers can be combined only if every 1-hour marker comes first. Each marker closes a prefix from the start of the request, so the longer lifetime goes on the earlier part, such as the tools and system instructions. A 5-minute history marker is enough while turns arrive within five minutes; for slower replies, the guide recommends the 1-hour cache for the conversation too.
- Token quotas: On
bedrock-runtime, cache reads don't count toward the tokens-per-minute (TPM) quota, according to How tokens are counted in Amazon Bedrock . Uncached input, cache writes, and output do; Claude Opus 5.5 counts each output token as 10.
What it costs, and when it pays
Prompt caching changes only what you pay for input tokens; every request still sends the full prompt, and output costs the same. With the ratios of the Claude Opus 5.5 rates on the Amazon Bedrock pricing page at the time of writing, the reusable prefix is billed like this:
Part of a request | Without caching | With caching |
|---|---|---|
Reusable prefix, first time it is sent (cache write) | 1× | 1.25× (5-minute cache) or 2× (1-hour cache) |
Reusable prefix, each later request that finds it (cache read) | 1× | 0.05× |
Content after the marker (new question, per-turn context) | 1× | 1× |
Here, 1× is the model's standard input price. The ratios are the same for global, geo, and in-region inference; the dollar rates are the same for geo and in-region inference and lower for global inference. Ratios differ by model (the AWS Machine Learning Blog post uses 0.1× for reads), so check the pricing page for your model. The write price applies again whenever the cache is filled anew, for example after the prefix changes or the entry expires.
When it pays
The following table shows what the reusable prefix costs over several requests with Claude Opus 5.5, each arriving before the cache expires, in units of one uncached request:
Requests | Without caching | 5-minute cache | 1-hour cache |
|---|---|---|---|
1 | 1.00 | 1.25 | 2.00 |
2 | 2.00 | 1.30 | 2.05 |
3 | 3.00 | 1.35 | 2.10 |
10 | 10.00 | 1.70 | 2.45 |
A 5-minute cache is cheaper from the second request, and a 1-hour cache from the third. After ten requests, the reusable prefix costs 83% less with the 5-minute cache and 75.5% less with the 1-hour cache.
Choosing the cache lifetime
Every cache hit restarts the clock. If requests with the same prefix arrive at least every five minutes, the 5-minute cache stays filled and, as the prompt caching guide notes, keeps being refreshed at no additional charge. If the gaps are between five minutes and an hour, a 5-minute entry expires between requests, and each request pays the 1.25× write price, which is more than not caching at all; use the 1-hour cache for that traffic pattern.
What limits the savings
Latency improves only where input processing dominates. Caching shortens the processing of the reused input, and with it the time to first token (TTFT); the AWS Machine Learning Blog post reports that the gain grows with the cached prefix and becomes more pronounced above about 10,000 tokens. For the calls in this walkthrough, time the first streamed token in your client, because the Amazon CloudWatch metric
TimeToFirstToken is documented only for ConverseStream and InvokeModelWithResponseStream . Time spent on tools or on long answers stays the same, so if long answers make up most of a request's cost, the total saving is smaller than the tables suggest.Prerequisites
The rest of the article applies this to one agent request in Python. To follow along, you need the following:
- An AWS account with access to Claude Opus 5.5 on the
bedrock-runtimeendpoint; outsideeu-west-2(London), through a geo or global inference profile, such aseu.anthropic.claude-opus-5-5, which keeps data within EU regions, orglobal.anthropic.claude-opus-5-5, which routes worldwide.
- AWS credentials for an IAM identity with least-privilege permission to invoke the inference profile and the foundation model behind it: the model in each destination region of a geo profile, and for a global profile also the model's region-less Amazon Resource Name (ARN) ( Prerequisites for inference profiles , IAM policy requirements for global cross-region inference ). For the short-term Amazon Bedrock API key, the identity also needs
bedrock:CallWithBearerToken.
- Python 3.10 or later and
pip install -U anthropic aws-bedrock-token-generator.
- An agent whose request assembly you control and that records per-turn end-to-end wait and model-call latency.
The example uses the Anthropic Python SDK with the Messages API on
bedrock-runtime , which the Amazon Bedrock documentation recommends for most new applications; with the Converse API, use a cachePoint block instead of cache_control . One client covers every call:# Anthropic Python SDK, Messages API on bedrock-runtimeimport osfrom anthropic import Anthropicfrom aws_bedrock_token_generator import provide_token
REGION = os.environ["AWS_REGION"]client = Anthropic( base_url=f"https://bedrock-runtime.{REGION}.amazonaws.com/anthropic", api_key=provide_token(region=REGION), # short-term Amazon Bedrock API key)A short-term API key is valid for the shorter of 12 hours and the session of the IAM principal that generated it, and only in the region where it was generated ( How Amazon Bedrock API keys work ). The client keeps the key it was created with, so a long-running service must refresh it: call
provide_token() before each request, as the Auto-refresh short-term keys section says, and send the request through client.with_options(api_key=provide_token(region=REGION)) , which returns a copy of the client that uses the new key.Walkthrough
The walkthrough starts from a request whose reusable part changes on every call and fixes it in six steps: find what changes in the assembled request, move the changing values behind a fixed cache marker, add a moving marker for the growing conversation, verify cache reads in the response, guard the prefix with a test, and measure the effect with a control metric.
The snippets are excerpts from an agent. Names they don't define, such as
AGENT_INSTRUCTIONS , TOOL_PLAYBOOK , TOOLS , session_context() , and the test fixtures, stand for your own agent's instructions, tools, session data, and test data. With placeholder text, make the content before the first marker at least 512 tokens, the minimum for Claude Opus 5.5, or nothing is cached.The prompt assembly path
In this example, values that change on every call come before the reusable instructions, so the beginning never matches:
# BEFORE (Messages API request): volatile content sits at the front of the prefix.from datetime import datetime, timezone
def build_request(session, user_turn): system = ( f"Session: {session.id}\n" f"Current time: {datetime.now(timezone.utc).isoformat()}\n" f"Customer tier: {session.tier}\n\n" + AGENT_INSTRUCTIONS + render_tool_playbook(session) # construction order can vary by code path ) return {"system": system, "messages": session.history + [user_turn]}The timestamp changes on every call and the session ID on every conversation, and code paths that assemble the same parts in a different order break the match too. A later marker can't help, because the changing values already sit inside the part you wanted to reuse.
One marker at the stability boundary
Put the reusable instructions first and place the cache marker where they end; values that change every turn go after it:
# Messages API request body. Converse API: a cachePoint block instead of cache_control.MODEL = os.environ.get("BEDROCK_MODEL_ID", "global.anthropic.claude-opus-5-5")SYSTEM_PREFIX = [ {"type": "text", "text": AGENT_INSTRUCTIONS}, {"type": "text", "text": TOOL_PLAYBOOK, "cache_control": {"type": "ephemeral"}},]
def build_request(session, user_turn): return { "model": MODEL, "max_tokens": 4096, "tools": TOOLS, # static and sorted by name; processed before system "system": SYSTEM_PREFIX, "messages": [*session.history, {"role": "user", "content": [ {"type": "text", "text": f"<context>{session_context(session)}</context>"}, {"type": "text", "text": user_turn}, ]}], }AGENT_INSTRUCTIONS holds the agent's rules, TOOL_PLAYBOOK is system text on when to use which tool, and TOOLS holds the tool definitions (name, description, and input schema) that the request sends in its separate tools field. Because tools come first in the sequence, the marker on the last system block covers both, and the session details after it use the standard input rate.When the conversation grows
The fixed marker doesn't cover
session.history , so every earlier turn is processed again at the standard input rate on every request. A second marker that moves forward with the conversation caches the history too.Markers attach to a content block: one element of a content array, such as an entry in
system or a text, image, tool_use , or tool_result entry in a message, not a message or a fixed number of tokens (with the Converse API, cachePoint is a separate block after it). Add the moving marker to the last block of the stored history when you build each request, and keep the stored history unmarked:# Messages API: cache_control sits inside the block it closes.import copy
def with_moving_marker(history): """Copy the history and mark its last block as the end of the cached prefix.""" if not history: return [] *earlier, last = history content = last["content"] if isinstance(content, str): content = [{"type": "text", "text": content}] content = copy.deepcopy(content) content[-1]["cache_control"] = {"type": "ephemeral"} return [*earlier, {**last, "content": content}]In
build_request() , replace *session.history with *with_moving_marker(session.history) . From a marker, Amazon Bedrock looks back approximately 20 content blocks for an entry that an earlier request wrote, so each request reads the previous one's entry and writes only the blocks added since. A few rules keep this working:- Mark at request time. Markers stored in the history pile up past the four-marker limit, and the request fails with an HTTP 400 error.
- Store every turn exactly as sent, including its
<context>block: append the request's own newest message (request["messages"][-1]), not a rebuilt copy, because editing or re-rendering an earlier turn invalidates the cache from that point forward .
- Store replies as dictionaries, thinking blocks included. With adaptive thinking , a Claude Opus 5.5 reply can start with thinking blocks that stand for its reasoning; by default their
thinkingtext is empty and they carry only asignature. Store them anyway, converting the SDK's reply objects to the dictionaries thatwith_moving_marker()edits:{"role": "assistant", "content": [b.model_dump(exclude_none=True) for b in response.content]}. Each thinking block is bound to the system prompt, tools, and messages before it, so if one of them differs on replay, the request fails by default with an HTTP 400 error ( Preserved thinking ). That page's beta settingprefix_mismatch_behavior: "drop_block"drops such blocks instead, which restarts the prompt cache from the first dropped block; the page calls it a temporary fix.
- Count blocks, not turns. A tool-using turn adds several blocks (text,
tool_use,tool_result); if one turn can add close to 20, add a third marker partway through it.
Claude can also move the marker for you: with automatic caching, one top-level
cache_control field replaces the history marker, and Claude places the marker on the last cacheable block. The prompt caching guide lists it for every model in the table above, and it uses one of the four marker slots. Keep *session.history in build_request() and pass the field with the call:# Messages API: automatic caching via a top-level cache_control field.request = build_request(session, user_turn)response = client.messages.create(**request, cache_control={"type": "ephemeral"})Keep the fixed marker at the end of
system : automatic caching writes at the end of each request, and the lookback finds only entries that earlier requests wrote, so without the fixed marker a new session finds no entry for the shared instructions. It also writes the newest turn right away, which you pay for even if the conversation ends there.Verifying the hit
The response's
usage fields are the only ground truth that caching works. A request whose prefix clears the model's minimum reports cache-write tokens on a cold cache and cache-read tokens on a warm one. Below the minimum, the request still succeeds, nothing is cached, and no error is raised:# Messages API usage fields. Converse API: cacheWriteInputTokens, cacheReadInputTokens.def clears_minimum(usage): """True if the request wrote to or read from the cache.""" return bool(usage.cache_creation_input_tokens or usage.cache_read_input_tokens)If both values stay at zero, the prefix is below the minimum or the marker is missing. Repeat this billable check in a test environment whenever you change models. Where a model card lists Count tokens as supported on
bedrock-runtime , the CountTokens API estimates the prefix without charges; the Claude Opus 5.5 card lists it as not supported there.Don't read
input_tokens as the full prompt size: with caching, it counts only the tokens neither read from nor written to the cache. The prompt caching guide defines the full input as the sum of uncached, cache-write, and cache-read tokens: input_tokens , cache_creation_input_tokens , and cache_read_input_tokens in the Messages API, and inputTokens , cacheWriteInputTokens , and cacheReadInputTokens in the Converse API, which adds cacheDetails with the TTL of written tokens. Log all three for each request; the read share shows how much of the prompt the cache serves.Guarding the prefix
A fingerprint is a short checksum of the request parts that should stay unchanged: the model and the ordered
tools and system sections. It isn't Amazon Bedrock's internal cache key, but stored in your tests, it makes an accidental prompt edit visible in review:# No API call: hashes the request dict that build_request() returns.import hashlib, json
def prefix_fingerprint(request): """Application-level version of the ordered cacheable request state.""" payload = { "model": request["model"], "tools": request["tools"], "system": request["system"], } encoded = json.dumps(payload, separators=(",", ":"), ensure_ascii=False) return hashlib.sha256(encoded.encode()).hexdigest()[:16]The local unit test catches per-session drift without a network call:
# Local test, no API call.def test_prefix_is_stable_across_sessions(): a = prefix_fingerprint(build_request(FIXTURE_SESSION, "first question")) b = prefix_fingerprint(build_request(OTHER_SESSION, "different question")) assert a == b, "cacheable prefix varies per session or turn"Store the expected fingerprint in the repository so that continuous integration (CI) can flag prompt changes. A live check is diagnostic, not guaranteed: the first call may already find an entry, and eligible requests can still miss.
# Messages API, live and billable.def verify_reuse(): request = build_request(FIXTURE_SESSION, "What are your opening hours?") usages = [client.messages.create(**request).usage for _ in range(3)] assert any(clears_minimum(u) for u in usages), "no cache activity observed" assert any(u.cache_read_input_tokens > 0 for u in usages[1:]), ( "no read observed; inspect prefix, inference profile, and TTL" )Send these calls one after another, because a request sent before an identical one has started its response writes its own entry. To check the moving marker, run several turns of one session: cache reads should grow from turn to turn, while uncached input stays close to the size of the newest turn.
Measuring the effect with a control metric
The
usage fields show that Amazon Bedrock reads the prefix from the cache, not that users wait less because of it: a release that adds caching often ships other changes, and load and downstream services vary over time. A control metric separates the causes: a measurement from the same turns that caching can't affect. This walkthrough uses tool-call time, because your application runs the tools and prompt caching doesn't change how long they take. Use tools that don't call a model themselves; a sub-agent behind a tool can get faster from caching too.Start writing one record per turn before the rollout, so you have a baseline. Tag each turn with its request type, for example frequently asked question (FAQ) turns that the agent answers from its instructions, and transactions that change a booking through tools:
# Your own per-turn record, no API call.from dataclasses import dataclass
@dataclassclass TurnRecord: turn_id: str intent: str # request type, for example "faq" or "transaction" e2e_wait_ms: int # from the user's message to the final answer llm_call_ms: int # time in the turn's model calls tool_call_ms: int # control metric: time in the turn's tool calls uncached_input_tokens: int cache_write_tokens: int cache_read_tokens: int output_tokens: int prefix_fingerprint: strintent holds that request type, for example from your agent's router. The token fields add up the matching usage fields of the turn's model calls, and prefix_fingerprint comes from prefix_fingerprint() , so you can match a drop in reads to a prompt change.After the rollout, compare each request type with itself, using the median and a high percentile such as the 90th, because one overall average mixes types that gain differently: a short FAQ answer can gain more than a transaction that waits on a slow tool or writes a long answer. Read the comparison like this:
After the rollout, for one request type | What it suggests |
|---|---|
Cache reads rise, uncached input and model time fall, tool time stays about the same | Caching is the likely cause of the faster model calls |
Model time and tool time fall by a similar share | Something else made the system faster, such as lower load or another change in the same release |
Model time falls, but end-to-end wait barely changes | Tool calls or other steps outside the model take most of the turn |
Output tokens rise or fall | Longer or shorter answers explain part of the change in model time |
Cache reads stay low | Caching isn't working for these turns; see "What to watch for" |
The customer story at the end of this article applies this check to production traffic.
Run and verify
Before and during a rollout, run the checks in this order:
- The local fingerprint test and your existing answer-quality tests.
- In a test environment, sequential requests in the production shape:
clears_minimum()returnsTrue, and cache reads grow over several turns of one session.
- A rollout behind a feature flag or staged release, monitoring the share of input read from the cache, response time by request type, and the control metric.
Important: Live verification and benchmark requests bill real tokens, including the cache-write premium on a cold prefix.
What to watch for
After rollout, the
usage fields are the first place to look when caching stops paying off:Symptom | What to check |
|---|---|
Write and read tokens both stay at 0 | The prefix may be below the model's minimum, the marker may be missing, or the model or API may not support caching |
Reads drop after a deployment | Instructions, tools, or the model probably changed; a change to an earlier section invalidates later cache entries |
Uncached input grows with every turn while reads stay flat | The moving marker is missing, so the history is processed at the standard input rate on every request |
Writes cover almost the whole conversation, or reads stop growing | The prior entry may be more than approximately 20 content blocks away, or an earlier turn was edited or re-rendered (for example, a regenerated <context> block) |
Requests fail with HTTP 400 | A maximum of 4 blocks with cache_control may be provided : markers were stored in the history. An error about a thinking block's signature : an earlier turn changed before a reply with thinking blocks, or a side request replayed the history with another system prompt or other tools |
Writes rise unexpectedly, or staging works but production does not | Under high demand, cross-region inference can add writes, and identical requests started in parallel each write their own entry; entries are scoped to one AWS account and region; check request timing against the TTL |
Cleaning up
This pattern deploys no new AWS infrastructure. Stop the benchmark harness after measurement closes and remove any test-only traffic or credentials created for verification.
Customer story: SIXT's customer-service assistant
Everything above is the general pattern. The following section presents the production evidence from SIXT's rollout, and every customer figure remains in this section.

SIXT's customer-service assistant was slowing down as usage grew, and the team looked for a quick way to reduce customer wait.
Here, orchestrator means the component that stayed in control while the assistant called models and tools, then assembled the final response. It was not a one-step router that selected one handler and exited.
Rather than make a larger change first, we looked at the large, mostly static orchestrator prompt in front of every model call and cached its reusable prefix. The assistant uses models on Amazon Bedrock. We compared production behavior before and after the rollout on real customer traffic:
SIXT-reported metric | Change |
|---|---|
End-to-end customer wait, all turns | −33% |
End-to-end customer wait, FAQ turns | −39% |
Model call latency, all turns | −26% |
Model call latency, FAQ turns | −32% |
Input tokens processed without cache, FAQ turns | −89% |
Control metric (downstream tool call) | −6% |
Input-token cost vs. the same traffic uncached | −75% |
The downstream tool-call time fell only 6%, while total customer wait fell 33%. Because caching cannot speed up that tool call, the smaller change helped rule out a general system-wide speedup. The same release included other changes, so the latency results reflect the release as a whole; the token reduction and the cost effect are the direct result of caching. The token reduction applies to uncached input tokens: the full reusable beginning remained in the request, but Amazon Bedrock reported it as cache-read tokens, which are billed at a discounted rate. Cache reads are not free, and writing the cache costs a premium.
Cost. Amazon Bedrock billing confirms the effect at production scale: since the rollout, input-token charges for this prompt have been about 75% lower than the same traffic would have cost without caching. The saving per request is roughly constant, so the total saving grows with usage.
These measurements reflect one agent and traffic mix; measure your own workload with an appropriate control metric.
Conclusion
Prompt caching keeps the full context in the request but avoids processing the same beginning again. Put reusable content first, place a marker after it, move changing data later, and test answer quality. Keep a fingerprint to catch accidental edits, and confirm real behavior from the token fields.
Next, cache other frequently used agent prompts, choose the cache lifetime from request timing, and alert when reads fall or writes rise.
References
- How one prompt caching change cut our AI agent's latency by a third (SIXT's write-up of the rollout)
Any opinions in this article are those of the individual authors and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article