Overview#

cognee is an AI-memory framework: you add data, cognify it into a knowledge graph plus embeddings, and then search that memory in many different ways. cognee-agensgraph lets a single AgensGraph database back both halves of that memory — the knowledge graph and the vector store.

The package registers two adapters with cognee:

  • Graph adapter (AgensgraphAdapter) — stores entities and relationships as an AgensGraph property graph, queried with Cypher. Each cognee class is a vertex label of its own, in lower case, under a common __node__ label; each relationship is an edge label.

  • Vector adapter (AgensgraphVectorAdapter) — stores embeddings using the pgvector HNSW index in the same database.

Importing cognee_agensgraph registers both; you then select them with graph_database_provider="agensgraph" and vector_db_provider="agensgraph".

What you get

  • One AgensGraph database for the graph and the embeddings — no second datastore.

  • cognee’s search modes over the same memory — from graph-grounded answers and chain-of-thought reasoning to plain vector RAG, raw Cypher, and natural-language → Cypher.

  • End-to-end add → cognify → search with the AgensGraph vector adapter.

  • Async throughout, on the agensgraph-python driver. Both adapters share one connection pool when they use the same connection string (credentials in the URL; a separate username or password gives the graph adapter its own).

  • query() (behind SearchType.CYPHER and NATURAL_LANGUAGE) is read-only by default. As a superuser it can still run a program on the database host; see Usage.

  • Direct graph access via get_graph_engine() (from cognee.infrastructure.databases.graph) and HTML visualization via cognee.visualize_graph().

Note

Version 0.3.1. cognee-agensgraph is published to PyPI (see Installation). 0.3.1 is a documentation release; its code is 0.3.0’s. 0.3.0 moved both adapters onto the agensgraph-python driver, stores each DataPoint class on its own label, returns all ten graph metrics, sends embeddings in binary, adds bulk_ingest() for first loads, and makes query() read-only by default. It requires cognee 0.2 (>=0.2.1,<0.3), AgensGraph 2.17 or later, and Python 3.11 to 3.13. A graph written by 0.2.0 is not readable by 0.3.x; drop it in SQL, reset cognee’s metadata, and add and cognify your data again (see Installation).