LangChain Deep Agents Cuts LLM Costs by Up to 80% Through Prompt Caching

LangChain has added automatic prompt caching to Deep Agents, which cuts token costs by up to 80%. The framework detects the provider on its own and turns on caching, working out of the box with Anthropic, OpenAI, Google and others. The savings are largest for agents that call the model dozens of times within a single task. Repeated context is no longer paid for from scratch on every call.

AI-processed from LangChain Blog; edited by Hamidun News
LangChain Deep Agents Cuts LLM Costs by Up to 80% Through Prompt Caching
Source: LangChain Blog. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceLangChain Blog ↗
Editor-in-Chief
Key metric #1Anthropic (Claude) — caching at the level of the system prompt and tool descriptions
Key metric #2OpenAI (GPT-4o, o3) — caching of repeated input segments
Key metric #3Google (Gemini) — context caching for long documents

LangChain has added automatic prompt caching to Deep Agents. According to the company, this cuts LLM token costs by up to 80% with no extra configuration and no changes to the agent's code.

What prompt caching is and why agents need it

Prompt caching is a technique in which the model provider stores a "frozen" copy of frequently repeated parts of the context. That can be a system prompt, conversation history or a large set of uploaded documents. On the next call, the provider does not process those tokens again. It pulls them from the cache and charges substantially less for them.

For an ordinary chat application, caching yields a modest gain, since the system prompt there is usually short. For agents, the picture is fundamentally different. In the course of a single task, an agent makes dozens of sequential calls to the model. Each time, it sends the same long instruction, the history of its previous actions, and the loaded tools and documents. Without caching, all of this is processed and paid for again at every step, even if 90% of the content has not changed.

A simple example: a research agent reads 50 pages of technical documentation, then performs 30 steps of reasoning and tool calls. Each step pulls the full context back into the model. With caching, the first call is paid in full, and every subsequent one is charged only for new tokens.

How Deep Agents enables caching automatically

LangChain implemented caching so that it works without developer involvement. There is no need to dig through each provider's documentation, set special flags or rebuild the agent's architecture. The framework detects which provider is in use and activates the right mechanism.

All major players are supported:

  • Anthropic (Claude) — caching at the level of the system prompt and tool descriptions
  • OpenAI (GPT-4o, o3) — caching of repeated input segments
  • Google (Gemini) — context caching for long documents
  • Other compatible providers

This means a developer writes code once for LangChain Deep Agents, and caching works everywhere. When switching providers, nothing extra needs to be configured.

Real savings: up to 80% on tokens

The "up to 80%" figure is achievable in specific scenarios: a long repeated context plus many agent steps. The more calls to the model within a single task, and the longer the unchanging part of the prompt, the greater the savings. For teams running agents in production, this means a multiple-fold reduction in the API bill.

It is especially important for enterprise scenarios:

  • Analysis of large document corpora
  • Multi-step research pipelines
  • Agents with long-term memory and extended tool context
  • Content generators processing hundreds of requests a day

LangChain stresses that prompt caching is one of the simplest optimizations with the highest ROI in agent development. Providers also have an interest in expanding this support: less computation means cheaper infrastructure for them as well.

What this means

Agent systems become expensive at scale, and prompt caching is already one of the main ways to keep costs under control. LangChain removes the engineering barrier: developers no longer need to implement caching themselves for each provider. This lowers the entry threshold for production agent development and makes running agents economically viable even on a limited budget.

Story

Key Questions Answered

What prompt caching is and why agents need it?

Prompt caching is a technique in which the model provider stores a "frozen" copy of frequently repeated parts of the context. That can be a system prompt, conversation history or a large set of uploaded documents. On the next call, the provider does not process those tokens again. It pulls them from the cache and charges substantially less for them. For an ordinary chat application, caching yields a modest gain, since the system prompt there is usually short. For agents, the picture is fundamentally different. In the course of a single task, an agent makes dozens of sequent

How Deep Agents enables caching automatically?

LangChain implemented caching so that it works without developer involvement. There is no need to dig through each provider's documentation, set special flags or rebuild the agent's architecture. The framework detects which provider is in use and activates the right mechanism. All major players are supported: Anthropic (Claude) — caching at the level of the system prompt and tool descriptions OpenAI (GPT-4o, o3) — caching of repeated input segments Google (Gemini) — context caching for long documents Other compatible providers This means a developer writes code once for Lan

What are the key details on Real savings: up to 80% on tokens?

The "up to 80%" figure is achievable in specific scenarios: a long repeated context plus many agent steps. The more calls to the model within a single task, and the longer the unchanging part of the prompt, the greater the savings. For teams running agents in production, this means a multiple-fold reduction in the API bill. It is especially important for enterprise scenarios: Analysis of large document corpora Multi-step research pipelines Agents with long-term memory and extended tool context Content generators processing hundreds of requests a day LangChain stresses that

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
What do you think?
Loading comments…