Struggling to integrate memory to my Elevenlabs conversational AI widget #3252
Replies: 2 comments 1 reply
|
I am seeking an answer to the same need. I need an Elevenlabs AI Agent that can use Mem0 for add and retrieve memories to simulate a "long-term memory" for each individual user. I've created the "addMemories" and "retrieveMemories" Tools. But, it's not clear to me how to connect to Mem0 and, once connected, how I might view or edit the Table of added Memories and where it's stored in Mem0. Any insight into how I can create this long-term memory for my Elevenlabs AI Agent would be greatly appreciated. |
|
The core challenge with ElevenLabs widgets is that they’re designed as a closed conversational loop — the widget manages the call lifecycle internally, which makes it difficult to inject a memory retrieval step before each turn or a memory storage step after each turn. For deeper Mem0 integration, you need a setup where you control the webhook/event loop, not the widget. Here’s an architecture that works cleanly: Option A: VoIPBin (open-source CPaaS) + Mem0 VoIPBin handles the voice transport (SIP/RTP, STT, TTS) and fires webhooks to your backend on every transcription event. This gives you full control to inject Mem0 memory between turns: from mem0 import MemoryClient
import httpx
mem0_client = MemoryClient(api_key="...")
VOIPBIN_KEY = "your_voipbin_key"
@app.post("/voipbin/webhook")
async def handle_turn(event: dict):
if event["type"] != "call.transcription":
return
user_id = event["call_id"] # or mapped to a real user
user_text = event["text"]
# 1. Store what the user just said
mem0_client.add(user_text, user_id=user_id)
# 2. Retrieve relevant memory for context
memories = mem0_client.search(query=user_text, user_id=user_id, limit=5)
context = "\n".join([m["memory"] for m in memories])
# 3. Build response with memory context
response = my_llm.chat(
system=f"You are a helpful assistant. User history:\n{context}",
message=user_text
)
# 4. Speak the response back
httpx.post(
f"https://api.voipbin.net/v1.0/calls/{event[call_id]}/actions?accesskey={VOIPBIN_KEY}",
json={"type": "talk", "text": response}
)With this pattern, Why it’s easier than ElevenLabs widget:
Option B: Stay with ElevenLabs If you want to keep the ElevenLabs widget, the key is to use their Client Tools (formerly Quick Tools) — these let the agent call an external webhook when it decides to remember something. The limitation is that retrieval happens only when the agent explicitly chooses to call the tool, not automatically on every turn. This is why
Hope that helps! The VoIPBin route gives more deterministic control; the ElevenLabs route is easier to start with if you get the prompting right. |
Uh oh!
There was an error while loading. Please reload this page.
Hey everyone,
I’m working on a voice-based assistant using the ElevenLabs widget inside Replit, and I’m trying to get it talking to Mem0 so it can remember things users say. The voice part works fine, but the memory doesn’t seem to be sticking.
I’ve set up the Mem0 API key and followed the docs, but I’m not confident the memory is being stored or retrieved at all. It doesn’t seem to react when I try saying things like “My cat’s name is Pepper” and then follow up with a question about it.
I’m also unsure if the ElevenLabs quick tools are set up properly, or how they’re actually connected to Mem0 behind the scenes. It’s hard to tell if something’s broken or just misconfigured.
Would really appreciate any advice from someone who’s got this working, or any tips on how to properly test if Mem0 is active and linked to the voice agent. Happy to share more details if needed.
Thanks
Dan
All reactions