Skip to main content
Supermemory integrates with Cartesia, providing long-term memory capabilities for voice AI agents. Your Cartesia applications will remember past conversations and provide personalized responses based on user history.

Installation

To use Supermemory with Cartesia, install the required dependencies:
Set up your API key as an environment variable:
You can obtain an API key from console.supermemory.ai.

Configuration

Supermemory integration is provided through the SupermemoryCartesiaAgent wrapper class:

Agent Wrapper Pattern

The SupermemoryCartesiaAgent 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 a UserTurnEnded 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:
Memories are stored with all tags:

Automatic Document Grouping

The SDK automatically groups all messages from the same conversation into a single Supermemory document using custom_id:
How it works:
  • The custom_id parameter 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 a main.py file in your project root:
Then deploy with:
Make sure to set these environment variables in your Cartesia deployment:
  • SUPERMEMORY_API_KEY - Your Supermemory API key
  • ANTHROPIC_API_KEY - Your Anthropic API key (or the key for your chosen LLM provider)