withSupermemorywrapper - Automatic memory injection into system prompts (zero-config)- Function calling tools - Explicit tool calls for search/add memory operations
Migrating to v2 from 1.4.x? Check the migration guide.
Supermemory tools on npm
Check out the NPM page for more details
Supermemory AI SDK
Check out the PyPI page for more details
withSupermemory Wrapper
The simplest way to add memory to your OpenAI client. Wraps your client to automatically inject relevant memories into system prompts.Installation
Quick Start
Configuration Options
Modes Explained
| Mode | Description | Use Case |
|---|---|---|
profile | Injects user profile (static + dynamic facts) | General personalization |
query | Searches memories based on user message | Question answering |
full | Both profile and query-based search | Best for chatbots |
Works with Responses API Too
Environment Variables
Function Calling Tools
For explicit control over memory operations, use function calling tools. The model decides when to search or add memories.Installation
Quick Start
Configuration
Memory Tools Configuration
Available Tools
Search Memories
Search through user memories using semantic search:Add Memory
Store new information in memory:Individual Tools
Use tools separately for more granular control:Complete Chat Example
Here’s a complete example showing a multi-turn conversation with memory:Error Handling
Handle errors gracefully in your applications:API Reference
Python SDK
SupermemoryTools
Constructor
get_tool_definitions()- Get OpenAI function definitionssearch_memories(information_to_get, limit, include_full_docs)- Search user memoriesadd_memory(memory)- Add new memoryexecute_tool_call(tool_call)- Execute individual tool call
execute_memory_tool_calls
JavaScript SDK
supermemoryTools
createToolCallExecutor
Environment Variables
Set these environment variables:Development
Python Setup
JavaScript Setup
Next Steps
AI SDK Integration
Use with Vercel AI SDK for streamlined development
Memory API
Direct API access for advanced memory management