Smarter Prompt Caching and MCP Resilience in Claude Agent SDK v0.2.119
Anthropic has updated the Claude Agent SDK for TypeScript to optimize prompt caching efficiency and harden the connection logic for proxied MCP servers.
What Happened
- Refined
excludeDynamicSectionsLogic: The SDK now bifurcates system prompt data to maximize cache hit rates. Static auto-memory instructions remain in the cacheable system-prompt block, while high-variance data—specifically per-user memory directory paths and per-machine environment values—are shifted to the first user message. - MCP Transport Recovery: Long-running sessions now include automatic reconnection logic for claude.ai-proxied Model Context Protocol (MCP) servers. This specifically targets transport-stream aborts, allowing the agent to maintain tool access during intermittent network interruptions.
- SessionStore Reliability: The
SessionStore.append()method now features a retry mechanism. Failed batch operations are retried up to three times with a short backoff period before the batch is discarded and amirror_erroris emitted to the application. - Version & Timing: These changes were shipped in v0.2.119 on April 23, 2026.
Why This Matters for Agent Builders
For developers building production-grade agents, prompt caching is the primary lever for reducing latency and API costs. Because Claude’s prompt caching is prefix-based, even a minor change at the end of a system prompt can invalidate the entire block. The update to excludeDynamicSections ensures that your core instructions remain a stable, cacheable prefix, even as the agent moves between different user environments or file systems. This prevents "cache thrashing" where environment-specific variables would otherwise force a full, expensive re-computation of the system prompt.
The MCP reconnection logic addresses a major stability hurdle for persistent agents. In complex setups where Claude orchestrates multiple proxied tools, a temporary transport abort previously meant the agent would lose its "limbs"—its ability to call tools—until the session was manually restarted. Automating this recovery makes the SDK significantly more viable for background automation and long-running reasoning tasks.
Finally, the SessionStore retry logic is a critical addition for high-concurrency or high-throughput agents. If you are syncing agent state to a remote database or a distributed store, transient network blips or write-locks could previously cause silent data loss. The new 3-count retry policy provides a necessary safety net for maintaining a reliable audit log of agent actions.
Try It
You can update your project to the latest version using npm or yarn:
npm install @anthropic-ai/[email protected]
If you are using auto-memory features, ensure your configuration utilizes the updated excludeDynamicSections flag to take advantage of the prompt caching optimizations.
Bottom Line
Version 0.2.119 focuses on the infrastructure reliability and cost-efficiency required for shipping autonomous agents that run for hours rather than seconds. Smarter caching and self-healing tool connections are the "unsexy" but essential upgrades needed for production readiness.
Source: https://github.com/anthropics/claude-agent-sdk-typescript/releases/tag/v0.2.119 — auto-curated by ben-bot. 2026-04-26.