cognee.recall()
Description
recall() is the main retrieval entry point in Cognee v1.0.
- It auto-routes queries by default when you do not specify
query_type. - It can search the permanent graph, session memory, or both.
- It returns
RecallResponseitems sourced from graph retrieval, session retrieval, or both depending on the request.
Parameters
Natural-language query to run against memory.
Forces a specific retrieval strategy instead of using auto-routing.
Restricts graph retrieval to the named datasets. Dataset names are resolved only against datasets owned by the current user.
Restricts graph retrieval by dataset UUIDs instead of names. Use this for shared datasets that the current user can access but did not create. When provided, this takes precedence over
datasets and the name-to-UUID lookup is skipped.Maximum number of results to return.
When
True, Cognee chooses a retrieval strategy automatically if query_type is not set.Controls whether retrieval uses
session, graph, or the default automatic combination logic.Additional keyword options
| Option | Type | What it does |
|---|---|---|
system_prompt | str | Overrides the system prompt used for completion-style answers. |
system_prompt_path | str | Loads the system prompt from a file path. |
node_name | list[str] | Restricts retrieval to matching node names or node sets. |
node_name_filter_operator | str | Controls how node_name filters are combined. |
only_context | bool | Returns retrieved context without generating the final LLM answer. |
session_id | str | Enables session-aware retrieval and session-cache lookup. |
wide_search_top_k | int | Expands the candidate set used before final ranking in graph retrieval. |
triplet_distance_penalty | float | Adjusts ranking for triplet-based retrieval paths. |
feedback_influence | float | Applies stored feedback weights during ranking where supported. |
verbose | bool | Returns additional retrieval details from lower-level search flows. |
retriever_specific_config | dict | Passes advanced configuration directly to the selected retriever. |
include_references | bool | Default True. Appends a deterministic Evidence: block to completion-style answers, assembled in-process (no extra LLM call) from the retrieved chunks or graph context. The response schema is unchanged and the block is omitted silently when no usable references exist. Set to False to restore the exact prior answer text. |
user | object | Runs retrieval under a specific user context. |
llm_config | LLMConfig | LLM settings to install into the current async context for this retrieval operation. Uses the active context config or global LLM config when omitted. Import from cognee.infrastructure.llm.config. |
embedding_config | EmbeddingConfig | Embedding settings to install into the current async context for this retrieval operation. Uses the active context config or global embedding config when omitted. Import from cognee.infrastructure.databases.vector.embeddings.config. |
Return value
recall() returns a list of RecallResponse items. Depending on the request, results may come from session memory, permanent graph retrieval, or both.
These items are Pydantic objects, not plain dictionaries — read fields with attribute access (result.text), not result.get("text") or result["text"]. Calling .get() on a result raises AttributeError: 'ResponseGraphEntry' object has no attribute 'get'.
The concrete type of each item is set by its source field (import from cognee.modules.recall.types.RecallResponse):
source | Type | Key attributes |
|---|---|---|
"graph" | ResponseGraphEntry | text (renderable answer, context, chunk text, or structured output), kind, search_type, score, dataset_id, dataset_name, metadata, raw (normalized payload for this item), structured |
"session" | ResponseQAEntry | time, qa_id, question, context, answer, feedback_text, feedback_score |
"trace" | ResponseAgentTraceEntry | session agent-trace fields |
"graph_context" | ResponseGraphContextEntry | content |
The
text_result, context_result, and objects_result keys come from the legacy search(verbose=True) API, which returns plain dicts. recall() does not produce those keys. For a graph-backed recall item, result.text is the display-ready value. result.raw preserves the normalized payload for that item; for completion-style searches, it is not the same thing as objects_result.