Self-hosting large language models (LLMs) on GPUs is common among developers and enterprises. But it comes with a cost: reprocessing the same context on every turn. Source: aws.amazon.com.
What Happened
Amazon has released a new skill in the Agent Toolkit for AWS called the distributed KV caching agent skill.
This skill helps reduce both the cost and latency of running self-hosted LLMs by leveraging distributed key-value (KV) caching with Amazon ElastiCache.
The feature evaluates whether a cache is needed and automatically sets it up from within a coding agent. It works directly with the agent’s workflow, enabling real-time optimization without manual intervention.
How It Works
When an LLM generates a response, it stores context as key-value pairs in memory. Without caching, this context is recomputed on every new turn.
The distributed KV caching skill detects repeated context patterns and stores them in a shared cache using Amazon ElastiCache. This cache is distributed across multiple nodes, allowing high availability and performance.
When the agent receives a new request, it checks the cache first. If the context exists, it retrieves it instead of recomputing. This reduces both inference time and compute costs.
- Up to 40% reduction in inference cost.
- Up to 80% reduction in time to first token.
- Supports self-hosted LLMs running on GPUs.
Why It Matters
Cost and latency are major barriers to deploying LLMs at scale.
For developers and businesses running LLMs on-premises or in private clouds, this skill offers a practical way to improve efficiency. It reduces the need for expensive GPU compute cycles and speeds up response times.
By integrating with the Agent Toolkit, the skill becomes part of the agent’s workflow. This means developers can apply caching without rewriting code or adding new infrastructure layers.
Background and Implementation
The skill is part of the Agent Toolkit for AWS, which provides pre-built capabilities for AI agents.
It is designed to work with existing self-hosted LLMs, such as those built with Llama, Mistral, or other open-source models.

The implementation uses Amazon ElastiCache as the underlying storage. ElastiCache is a managed service that supports Redis and DynamoDB, both of which are suitable for fast key-value lookups.
The skill evaluates the current context and determines whether caching is beneficial. It then configures the cache automatically, based on the agent’s environment and data patterns.
The source code for the skill is available on GitHub: github.com/aws/agent-toolkit-for-aws/tree/main/skills/specialized-skills/database-skills/distributed-kv-caching.
Limitations and Open Questions
The feature is designed for self-hosted LLMs, not cloud-based models like those on Amazon Bedrock.
Performance gains depend on how frequently context is reused. In low-usage or highly varied conversations, the benefit may be smaller.
There is no public data on real-world performance across different model sizes or use cases. The cost and latency figures are based on theoretical modeling and benchmark tests.
Security and data privacy remain the user’s responsibility. Since the cache is stored in a shared environment, data exposure risks must be managed carefully.
What to Watch Next
Amazon is expected to expand the Agent Toolkit with more skills focused on performance optimization and cost management.
Related features include prompt caching on Amazon Bedrock, which addresses a different layer of AI efficiency.
For users already running LLMs on AWS, the Global Inference Gateway offers a way to serve models across regions with one endpoint.
As AI agents grow more complex, distributed caching will likely become a standard component of efficient AI workflows.
Sources & further reading
Featured image: original publisher image. Via original publisher. Image source

