Installation
To use Supermemory with Cartesia, install the required dependencies:Configuration
Supermemory integration is provided through theSupermemoryCartesiaAgent wrapper class:
Agent Wrapper Pattern
TheSupermemoryCartesiaAgent wraps your existing LlmAgent to add memory capabilities:
How It Works
When integrated with Cartesia Line, Supermemory provides two key functionalities:1. Memory Retrieval
When aUserTurnEnded event is detected, Supermemory retrieves relevant memories:
- Static Profile: Persistent facts about the user
- Dynamic Profile: Recent context and preferences
- Search Results: Semantically relevant past memories
2. Context Enhancement
Retrieved memories are formatted and injected into the agent’s system prompt before processing, giving the model awareness of past conversations.3. Background Storage
Conversations are automatically stored in Supermemory (non-blocking) for future retrieval.Memory Modes
Configuration Options
You can customize how memories are retrieved and used:MemoryConfig
Agent Parameters
Container Tags
Container tags allow you to organize memories across multiple dimensions:Automatic Document Grouping
The SDK automatically groups all messages from the same conversation into a single Supermemory document usingcustom_id:
- The
custom_idparameter groups all messages into the same Supermemory document - Typically you use the call ID or conversation ID from Cartesia
- All messages from that conversation are appended to the same document
- This ensures conversation continuity and proper memory generation
Example: Basic Voice Agent with Memory
Here’s a complete example of a Cartesia Line voice agent with Supermemory integration:Example: Advanced Agent with Tools
Here’s an example with custom tools and multi-tag support:Deployment
To deploy to Cartesia Line, create amain.py file in your project root:
SUPERMEMORY_API_KEY- Your Supermemory API keyANTHROPIC_API_KEY- Your Anthropic API key (or the key for your chosen LLM provider)