Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cognee.ai/llms.txt

Use this file to discover all available pages before exploring further.

cognee.recall()

async def recall(
    query_text: str,
    query_type: SearchType | None = None,
    *,
    datasets: list[str] | None = None,
    top_k: int = 10,
    auto_route: bool = True,
    scope: str | list[str] | None = None,
    **kwargs,
) -> list[RecallResponse]

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 RecallResponse items sourced from graph retrieval, session retrieval, or both depending on the request.
For the full behavior walkthrough, see Recall and Search Basics.

Parameters

query_text
str
required
Natural-language query to run against memory.
query_type
SearchType | None
default:"None"
Forces a specific retrieval strategy instead of using auto-routing.
datasets
list[str] | None
default:"None"
Restricts graph retrieval to the named datasets.
top_k
int
default:"10"
Maximum number of results to return.
auto_route
bool
default:"True"
When True, Cognee chooses a retrieval strategy automatically if query_type is not set.
scope
str | list[str] | None
default:"None"
Controls whether retrieval uses session, graph, or the default automatic combination logic.

Additional keyword options

OptionTypeWhat it does
dataset_idslist[UUID]Restricts graph retrieval by dataset UUIDs instead of names.
system_promptstrOverrides the system prompt used for completion-style answers.
system_prompt_pathstrLoads the system prompt from a file path.
node_namelist[str]Restricts retrieval to matching node names or node sets.
node_name_filter_operatorstrControls how node_name filters are combined.
only_contextboolReturns retrieved context without generating the final LLM answer.
session_idstrEnables session-aware retrieval and session-cache lookup.
wide_search_top_kintExpands the candidate set used before final ranking in graph retrieval.
triplet_distance_penaltyfloatAdjusts ranking for triplet-based retrieval paths.
feedback_influencefloatApplies stored feedback weights during ranking where supported.
verboseboolReturns additional retrieval details from lower-level search flows.
retriever_specific_configdictPasses advanced configuration directly to the selected retriever.
userobjectRuns retrieval under a specific user context.

Return value

recall() returns a list of RecallResponse items. Depending on the request, results may come from session memory, permanent graph retrieval, or both.

Examples

import cognee

results = await cognee.recall(
    "What does Cognee do?",
    datasets=["docs"],
    top_k=5,
)

for result in results:
    print(result)
See also SearchType and search() when you need lower-level retrieval control.