Memory API
The Memory API provides long-term semantic memory for AI agents, enabling context persistence across sessions and significant token cost reduction.Key Benefits
- 90%+ Token Savings: Store and retrieve relevant context instead of resending full conversation history
- Semantic Search: Find relevant memories based on meaning, not just keywords
- Session Isolation: Keep memories organized by agent and session
- GDPR Compliant: Full support for data deletion and export
Endpoints
Store Memory
Store a memory entry for an AI agent.Retrieve Memories
Retrieve relevant memories using semantic search.Clear Memory
Clear memories for an agent or session.Get Stats
Get memory statistics for your project.SDK Usage
- Python
- Node.js
Best Practices
- Use descriptive agent IDs: Make them meaningful for debugging
- Set appropriate importance scores: Higher importance = longer retention
- Clear sessions when done: Helps manage storage and privacy
- Combine with context injection: Use
formattedContextdirectly in prompts