> ## 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.

# Safe Mem0 Search • AI Agent SDK

> safe_mem0_search: Defensive wrapper for mem0.search() to handle MongoDB vector store compatibility.

# safe\_mem0\_search

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

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

Defensive wrapper for mem0.search() to handle MongoDB vector store compatibility.

Catches the specific TypeError about an unexpected 'vectors' kwarg and falls back
gracefully by returning an empty result set. This addresses the upstream mem0 bug:
[https://github.com/mem0ai/mem0/issues/3185](https://github.com/mem0ai/mem0/issues/3185)

Any other TypeError is re-raised unchanged.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def safe_mem0_search(mem0_client: Any) -> List[Dict[str, Any]]
```

## Parameters

<ParamField query="mem0_client" type="Any" required={true}>
  No description available.
</ParamField>

### Returns

<ResponseField name="Returns" type="List[Dict[str, Any]]">
  The result of the operation.
</ResponseField>

## Uses

* `mem0_client.search`
* `logger.warning`

## Used By

* [`Mem0MemoryAdapter.search_long_term`](../functions/Mem0MemoryAdapter-search_long_term)

## Source

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