Search...
Ctrl KAsk AI
Search...
Navigation
Integrations & Platforms
Graph Memory on Neptune
Welcome Mem0 Platform Open Source Cookbooks Integrations API Reference Release Notes
Getting Started
Essentials
- Build a Companion with Mem0
- Partition Memories by Entity
- Control Memory Ingestion
- Set Memory Expiration
- Tag and Organize Memories
- Export Stored Memories
- Choose Vector vs Graph Memory
Companion Playbooks
- Interactive Memory Demo
- Build a Node.js Companion
- Personalized AI Tutor
- Smart Travel Assistant
- Research Assistant for YouTube
- Voice-First AI Companion
- Self-Hosted AI Companion
Ops & Automations
- Memory-Powered Support Agent
- Automated Email Intelligence
- Content Creation Workflow
- Multi-Session Research Agent
- Collaborative Task Assistant
Integrations & Platforms
- Memory-Powered Agent SDK
- Memory as OpenAI Tool
- Persistent Mastra Agents
- Healthcare Coach with ADK
- Bedrock with Persistent Memory
- Graph Memory on Neptune
- Search with Personal Context
Frameworks & Multimodal
- ReAct Agents with Memory
- Multi-Agent Collaboration
- Visual Memory Retrieval
- Persistent Eliza Characters
- Browser Extension Memory
- Gemini 3 with Mem0 MCP
- MiroFish Swarm Memory
On this page
- Installation
- Environment Setup
- Configuration and Usage
- Usage
- Add a memory:
- Search a memory:
- Get all memories:
- Get a specific memory:
- Conclusion
This example demonstrates how to configure and use the mem0ai SDK with AWS Bedrock and AWS Neptune Analytics for persistent memory capabilities in Python.
Installation
Install the required dependencies to include the Amazon data stack, including boto3 and langchain-aws:
pip install "mem0ai[graph,extras]" Environment Setup
Set your AWS environment variables:
import os
# Set these in your environment or notebook
os.environ['AWS_REGION'] = 'us-west-2'
os.environ['AWS_ACCESS_KEY_ID'] = 'AK00000000000000000'
os.environ['AWS_SECRET_ACCESS_KEY'] = 'AS00000000000000000'
# Confirm they are set
print(os.environ['AWS_REGION'])
print(os.environ['AWS_ACCESS_KEY_ID'])
print(os.environ['AWS_SECRET_ACCESS_KEY']) Configuration and Usage
This sets up Mem0 with:
- AWS Bedrock for LLM
- AWS Bedrock for embeddings
- Neptune Analytics as the vector store
- Graph Memory guide.
import boto3
from mem0.memory.main import Memory
region = 'us-west-2'
neptune_analytics_endpoint = 'neptune-graph://my-graph-identifier'
config = {
"embedder": {
"provider": "aws_bedrock",
"config": {
"model": "amazon.titan-embed-text-v2:0"
}
},
"llm": {
"provider": "aws_bedrock",
"config": {
"model": "us.anthropic.claude-3-7-sonnet-20250219-v1:0",
"temperature": 0.1,
"max_tokens": 2000
}
},
"vector_store": {
"provider": "neptune",
"config": {
"collection_name": "mem0",
"endpoint": neptune_analytics_endpoint,
},
},
"graph_store": {
"provider": "neptune",
"config": {
"endpoint": neptune_analytics_endpoint,
},
},
}
# Initialize the memory system
m = Memory.from_config(config) Usage
Reference Notebook example
Add a memory:
messages = [\
{"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},\
{"role": "assistant", "content": "How about a 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."}\
]
# Store inferred memories (default behavior)
result = m.add(messages, user_id="alice", metadata={"category": "movie_recommendations"}) Search a memory:
relevant_memories = m.search(query, user_id="alice") Get all memories:
all_memories = m.get_all(user_id="alice") Get a specific memory:
memory = m.get(memory_id) Conclusion
With Mem0 and AWS services like Bedrock and Neptune Analytics, you can build intelligent AI companions that remember, adapt, and personalize their responses over time. This makes them ideal for long-term assistants, tutors, or support bots with persistent memory and natural conversation abilities.
AWS Bedrock with Mem0 \ \ Combine Neptune Analytics with AWS Bedrock for complete AWS stack.
Graph Memory Architecture \ \ Understand when to use graph vs vector memory for your use case.
Was this page helpful?
YesNo
Bedrock with Persistent Memory\ \ Previous Search with Personal Context\ \ Next
Ctrl+I
Assistant
Responses are generated using AI and may contain mistakes.
Suggestions
How do I configure graph memory?What is Neptune Analytics used for?How do I set up AWS Bedrock?
