Skip to main content

cognee.remember()

async def remember(
    data: Union[
        BinaryIO,
        list[BinaryIO],
        str,
        list[str],
        DataItem,
        list[DataItem],
        MemoryEntry,
    ],
    dataset_name: str = "main_dataset",
    *,
    session_id: Optional[str] = None,
    chunk_size: Optional[int] = None,
    chunker: Optional[Any] = None,
    custom_prompt: Optional[str] = None,
    run_in_background: bool = False,
    self_improvement: bool = True,
    session_ids: Optional[List[str]] = None,
    **kwargs,
) -> RememberResult

Description

remember() is the main ingestion entry point in Cognee v1.0.
  • Without session_id, it stores permanent memory by running the ingestion pipeline for you.
  • With session_id, it stores session memory in the cache for fast short-term retrieval.
  • When self_improvement=True, Cognee also runs improve() to enrich the graph or bridge session content into permanent memory.
For the full behavior walkthrough, see Remember.

Parameters

data
Union[BinaryIO, list[BinaryIO], str, list[str], DataItem, list[DataItem], MemoryEntry]
required
Content to store. Supports text, file paths, URLs, file-like objects, DataItem values, lists of supported inputs, and typed session-memory entries.
dataset_name
str
default:"'main_dataset'"
Target dataset for permanent memory or for session-to-graph bridging.
session_id
Optional[str]
default:"None"
Enables session-memory mode. When set, content is written to the session cache instead of going straight into the permanent graph.
chunk_size
Optional[int]
default:"None"
Maximum chunk size for permanent ingestion. When omitted, Cognee uses its default chunking behavior.
chunker
Optional[Any]
default:"None"
Custom chunking strategy for permanent ingestion.
custom_prompt
Optional[str]
default:"None"
Overrides the prompt used during graph extraction.
run_in_background
bool
default:"False"
Starts the work asynchronously and returns a RememberResult you can await later.
self_improvement
bool
default:"True"
When enabled, runs improve() automatically after storage to enrich the graph or bridge session content.
session_ids
Optional[List[str]]
default:"None"
Session IDs to sync newly enriched graph knowledge back into during the improvement pass.

Additional keyword options

These power-user options are forwarded to the underlying ingestion and graph-building steps.
OptionTypeWhat it does
graph_modelAnyOverrides the graph schema/model used during graph building. Defaults to KnowledgeGraph; pass a DataPoint subclass to constrain extraction to your own fields and relationships. See Custom Graph Model.
node_setList[str]Tags ingested content with one or more node sets.
dataset_idUUIDTargets a specific existing dataset by UUID instead of resolving only by name.
preferred_loaderslistChooses preferred loaders for source files.
importance_weightfloatStores a retrieval-ranking weight on ingested data records.
incremental_loadingboolReuses existing dataset state and processes only new or changed content when supported.
data_per_batchintControls ingestion batching.
chunks_per_batchintControls chunk-processing batching during graph building.
configConfigOverrides the full Cognee config for the graph-building step.
temporal_cognifyboolEnables temporal-aware graph building during the internal cognify() step.
userobjectRuns the operation under a specific user context.
vector_db_configdictOverrides vector database configuration for this call.
graph_db_configdictOverrides graph database configuration for this call.
llm_configLLMConfigLLM settings to install into the current async context and forward to both the ingestion and graph-building steps. Uses the active context config or global LLM config when omitted. Import from cognee.infrastructure.llm.config.
embedding_configEmbeddingConfigEmbedding settings to install into the current async context and forward to both the ingestion and graph-building steps. Uses the active context config or global embedding config when omitted. Import from cognee.infrastructure.databases.vector.embeddings.config.

Return value

remember() returns a RememberResult. You can inspect fields like status, dataset_name, session_ids, elapsed_seconds, and raw_result, or await the result when background mode is enabled.

Examples

import cognee

# Permanent memory
result = await cognee.remember(
    "Cognee turns documents into AI memory.",
    dataset_name="docs",
)
print(result.status)

# Session memory
await cognee.remember(
    "The customer prefers weekly updates.",
    session_id="sales_chat_1",
)
See also add() and cognify() if you need direct control over the legacy pipeline steps.