AnnouncementBuilt for unpredictable AI demand: Atlas Infinite and MongoDB 9.0 are here. Read more >  >>
AnnouncementMeet the intelligent data platform built for the AI era. Read more > >>
NewNow in public preview: Atlas Agent Engine, the secure way to run AI agents at scale. Read more > >>

Introducing the MongoDB Claude SDK Session Adapter: Durable Session Storage for Agents

October 27, 2026 ・ 4 min read

The Claude Agent SDK is a package that lets you embed Claude Code's own agent loop directly into your application: web search, file search, file editing, MCP server connections, and more, all without having to define those tools or manage the agent loop yourself. The SDK also automatically persists session transcripts to the local file system by default. Claude calls it the Agent SessionStore.

Today, we are excited to announce the MongoDB Claude SDK Session Adapter, available in Python (with TypeScript coming in January 2027).

What is the Claude Agent SessionStore?

But first, let's understand what a SessionStore actually is. It is the extension point in the Claude Agent SDK for saving an agent's session outside the machine where it ran. Configure one, and the SDK mirrors every conversation turn and action as the agent works, so the session can pick back up exactly where it left off, on any instance that has access to that store.

That matters most once an agent stops running on a single, persistent machine. Say a team deploys their Claude agent as a Lambda function, callable as an internal service by teams across the company. Every invocation is a disposable instance; there's no local disk to store anything between calls. Without a SessionStore, each request is stateless by default; the agent has no memory of what came before. With a configured SessionStore, any invocation can pick up a session's full history, regardless of which instance handled the last turn.

That is the gap the MongoDB Session Adapter closes.

This is especially useful for enterprises that have multiple teams developing agents across many machines, who need session storage that survives host failures, scales as the agent fleet increases, and enforces the same access controls and retention rules as the rest of their data estate, not a bolt-on system built solely for agent memory.

The MongoDB Claude SDK Session Adapter

The MongoDB Claude SDK Session Adapter gives Claude agents durable session storage: a record of the conversation and its action history that lets an agent pick back up exactly where it left off, whether that's on the same laptop, a different server, or any server in a distributed deployment.

The adapter helps cover three crucial areas:

  • Cross-environment continuity: Whether a different backend instance picks up a conversation after a restart or a user resumes on a different device, session state doesn't live on the machine that started it. Because every step is mirrored to MongoDB as it happens, any instance in your deployment can resume exactly where the last one left off.

  • Resilience to failure: If a host crashes or a container gets rescheduled mid-conversation, nothing is lost. Entries are written to MongoDB as they occur, not batched or cached locally, so whichever instance picks the session back up sees the same state as the failed one, up to the last completed step.

  • Retention and auditability: Many teams need to retain agent transcripts to meet internal data-retention or audit requirements. Instead of standing up a separate system just for that, session data lives in the MongoDB cluster you're already operating, under the same access controls and backup policies as the rest of your data.

How it works

This adapter implements the Claude Agent SDK's session storage interface directly, so you can mirror session transcripts to MongoDB in a few lines in ClaudeAgentOptions:

Python

That's it. Every session started with these options is stored in MongoDB and can be resumed across machines. Each agent writes locally; MongoDB makes the conversation portable between app instances.

Figure 1. How the adapter allows you to access agent session transcripts mirrored in MongoDB.

I've added alt text to the Figure 1 image describing the architecture diagram of the MongoDB Claude SDK Session Adapter and how session transcripts are mirrored between application instances via MongoDB.

Get started today!

Simply run the following command to start with session storage for your Claude agents:

Shell

Check out the documentation to explore the source, open issues, and contribute. We'd love to hear what you build!

Additional resources:

MongoDB Resources