---
title: "Introducing the MongoDB Claude SDK Session Adapter: Durable Session Storage for Agents"
description: "The Claude Agent SDK embeds Claude Code’s agent loop into applications, providing tools like web search and MCP connections without manual tool definition. It automatically persists session transcripts to the local file system, but this is unsuitable for stateless deployments like Lambda functions where each invocation is a disposable instance. The MongoDB Claude SDK Session Adapter solves this by implementing the SDK’s SessionStore interface to mirror every conversation turn to MongoDB in real time. This enables cross-environment continuity, resilience to host failures, and auditability under existing access controls, without requiring a separate system for agent memory. The adapter can be configured with a few lines of code, making agent sessions portable across any instance with access to the MongoDB cluster."
---

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

[MongoDB](https://yomu.fyi/company/mongodb) · Oct 26, 2026

**Type:** Announcement

## Summary

The Claude Agent SDK embeds Claude Code’s agent loop into applications, providing tools like web search and MCP connections without manual tool definition. It automatically persists session transcripts to the local file system, but this is unsuitable for stateless deployments like Lambda functions where each invocation is a disposable instance. The MongoDB Claude SDK Session Adapter solves this by implementing the SDK’s SessionStore interface to mirror every conversation turn to MongoDB in real time. This enables cross-environment continuity, resilience to host failures, and auditability under existing access controls, without requiring a separate system for agent memory. The adapter can be configured with a few lines of code, making agent sessions portable across any instance with access to the MongoDB cluster.

## Context

Claude Agent SDK automatically persists agent session transcripts to the local file system, which is unsuitable for stateless deployments like serverless functions or distributed systems. The MongoDB Session Adapter provides a durable, centralized session store that works across instances.

## Approach / What changed

A MongoDB adapter that implements the Claude Agent SDK’s SessionStore interface, mirroring session transcripts to MongoDB in real time. Configured by passing a MongodbSessionStore instance in ClaudeAgentOptions with a few lines of Python code (TypeScript support planned for January 2027).

## Takeaways

- The MongoDB Session Adapter implements the Claude Agent SDK’s SessionStore interface to persist agent session data in MongoDB, enabling cross-environment continuity across different instances.
- Session entries are written to MongoDB as they occur, not batched or cached locally, providing resilience to host failures or container rescheduling mid-conversation.
- Session transcripts stored in MongoDB can be retained under existing access controls, backup policies, and data retention rules, eliminating the need for a separate audit system.

## FAQ

### How do I configure the MongoDB Session Adapter?

Configure it by passing a MongoDB session store instance in ClaudeAgentOptions. The Python example shows creating a session store with a MongoDB URI and setting it in the options. That's it.

### What happens if a host crashes during a conversation?

The adapter writes each session entry to MongoDB as it occurs. If a host crashes, the session state up to the last completed step is preserved, and any instance can resume from that point.

### Is TypeScript support available?

The adapter is currently available in Python, with TypeScript support planned for January 2027.

**Tags:** [Agents](https://yomu.fyi/topic/agents), [Claude](https://yomu.fyi/topic/claude), [MongoDB](https://yomu.fyi/topic/mongodb), [Session Storage](https://yomu.fyi/topic/session-storage)

- Source: [MongoDB](https://www.mongodb.com/company/blog/product-release-announcements/introducing-claude-sdk-session-adapter-durable-session-storage-for-agents)
- Source URL: https://www.mongodb.com/company/blog/product-release-announcements/introducing-claude-sdk-session-adapter-durable-session-storage-for-agents
- Ingested by Yomu: 2026-10-27T15:00:15.201Z

[Read original post](https://www.mongodb.com/company/blog/product-release-announcements/introducing-claude-sdk-session-adapter-durable-session-storage-for-agents)
