Skip to main content
Context Retrieval (POST /api/v2/memory/context) hands retrieval to an LLM. The model gets your question and a set of retrieval tools, decides which ones to call, reads what comes back, works out what is still missing, and writes new queries to find it. When it judges the evidence sufficient, it stops, and EverOS returns the memories it found. It is built for questions a single search answers poorly: multi-hop questions, questions about time and order, and questions whose answer is spread across several conversations.
Context Retrieval is Cloud-only and returns memories, not an answer. The model writes an answer to end its loop, and that answer is discarded. You pass the returned memories to your own LLM, exactly as you would with search results.

How Context Retrieval Works

Each round, the model:
  1. Assesses the evidence it has so far and what the question still needs
  2. Calls tools, often several at once, with queries it writes itself
  3. Reads what came back and decides whether to search again or stop
The tools it can call: Every tool runs inside the scope of your request. The owner, app_id, project_id and filters are applied by the server to every search, and nothing the model writes can widen them.

Choosing a Retrieval Method

Start with hybrid. Move a question to Context Retrieval when the answer depends on connecting facts from different places, for example:

Basic Usage

The request takes the core search fields: user_id, query, top_k, include_profile and filters work as they do on /api/v2/memory/search. If you are reusing a search request, remove method and min_score, which are rejected with 422 here. Give the request a timeout of at least 60 seconds.

Reading the Response

The response has the same SearchData shape as search, so code that reads search results reads these too. Three things differ:
  • episodes[].cited is true for the memories the model named as the ones its answer rests on. On /search it is always false.
  • episodes[].score is a rank-fusion score, not a similarity. It reflects how consistently a memory came up across the loop’s searches, roughly 0.01 to 0.05, plus 1.0 for a cited memory, so cited memories always come first. Do not compare it with search scores.
  • Only user owners get episodes. With agent_id, episodes, agent_cases and agent_skills are all empty.
profiles (with include_profile) and unprocessed_messages (with a top-level session_id filter) are filled exactly as on search.

Limits and Behavior

The full list of request fields, including the search fields this endpoint ignores, is in the API reference.

Best Practices

The model searches until it can answer query, so give it the question you actually want answered, not a few keywords:
When you need a compact context, pass only the cited memories to your LLM and fall back to the top-ranked ones if nothing was cited:
The server stops the loop at 45 seconds and returns what it has. Set your client timeout to at least 60 seconds, and fall back to hybrid search on a timeout or network error:
filters works as on search and applies to every tool call in the loop. Narrowing to a time range or a set of sessions keeps the model from spending rounds on memories you already know are irrelevant.
Use hybrid search for real-time chat turns. Reserve Context Retrieval for questions where getting the full picture matters more than speed: research, preparation, and questions the user expects to take a moment.

Next Steps

Context Retrieval API

Full request and response reference

Agentic Retrieval

Up-front query decomposition on the search endpoint