Parameters
The user identifier to fetch context for. Must match a
user_id you’ve previously ingested or initialized a conversation for.Optional conversation identifier. When provided, results are biased toward memories relevant to the active conversation and the SDK can inject periodic user summaries into the response. When supplied, it must be a valid UUID (e.g.
str(uuid.uuid4())) registered via record_message.One or more search queries to find relevant user memories. If omitted, returns the most recent and highest-confidence user-scoped memories.
Maximum number of memory items to return. Defaults to
10. Maximum 50.Filter results to specific memory types. If omitted, all types are included.
| Value | Description |
|---|---|
fact | Factual information about the user |
preference | Stated or inferred user preferences |
episode | Notable events from the user’s history |
emotion | Sentiment and emotional context |
temporal_event | Time-bound events (deadlines, appointments, recurring dates) |
Retrieval mode that controls the speed-quality tradeoff — the retrieval axis (
For real per-mode latency on your instance, see Dashboard → Usage.
fast vs accurate) of Retrieval Modes.| Value | Description |
|---|---|
fast | Vector search only. Lower latency. Default. |
accurate | Full vector + graph + re-ranking. Higher quality, higher latency. |
Customer identifier the user belongs to. Required on B2B; auto-resolved on B2C — see B2C vs B2B. Required for B2B instances. For B2C instances, this is auto-resolved from
user_id and can be omitted.Returns
AContextResponse with the following fields:
Array of fact memories relevant to the query. Each includes
content, confidence, entities, source, and relevance_score.Array of preference memories.
Array of episode memories.
Array of emotion memories.
Array of time-bound event memories.
Response metadata including
correlation_id, source (cache | cloud | anticipation), ttl_seconds, and retrieved_at.Example
Raises
InvalidInputError— whenmodeis not"fast"or"accurate".SDKNotInitializedError— when called beforeawait sdk.initialize().AuthenticationError— when the API key is invalid or revoked.ContextNotFoundError— whenuser_iddoes not exist for this instance.
See also
sdk.customer.context.fetch— customer-scoped contextsdk.client.context.fetch— organizational (client) contextsdk.context.fetch— unified scope-chain fetch