cognee.config
Static class for configuring Cognee’s runtime settings. Setters change the settings for the current process only (unlessset(..., persist=True) also writes the value to .env), and they last until overridden. Graph and vector engines are cached per set of connection settings, so an engine requested after a change uses the new values. When backend access control (ENABLE_BACKEND_ACCESS_CONTROL, on by default) gives a dataset its own databases, that dataset’s stored connection details are used instead of the global graph and vector settings. Use cognee.config.set(...) for supported runtime-safe settings inside a Python process.
Cognee can also be configured through .env or process environment variables before import. Use those for process-level settings such as auth, logging, cache backend, storage backend, telemetry, API server settings, and deployment credentials.
For the full environment variable reference and precedence rules, see Setup Configuration.
Configuration Types
LLM Configuration
LLM Configuration
set_llm_config() keys must match the internal attribute names on LLMConfig. The exact internal attributes name are displayed in the table below.Internal LLM Configuration attributes
Internal LLM Configuration attributes
Embedding Configuration
Embedding Configuration
Internal Embedding Configuration attributes
Internal Embedding Configuration attributes
Graph Database Configuration
Graph Database Configuration
use_graph_adapter.Vector Database Configuration
Vector Database Configuration
qdrant and chromadb must be installed and registered with use_vector_adapter first.set_graph_database_provider() and set_vector_db_provider() accept any string. An unknown provider name raises OSError only when the graph or vector engine is created, not when the setter is called.The
set_*_config(dict) setters convert string values such as "true" or "4" to the field’s declared bool, int, or float type, and raise InvalidConfigAttributeError for an unknown key. set_embedding_dimensions() (also used for the embedding_dimensions key of set_embedding_config()) requires a positive integer and raises ValueError otherwise.Chunking Configuration
Chunking Configuration
Model Configuration
Model Configuration
Other Settings
Other Settings
Reading configuration
get(key) returns the current value of any key set() accepts, and get_all() returns
all of them as a dict. Both mask secret values (llm_api_key, embedding_api_key,
vector_db_key) by default, keeping only the first three and last four characters as a
hint (values of eight characters or fewer are masked entirely); pass reveal_secrets=True
to get the raw value. get() raises
InvalidConfigAttributeError for an unrecognized key.Persisting a value to .env
set() normally only updates the in-process configuration. Pass persist=True to also
write the resolved value into the .env file this process loaded, so it is picked up
by the next process that resolves the same file. That target may be a file pinned with
COGNEE_ENV_FILE or a .env found in a parent directory — see
How .env Is Loaded. Only when no
.env was resolved does it fall back to .env in the current working directory, creating
it if missing. This is what cognee-cli config set does. When persisting, set() returns
a dict describing where the value was written:persist=True, set() returns None and changes nothing on disk.All Configuration Methods
Configuration Methods
Configuration Methods