Anthropic enables distributed agent memory with Claude Agent SDK session adapters

Agentic Coding
Claude Code
AI Agent

Anthropic enables distributed agent memory with Claude Agent SDK session adapters
Anthropic released session store adapters for the Claude Agent SDK, the framework for building agentic applications powered by Claude. By default, the SDK stores session transcripts as local files. The new SessionStore interface allows mirroring these transcripts to external backends like Amazon S3, Redis, and PostgreSQL.

This update builds on the capability for production-grade parallel agentic sessions. Local storage is insufficient for serverless functions or workers that lack a shared filesystem. By standardizing mirroring, developers can extend the session mobility seen in the desktop app to their own custom deployments, ensuring durability when containers are ephemeral.

You can implement the append and load methods to connect the SDK to your infrastructure for compliance and multi-host deployments. Reference implementations are available in TypeScript and Python. The SDK uses a dual-write architecture that prioritizes local durability while asynchronously forwarding transcript batches to your external store.

Read the full update →

Frequently asked questions

What is a SessionStore adapter in the Claude Agent SDK?
A SessionStore adapter is an interface that allows the Claude Agent SDK to mirror session transcripts to external backends instead of just the local filesystem. By implementing required methods like append and load, developers can persist agent conversation history and reasoning steps to databases, ensuring that session data is durable and accessible across different environments.
How does session mirroring work in the Claude Agent SDK?
The SDK uses a dual-write architecture where the Claude Code subprocess always writes to the local disk first. The SDK then forwards these transcript entries in batches to the external store via the append method. This best-effort approach ensures that a temporary outage of the external database does not interrupt the agent or cause local data loss.
Which databases are supported by the Claude Agent SDK session store?
Anthropic provides runnable reference implementations for Amazon S3, Redis, and PostgreSQL. These examples are available in both TypeScript and Python. While these specific adapters are provided as starting points, developers can write their own custom adapters for any backend by implementing the standard SessionStore interface provided within the SDK.
Why should I use an external session store for Claude agents?
External storage is essential for multi-host deployments like serverless functions, autoscaled workers, or CI runners that do not share a filesystem. It allows a session created on one host to be resumed on another. It also provides better durability for ephemeral containers and helps meet corporate compliance and audit requirements for transcript retention.
Does the Claude Agent SDK support subagent transcripts in external storage?
Yes, the SDK can mirror subagent transcripts to external storage using a specific subpath key. To fully support subagent resume and discovery, the custom adapter must implement the optional listSubkeys method. Without this method, the SDK will only be able to restore the main conversation transcript when resuming a session from the external store.