by topoteretes
Cognee is an open-source project that provides a dynamic memory solution for AI agents, aiming to replace traditional RAG systems with a scalable and modular approach for data ingestion, processing, and search.
Cognee is an open-source project that provides a dynamic memory solution for AI agents with just a few lines of code. It aims to replace traditional RAG (Retrieval Augmented Generation) systems by offering a scalable and modular approach to data ingestion, processing, and search, leveraging graph and vector databases.
Cognee can be installed via pip
, poetry
, or uv
. It supports Python versions 3.8 to 3.12. Basic usage involves setting an LLM API key (e.g., OpenAI API key), adding text data to Cognee, generating a knowledge graph using the cognify()
function, and then querying the knowledge graph with the search()
function. Cognee also offers a UI for local use.
cognee - Memory for AI Agents in 5 lines of code
🚀 We are launching Cognee SaaS: Sign up here for the hosted beta!
Build dynamic memory for Agents and replace RAG using scalable, modular ECL (Extract, Cognify, Load) pipelines.
Get started quickly with a Google Colab notebook , Deepnote notebook or starter repo
Your contributions are at the core of making this a true open source project. Any contributions you make are greatly appreciated. See CONTRIBUTING.md
for more information.
You can install Cognee using either pip, poetry, uv or any other python package manager. Cognee supports Python 3.8 to 3.12
pip install cognee
You can install the local Cognee repo using pip, poetry and uv. For local pip installation please make sure your pip version is above version 21.3.
uv sync --all-extras
import os
os.environ["LLM_API_KEY"] = "YOUR OPENAI_API_KEY"
You can also set the variables by creating .env file, using our template. To use different LLM providers, for more info check out our documentation
This script will run the default pipeline:
import cognee
import asyncio
async def main():
# Add text to cognee
await cognee.add("Natural language processing (NLP) is an interdisciplinary subfield of computer science and information retrieval.")
# Generate the knowledge graph
await cognee.cognify()
# Query the knowledge graph
results = await cognee.search("Tell me about NLP")
# Display the results
for result in results:
print(result)
if __name__ == '__main__':
asyncio.run(main())
Example output:
Natural Language Processing (NLP) is a cross-disciplinary and interdisciplinary field that involves computer science and information retrieval. It focuses on the interaction between computers and human language, enabling machines to understand and process natural language.
You can also cognify your files and query using cognee UI.
Try cognee UI out locally here.
We are committed to making open source an enjoyable and respectful experience for our community. See CODE_OF_CONDUCT for more information.
Reviews feature coming soon
Stay tuned for community discussions and feedback