remember() to build temporal memory in one step, then recall() for time-aware queries.
Before you start:
- Complete Quickstart to understand basic operations
- Ensure you have LLM Providers configured
- Have data that contains dates or times
What Temporal Mode Does
- Builds events and timestamps from your text during ingestion
- Lets you ask time-based questions like “before 1980”, “after 2010”, or “between 2000 and 2006”
- Uses
SearchType.TEMPORALto retrieve the most relevant events and answer with temporal context
Step 1: Remember Data with Temporal Mode
Remember data with temporal information by enablingtemporal_cognify=True.
This simple example uses one string that gets treated as a single document. In practice, you can add multiple documents, files, or entire datasets. The temporal processing works the same way across all your data.
Step 2: Ask Time-aware Questions
UseSearchType.TEMPORAL with cognee.recall(...) to retrieve the relevant events.
remember(..., temporal_cognify=True) builds the event-and-timestamp graph for the dataset during ingestion, so there is no separate cognify() step in the updated example.This example uses a single dataset for simplicity. In practice, you can process multiple datasets or omit
dataset_name to use the default dataset.Optional: Limit to Specific Datasets
Using the HTTP API
If your server is running, you can run temporal search via the API by settingsearch_type to "TEMPORAL":
The Python example above is still the easiest way to enable temporal ingestion because it lets you pass
temporal_cognify=True directly to remember().Graphiti Mode: Episode-Based Temporal Graph
Cognee also ships a second temporal path built on Graphiti-core. Instead of extracting events and timestamps from text, it stores each document as a timestamped episode directly in Neo4j. Graphiti automatically tracks entities and how facts evolve over time across episodes. If you want, you can then index those episodes into Cognee’s vector store to run standardSearchType.* queries alongside Graphiti search.
When to prefer this mode:
- You need a complete, immutable episode history
- You want direct access to Graphiti’s graph traversal and search API
- Your pipeline requires a Neo4j-backed temporal store
temporal_cognify=True vs. Graphiti mode
Both modes make your memory time-aware, but they work differently and are enabled in different ways:
Requirements
Requirements
Neo4j is a hard requirement of graphiti-core itself, not a Cognee design choice. Installing
cognee[graphiti] binds your temporal store to Neo4j or AuraDB. If you want temporal search without a Neo4j dependency, use Cognee’s native SearchType.TEMPORAL (see above) — it works with any supported graph store.- Running Neo4j instance (v4.4+ or AuraDB)
- Install the
graphitiextra:pip install cognee[graphiti] - Set the following environment variables:
Build and Query with Graphiti
Build and Query with Graphiti
search_graph_with_temporal_awareness closes the Neo4j connection after returning results. For multiple queries, call graphiti.search(query) directly on the returned instance and close with await graphiti.close() when finished.Index the Episodes
Index the Episodes
After building the episode graph, pull the Neo4j data into Cognee’s vector store:
This step requires
GRAPH_DATABASE_PROVIDER=neo4j to be set. It raises a RuntimeError if the active graph engine is not Neo4j.Full Example
Latest guide
Latest guide
Legacy guide
Legacy guide
Additional examples
Additional examples about temporal awareness are available on our GitHub.Core Concepts
Understand knowledge graph fundamentals
API Reference
Explore temporal API endpoints