cognee.config
Static class for configuring Cognee’s runtime settings. All setters persist for the duration of the process (or until overridden). Usecognee.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
Vector Database Configuration
Vector Database Configuration
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