Store and retrieve long-term knowledge with semantic search
| Aspect | State | Memory |
|---|---|---|
| Scope | Single session | Cross-session |
| Lifecycle | Ephemeral (TTL) | Permanent |
| Structure | Nested JSON | Flat text + embeddings |
| Access | Direct read | Semantic search |
| Use Case | Working memory | Long-term knowledge |
POST /v1/memory
Stores a new memory with optional vector embedding for semantic search.
| Field | Type | Required | Description |
|---|---|---|---|
session_id | string | ✅ Yes | Session to associate memory with |
content | string | ✅ Yes | Memory text (max 10,000 chars) |
type | string | No | Memory classification: "fact", "preference", "event", "policy" (default: "general") |
tags | array | No | Tags for categorization (e.g., ["travel", "preferences"]) |
metadata | object | No | Custom metadata |
embed | boolean | No | Generate vector embedding (default: true) |
| Field | Type | Description |
|---|---|---|
id | string | Unique memory ID (format: mem_<12_chars>) |
session_id | string | Associated session |
content | string | Memory text |
type | string | Memory type |
tags | array | Tags |
metadata | object | Custom metadata |
created_at | string | ISO 8601 timestamp |
embedding_id | string | Vector DB ID (if embedded) |
vector_available | boolean | Whether semantic search is enabled |
POST /v1/memory/search
Performs semantic similarity search across all memories. Returns the most relevant memories based on vector similarity.
| Field | Type | Required | Description |
|---|---|---|---|
query | string | ✅ Yes | Search query (will be embedded and compared) |
session_id | string | No | Filter to specific session’s memories |
user_id | string | No | Filter to specific user’s memories |
type | string | No | Filter by memory type |
tags | array | No | Filter by tags (returns memories with ANY of these tags) |
limit | integer | No | Max results to return (default: 10, max: 50) |
threshold | float | No | Minimum similarity score (0.0-1.0, default: 0.7) |
| Field | Type | Description |
|---|---|---|
data | array | Array of memory results |
query | string | Original search query |
| Field | Type | Description |
|---|---|---|
id | string | Memory ID |
session_id | string | Associated session |
content | string | Memory text |
type | string | Memory type |
tags | array | Tags |
score | float | Similarity score (0.0-1.0, higher = more relevant) |
created_at | string | When memory was created |
GET /v1/memory/{memory_id}
Retrieves a specific memory by ID.
| Parameter | Type | Required | Description |
|---|---|---|---|
memory_id | string | ✅ Yes | Memory ID |
PATCH /v1/memory/{memory_id}
Updates an existing memory. If content is changed, a new embedding is generated.
| Parameter | Type | Required | Description |
|---|---|---|---|
memory_id | string | ✅ Yes | Memory ID to update |
| Field | Type | Required | Description |
|---|---|---|---|
content | string | No | New memory text |
type | string | No | New memory type |
tags | array | No | New tags (replaces existing) |
metadata | object | No | New metadata (merges with existing) |
DELETE /v1/memory/{memory_id}
Permanently deletes a memory and its vector embedding.
| Parameter | Type | Required | Description |
|---|---|---|---|
memory_id | string | ✅ Yes | Memory ID to delete |
GET /v1/memory
Lists all memories with optional filtering.
| Parameter | Type | Required | Description |
|---|---|---|---|
session_id | string | No | Filter by session |
user_id | string | No | Filter by user |
type | string | No | Filter by type |
tags | string | No | Comma-separated tags to filter by |
limit | integer | No | Max results (default: 20, max: 100) |
starting_after | string | No | Memory ID for pagination |
| Type | Description | Example |
|---|---|---|
fact | Objective information | "User's company is Acme Corp" |
preference | User preferences | "User prefers dark mode" |
event | Historical events | "User completed onboarding on 2026-01-15" |
policy | Rules and policies | "Always ask for confirmation before deleting data" |
observation | Behavioral insights | "User tends to ask follow-up questions" |
general | Uncategorized | Any other memory |
text-embedding-004)text-embedding-3-small)| Status Code | Error Code | Description |
|---|---|---|
| 400 | invalid_request | Missing or invalid fields |
| 404 | memory_not_found | Memory doesn’t exist |
| 404 | session_not_found | Session doesn’t exist |
| 413 | content_too_large | Content exceeds 10,000 chars |
| 429 | rate_limit_exceeded | Too many requests |