惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Project Zero
Project Zero
P
Palo Alto Networks Blog
G
GRAHAM CLULEY
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Help Net Security
Help Net Security
S
Schneier on Security
A
Arctic Wolf
Know Your Adversary
Know Your Adversary
L
LINUX DO - 热门话题
Security Archives - TechRepublic
Security Archives - TechRepublic
L
LangChain Blog
T
The Exploit Database - CXSecurity.com
V2EX - 技术
V2EX - 技术
罗磊的独立博客
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
有赞技术团队
有赞技术团队
P
Privacy & Cybersecurity Law Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
C
Cybersecurity and Infrastructure Security Agency CISA
T
Threat Research - Cisco Blogs
C
Cyber Attacks, Cyber Crime and Cyber Security
J
Java Code Geeks
量子位
大猫的无限游戏
大猫的无限游戏
C
Check Point Blog
云风的 BLOG
云风的 BLOG
SecWiki News
SecWiki News
Hacker News: Ask HN
Hacker News: Ask HN
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Troy Hunt's Blog
U
Unit 42
N
Netflix TechBlog - Medium
阮一峰的网络日志
阮一峰的网络日志
The Register - Security
The Register - Security
Recorded Future
Recorded Future
爱范儿
爱范儿
Webroot Blog
Webroot Blog
Engineering at Meta
Engineering at Meta

LangChain Forum - Latest posts

Proposal: additional docs for implementing custom DB checkpointers or a guide on generic base checkpointer Langsmith Fleet Sandbox Failure Prompt_cache_retention: &#39;24h&#39; supported in langchain agents and where to provide it, inside invoke or while creating client? Could RAG pipelines realistically cause deployment timeouts, is Render suitable for first-time RAG deployments? How do I use langchain_postgres&#39; init_vectorstore_table correctly? Proposal: Graph-wide default error handler for StateGraph (fallback for nodes without error_handler) Support timedelta for CachePolicy.ttl, consistent with TimeoutPolicy The x402 illusion: Is advertising dead in the age of agents? Question about LangSmith Trace Search via API How to cancel a run correct !! Anyone confirms this issue that deepagent ui streaming is disturb by update in deepagent or bug issue Would pre-inference routing help long-context agent workflows? Best Stack for Building AI Applications Question about LangSmith Trace Search Seeking help regarding the connection between Websocket and tool calls Tool invocation error with empty error message when using `InjectedState` + `Command` return in async tool How to use @langchain/react FileSystem middleware Using ChatSnowflake with agents Built llmsessioncontract on AgentMiddleware: runtime enforcement of tool-call protocols — feedback wanted DeltaChannelHistory not found in langgraph-api:3.12 Improving citation accuracy and reducing hallucinations in custom Parent-Child RAG pipeline (Gemma3:4B + FAISS+BM25 + Cross-encoder reranker) Metadata filter not filtering for alerts Connecting the Slack integration fails with invalid_team_for_non_distributed_app Trouble understanding and editing experiment summary evaluators feedbacks SSL certificate error from httpx with LangGraph server WikipediaLoader endup in JSONDecodeError Human-in-the-loop approval dashboard for LangGraph agents — open source, free to deploy How are people handling data governance across agent handoffs in production? Feature Request: @task metadata Research: Friction Points in Agentic Commerce Transactions How should I provide an agent to a LangGraph server? Parallel astream() on the same compiled graph leaks messages between streams How I added claim verification to a LangChain agent in 5 minutes (with code) Interested in contributing a DynamoDB checkpointer for LangGraph.js A set of speculative ideas on treating LLM agents as interpreters with limited working memory, using externalized structures for reliable long-term project maintenance. Where should I define the name and description for subagents? Add Qdrant-backed checkpoint saver and memory store (langgraph-checkpoint-qdrant) The output content has been corrupted Incorrect `reasoning_effort` options in the UI A Minimal Receipt + Validator Pattern for Tool-Calling Agents Feature Request: Simple cryptographic provenance for who authorized what in LangGraph multi-agent graphs Using LangGraph interrupt for multi-step wizards with branching — right tool or wrong abstraction? Portable departure and admission records for LangChain agents Socratic Tools: Intelligent Agent Enhancement for LangChain Built NORNR for spend governance in agent workflows LangGraph + PostgreSQL: Chat history and summarization best practice Using SQLRecordManager multi-agent systems debugging agent-to-agent Proposal: Add save_local and load_local to USearch VectorStore (Feature Parity with FAISS) How are you handling agent security in production? (Identity, permissions, kill switch) RFC: Human delegation provenance for LangGraph multi-agent chains Build UX for Langgraph Tiny LangGraph -> Assay evidence sample from tasks v2 tool isolation between Skills: Bug: Cannot save edited prompt back to Prompt Hub after opening trace run in Playground Add faiss-node-native as async alternative vector store for FAISS Deep Agents: Clarify Multimodal (Image) Context Management and Compression Discussion about why LangGraph JS ToolNode doesn’t inject ToolRuntime.state like Python does, and what the correct workaround or intended design pattern is. xat-langchain: signed Agent-Signature headers on every tool call Help with local RAG pipeline – poor retrieval quality, wrong page numbers Building an AI networking agent (LangChain vs LangGraph vs Deep Agents)? LOGIC.md — declarative reasoning contracts that compile to LangGraph StateGraph Distinguishing internal vs final streamed chunks in Supervisor multi-agent architecture Machine-Readable Permissions for Web-Interacting Agents Are people hitting race conditions in multi-agent LangChain setups? How do ContextEditingMiddleware and SummarizationMiddleware interact when used together?Combining ContextEditingMiddleware + SummarizationMiddleware — execution order and behavior when both trigger? How we add runtime security to LangChain agents in production What does recursionLimit actually count in createAgent? (LangChain JS) LangSmith Playground returns 401 Invalid token for both /stream and /invoke across accounts How to register type in langgraph Are there any frontends for interacting with a LangGraph agent? Langchain.schema is not available while using in python code In-place model update on a compiled create_agent and per-subagent model update for deep agents - is this possible? Physical control surface for AI agents — feedback wanted Feature Request: Native Support for A2A Protocol (Remote Agents as Sub-Graphs) Feature Request: Image Input support for ChatMistralAI Multiple response formats when creating agents? Unable to parse docstring from OpenAI schema Hosting an agent server on Heroku Enable OpenTelemetry traces without sending data to LangSmith No cost displayed in LangSmith when using LiteLLM + LangGraph Course certificate I had a few months Experience with across Agent deploys remotegraph calls - old/new dist runtime architecture Runs visiblty problem AI Agent Identity Management Framework How should I deploy a self-hosted multi-agent system? Free Self-hosted LangGraph Agent Server: how to separate API and queue workers using Docker LangSmith signup stuck on activation screen New integration: langchain-w2a — LangChain tools for W2A-enabled websites Custom routes not working self-hosted standalone Trace-to-Fix: how are you actually improving RAG/agents after observability flags issues? `Failed to use model_dump to serialize <class 'langchain_core.tools.structured.StructuredTool'> to JSON: PydanticSerializationError(Unable to serialize unknown type: <class 'pydantic._internal._model_construction.ModelMetaclass'>)` `PydanticDeprecatedSince20: The `dict` method is deprecated; use `model_dump` instead. Deprecated in Pydantic V2.0 to be removed in V3.0. See Pydantic V2 Migration Guide at https://errors.pydantic.dev/2.12/migration/` BaseSandbox.write() fails if file already exists -- any way to overwrite? What does the security architecture of AI agents actually look like? Persisting HITL payloads LangMem support in JS/TS Are dynamic tool lists allowed when using create_agent? How to make an image tool?
Cache disable in Deepagent
@mdrxy Mason · 2026-04-19 · via LangChain Forum - Latest posts

hi @AmitPZepto

what I can see from the souce code is that there is no public flag on create_deep_agent to turn the prompt-cache middleware off. It is appended unconditionally to the middleware stack (deepagents/graph.py:462, :520, :591):

# graph.py (deepagents)
gp_middleware.append(AnthropicPromptCachingMiddleware(unsupported_model_behavior="ignore"))
# ...
subagent_middleware.append(AnthropicPromptCachingMiddleware(unsupported_model_behavior="ignore"))
# ...
deepagent_middleware.append(AnthropicPromptCachingMiddleware(unsupported_model_behavior="ignore"))

The good news: that middleware is a no-op for any model that is not a ChatAnthropic instance - including ChatLiteLLM. So the right fix depends on why you are seeing cache_control headers at all.


How the cache middleware actually decides to fire

AnthropicPromptCachingMiddleware._should_apply_caching gates on an isinstance check:

# langchain_anthropic/middleware/prompt_caching.py
def _should_apply_caching(self, request: ModelRequest) -> bool:
    if not isinstance(request.model, ChatAnthropic):
        msg = (
            "AnthropicPromptCachingMiddleware caching middleware only supports "
            f"Anthropic models, not instances of {type(request.model)}"
        )
        if self.unsupported_model_behavior == "raise":
            raise ValueError(msg)
        if self.unsupported_model_behavior == "warn":
            warn(msg, stacklevel=3)
        return False
    ...

Because deepagents constructs it with unsupported_model_behavior="ignore", a non-Anthropic model silently skips caching - no cache_control block, no warning, no error. A real langchain_litellm.ChatLiteLLM instance would not get cache headers added.

So if you are seeing cache headers reach the wire, one of the following is true:

  1. You are passing a model string (e.g. "anthropic:claude-haiku-4-5") to create_deep_agent. Internally resolve_model() calls init_chat_model() (deepagents/_models.py:45), which constructs a ChatAnthropic - not LiteLLM. The middleware then does fire
  2. You are pointing ChatAnthropic at a LiteLLM proxy via base_url=.... It is still a ChatAnthropic instance, so cache headers are injected; whether the proxy forwards them correctly is a separate problem
  3. A custom profile added its own cache middleware - unlikely unless you wrote one

Fix 1 - actually use

If your intent is “talk to Haiku through LiteLLM”, instantiate ChatLiteLLM yourself and pass the instance (not a string). The cache middleware will see it is not ChatAnthropic and silently skip (unsupported_model_behavior="ignore").

from langchain_litellm import ChatLiteLLM
from deepagents import create_deep_agent

llm = ChatLiteLLM(model="claude-3-5-haiku-20241022", temperature=0)

agent = create_deep_agent(
    model=llm,            # pass the instance, NOT a string like "anthropic:..."
    tools=[...],
    system_prompt="...",
)

Docs: ChatLiteLLM integration.

With this setup there are no cache_control blocks in the outbound payload at all - verify by enabling LiteLLM debug logging (litellm._turn_on_debug()). If you still see them, your model is not what you think it is; inspect type(agent.nodes[...].runnable.model) or just print the bound chat model.

Fix 2 - if you must keep ChatAnthropic but do not want caching

No public API exists today, so your options are:

(a) Subclass / replace the middleware. Build your own no-op class and ship it; you still cannot remove the deepagents-appended one, but you can post-process the request in your own middleware that runs inside it:

from langchain.agents.middleware.types import AgentMiddleware

class StripCacheControl(AgentMiddleware):
    def wrap_model_call(self, request, handler):
        # Remove cache_control that the Anthropic middleware just injected
        ms = dict(request.model_settings or {})
        ms.pop("cache_control", None)
        request = request.override(model_settings=ms)
        # also strip from system + tools if you need to be thorough
        return handler(request)

the AnthropicPromptCachingMiddleware is appended after user middleware= in graph.py:580-591, so your middleware wraps it from the outside. In the LangChain agents middleware model, wrap_model_call composes like an onion: the last-appended middleware runs closest to the model, which means your middleware runs after the cache middleware on the response but before it on the request - so stripping on the way in will be re-added by the Anthropic middleware on its way down. The practical way to kill it is a monkey-patch:

Apply this once at import time, before calling create_deep_agent. Ugly, but it is the only reliable switch today.

(b) Open a feature request. A disable_prompt_cache: bool = False kwarg on create_deep_agent (or better, letting the caller fully replace the tail middleware) is a reasonable ask - track or file it at https://github.com/langchain-ai/deepagents/issues.


Worth sanity-checking the premise. Per Anthropic’s prompt-caching docs, Claude 3 Haiku, Claude 3.5 Haiku and Claude Haiku 4.5 all support prompt caching (2,048-token minimum for the Haiku family). If your LiteLLM call is failing with a cache-related error, the likely culprit is not the model - it is that:

  • your LiteLLM version does not forward cache_control blocks on the Anthropic path, or
  • LiteLLM is routing to a backend that does not (e.g. Bedrock Claude Haiku, where caching support/headers differ), or
  • the request is below the 2,048-token minimum (this should be a silent no-cache, not an error - if it errors, the proxy is rejecting the block).

If you share the actual error message from LiteLLM, the root cause is usually identifiable without disabling caching at all. But if you just want it gone: use Fix 1.

Sources