Skip to main content
A minimal guide to using Amazon Neptune Analytics as cognee’s graph and vector store. It needs an AWS account rather than a local server, and one Neptune Analytics graph holds both the entities and their embeddings — so there is no separate vector database to provision.

Before You Start

  • Complete Quickstart to understand basic operations
  • Ensure you have LLM Providers configured (LLM_API_KEY in .env)
  • Provision a Neptune Analytics graph in your AWS account (AWS instructions), and give it a vector search dimension matching your embedding model’s dimension
  • Install the Neptune extra: uv pip install "cognee[neptune]"
  • Make AWS credentials authorized for that graph available to the standard AWS SDK chain — environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, plus AWS_SESSION_TOKEN for temporary credentials), a shared profile, or an instance role. load_dotenv() makes .env values work as environment variables
  • Set GRAPH_ID in .env to your graph’s identifier; the script turns it into a neptune-graph://<GRAPH_ID> endpoint
  • Read Graph Stores and Vector Stores for the rest of the backend settings

Code in Action

The cognee.forget(everything=True) call at the end wipes the configured graph. Do not point this script at a Neptune Analytics graph holding data you want to keep — or delete that line before running it.

What Just Happened

Step 1: Build the Graph Endpoint

Cognee addresses a Neptune Analytics graph as neptune-graph://<GRAPH_ID>, so the only cloud-specific value the script needs is the graph identifier. Reading it from the environment keeps the identifier — and the AWS credentials the SDK picks up alongside it — out of the code.

Step 2: Use One Graph as Both Stores

Neptune Analytics supports vector search inside graph traversals, so the same endpoint is registered as both the graph store and the vector store. Both calls take the same URL on purpose — entities, relationships, and embeddings all live in the one graph you provisioned.

Step 3: Point Cognee at Local Directories

The graph and the embeddings are remote, but cognee still keeps ingested documents and its relational metadata on disk. Setting both roots next to the script keeps this example’s local files separate from your default cognee directories.

Step 4: Remember the Sample Text

remember() ingests both passages, extracts entities and relationships, and writes the resulting nodes, edges, and embeddings into your Neptune Analytics graph. dataset_name groups everything this call produces so a later search can be scoped to it.

Step 5: Query the Graph and Its Vectors

SearchType.GRAPH_COMPLETION retrieves the triplets stored around the query and asks the LLM to answer from them, which exercises the graph side of the store. SearchType.CHUNKS returns the raw text chunks behind a query instead, exercising the vector side — together they confirm both halves of the Neptune Analytics backend are populated. datasets=[dataset_name] limits the second search to the dataset created above.

Graph Stores

Every graph backend cognee supports, and their settings.

Vector Stores

Per-provider vector settings, including the Neptune Analytics block.

Store Configurations

Copy-paste .env blocks for the other supported store combinations, including the local default.