> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Mongodb Memory Adapter • AI Agent SDK

> create_mongodb_memory_adapter: Factory function to create MongoDB memory adapter.

# create\_mongodb\_memory\_adapter

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**factories**](../modules/factories) module.

Factory function to create MongoDB memory adapter.

Lazy imports pymongo and creates an adapter that implements MemoryProtocol
using MongoDB as the document store backend.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def create_mongodb_memory_adapter() -> MemoryProtocol
```

### Returns

<ResponseField name="Returns" type="MemoryProtocol">
  MemoryProtocol adapter instance
</ResponseField>

### Exceptions

<AccordionGroup>
  <Accordion title="ImportError">
    If pymongo is not installed
  </Accordion>
</AccordionGroup>

## Uses

* `ImportError`
* `MongoDBMemoryAdapter`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/memory/adapters/factories.py#L107">
  `praisonaiagents/memory/adapters/factories.py` at line 107
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Memory Concept" icon="brain" href="/docs/docs/concepts/memory" />

  <Card title="Memory Overview" icon="database" href="/docs/docs/memory/overview" />

  <Card title="Memory Configuration" icon="gear" href="/docs/docs/configuration/memory-config" />

  <Card title="Session Resume" icon="rotate-right" href="/docs/docs/memory/session-resume" />
</CardGroup>
