Skip to main content
A minimal guide to using Ladybug — cognee’s default, embedded graph database — as the graph store. Ladybug ships with cognee and runs in-process, so this is the fastest way to build a knowledge graph on your own machine without standing up a database server.

Before You Start

  • Complete Quickstart to understand basic operations
  • Ensure you have LLM Providers configured (LLM_API_KEY in .env)
  • Ensure you have Embedding Providers configured, since remember() embeds the text it ingests
  • Read Graph Stores for the full list of graph backends and their settings
  • Nothing to install: Ladybug is embedded and ships with cognee — no server to start and no pip extra to add

Code in Action

What Just Happened

Step 1: Select Ladybug as the Graph Provider

set_graph_db_config() updates cognee’s graph configuration, and graph_database_provider decides which database the knowledge graph is written to. Ladybug is already the default, so this call is explicit rather than required — it documents the choice and makes the script behave the same way even if GRAPH_DATABASE_PROVIDER is set in your environment.

Step 2: Point Cognee at Local Directories

The data root holds the copies of ingested documents; the system root holds cognee’s databases, including the embedded Ladybug graph file. Setting both next to the script keeps this example’s graph separate from your default cognee directories, so you can delete the two folders to start over.

Step 3: Remember the Sample Text

remember() ingests the text, extracts entities and relationships from it, and writes the resulting nodes and edges into Ladybug. dataset_name groups everything this call produces under one dataset so later searches can be scoped to it.

Step 4: Ask the Graph a Question

SearchType.GRAPH_COMPLETION retrieves the triplets Ladybug stores around the query and asks the LLM to answer from them. This is the search type that actually exercises the graph, so it is the quickest way to confirm the store is populated.

Step 5: Read the Underlying Chunks

SearchType.CHUNKS skips the answer generation and returns the raw text chunks behind a query, which is useful for checking what was ingested. datasets=[dataset_name] limits the search to the dataset created above instead of everything in the store.

Graph Stores

Configure a different graph backend when you outgrow the embedded one.

Graph Engine and Adapters

See how cognee talks to whichever graph database is configured.