Files
mem0/docs/integrations/respan.mdx
T
kartik-mem0 c8b93de8e9 docs: refresh README first fold, reconcile stale benchmark numbers, unify the one-liner
README first fold:
- banner 800px -> 520px
- badges condensed from two paragraphs into one row (Trendshift kept, inline)
- lead with Introduction instead of benchmarks
- new How it works section explaining the add/search loop
- benchmarks moved below the intro and retitled from the date-stamped
  New Memory Algorithm (April 2026)
- dropped Research Highlights, which restated the benchmark table verbatim

Benchmarks: the README was already correct at 92.5 / 94.4, matching
mem0.ai/research and docs/core-concepts/memory-evaluation.mdx. The stale
copies were in the migration guides, which quote the numbers as a live
reason to upgrade. Updated both to 92.5 / 94.4 (+21 / +27).
docs/changelog/highlights.mdx keeps 91.6 / 93.4 inside its dated
2026-04-14 entry, which records what was announced at the time.

One-liner: standardized on 'the memory layer for AI agents', already the
canonical form in cli-spec.json, cli/python/pyproject.toml and the CLI
specification. Swept the remaining variants.
2026-08-13 18:06:40 +05:30

144 lines
4.2 KiB
Plaintext

---
title: Respan
description: "Combine Mem0 persistent memory with Respan observability for tracked, cost-optimized AI applications."
---
Build AI applications with persistent memory and comprehensive LLM observability by integrating Mem0 with Respan.
## Overview
Mem0 is the memory layer for AI agents, giving them persistent, personalized context across sessions. Respan (formerly Keywords AI) provides complete LLM observability.
Combining Mem0 with Respan allows you to:
1. Add persistent memory to your AI applications
2. Track interactions across sessions
3. Monitor memory usage and retrieval with Respan observability
4. Optimize token usage and reduce costs
<Note>
You can get your Mem0 API key from the <a href="https://app.mem0.ai/?utm_source=oss&utm_medium=integration-respan" rel="nofollow">Mem0 dashboard</a>.
</Note>
## Setup and Configuration
Install the necessary libraries:
```bash
pip install mem0ai openai
```
Set up your environment variables:
```python
import os
# Set your API keys
os.environ["MEM0_API_KEY"] = "your-mem0-api-key"
os.environ["RESPAN_API_KEY"] = "your-respan-api-key"
os.environ["RESPAN_BASE_URL"] = "https://api.respan.ai/api/"
```
## Basic Integration Example
Here's a simple example of using Mem0 with Respan:
```python
from mem0 import Memory
import os
# Configuration
api_key = os.getenv("MEM0_API_KEY")
respan_api_key = os.getenv("RESPAN_API_KEY")
base_url = os.getenv("RESPAN_BASE_URL") # "https://api.respan.ai/api/"
# Set up Mem0 with Respan as the LLM provider
config = {
"llm": {
"provider": "openai",
"config": {
"model": "gpt-5-mini",
"temperature": 0.0,
"api_key": respan_api_key,
"openai_base_url": base_url,
},
}
}
# Initialize Memory
memory = Memory.from_config(config)
# Add a memory
result = memory.add(
"I like to take long walks on weekends.",
user_id="alice",
metadata={"category": "hobbies"},
)
print(result)
```
## Advanced Integration with OpenAI SDK
For more advanced use cases, you can integrate Respan with Mem0 through the OpenAI SDK:
```python
from openai import OpenAI
import os
import json
# Initialize client
client = OpenAI(
api_key=os.environ.get("RESPAN_API_KEY"),
base_url=os.environ.get("RESPAN_BASE_URL"),
)
# Sample conversation messages
messages = [
{"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
{"role": "assistant", "content": "How about thriller movies? They can be quite engaging."},
{"role": "user", "content": "I'm not a big fan of thriller movies but I love sci-fi movies."},
{"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."}
]
# Add memory and generate a response
response = client.chat.completions.create(
model="openai/gpt-4.1-nano",
messages=messages,
extra_body={
"mem0_params": {
"user_id": "test_user",
"api_key": os.environ.get("MEM0_API_KEY"),
"add_memories": {
"messages": messages,
},
}
},
)
print(json.dumps(response.model_dump(), indent=4))
```
For detailed information on this integration, refer to the official [Respan Mem0 integration documentation](https://www.respan.ai/docs/integrations/mem0).
## Key Features
1. **Memory Integration**: Store and retrieve relevant information from past interactions
2. **LLM Observability**: Track memory usage and retrieval patterns with Respan
3. **Session Persistence**: Maintain context across multiple user sessions
4. **Cost Optimization**: Reduce token usage through efficient memory retrieval
## Conclusion
Integrating Mem0 with Respan provides a powerful combination for building AI applications with persistent memory and comprehensive observability. This integration enables more personalized user experiences while providing insights into your application's memory usage.
<CardGroup cols={2}>
<Card title="OpenAI Agents SDK" icon="cube" href="/integrations/openai-agents-sdk">
Build monitored agents with OpenAI SDK
</Card>
<Card title="AgentOps Integration" icon="chart-line" href="/integrations/agentops">
Monitor agent performance with AgentOps
</Card>
</CardGroup>
<Snippet file="star-on-github.mdx" />