Skip to main content

Semantic search over memories

POST 

/api/v1/llm/search-memories

Searches memories by meaning within the authenticated user's tenant scope. Results and relationships depend on the configured provider. An empty result can represent a handled provider failure and does not prove that no memories exist. Search does not provide pagination or a complete inventory.

Use an authorized backend key with X-On-Behalf-Of and users:impersonate scope, or a publishable key with a user JWT. A configured user JWT can also authenticate directly. An effective user and tenant are required; raw identity headers do not grant authority. See the memory cookbook.

The following access conditions are preserved as declared intent and are not implemented by generated code: Authorized scoped domain action.

Use this in a guide: Use remembered preferences in a returning user’s conversation

Request​

Responses​

Search results returned

Search dietary preferences​

Section ID: DOC-MA-conversations-api-searchMemories#example-memory-search-request

Request example

{
"query": "dietary preferences",
"topK": 10
}

Illustrative dietary preferences returned​

Section ID: DOC-MA-conversations-api-searchMemories#example-memory-search-response

Response example

{
"memories": [
{
"id": "mem_abc123",
"memory": "User is vegetarian and avoids gluten",
"score": 0.92,
"createdAt": "2025-02-15T10:00:00Z",
"updatedAt": "2025-02-15T10:00:00Z"
},
{
"id": "mem_def456",
"memory": "User prefers meals under 500 calories",
"score": 0.85,
"createdAt": "2025-02-20T14:30:00Z",
"updatedAt": "2025-02-20T14:30:00Z"
}
]
}

Document ID: DOC-MA-conversations-api-searchMemories. Section identities and revisions.

SectionStable reference
Semantic search over memoriesDOC-MA-conversations-api-searchMemories#overview
RequestDOC-MA-conversations-api-searchMemories#request
ResponsesDOC-MA-conversations-api-searchMemories#responses