CortexFlowConfig
The CortexFlowConfig class holds configuration settings for the CortexFlow system.
It uses a nested dataclass architecture where each subsystem has its own config class.
- class cortexflow.CortexFlowConfig(memory: MemoryConfig = <factory>, knowledge_store: KnowledgeStoreConfig = <factory>, graph_rag: GraphRagConfig = <factory>, ontology: OntologyConfig = <factory>, metadata: MetadataConfig = <factory>, agents: AgentConfig = <factory>, reflection: ReflectionConfig = <factory>, uncertainty: UncertaintyConfig = <factory>, performance: PerformanceConfig = <factory>, llm: LLMConfig = <factory>, classifier: ClassifierConfig = <factory>, inference: InferenceConfig = <factory>, session: SessionConfig = <factory>, emotion: EmotionConfig = <factory>, persona: PersonaConfig = <factory>, relationship: RelationshipConfig = <factory>, events: EventConfig = <factory>, temporal: TemporalConfig = <factory>, episodic: EpisodicConfig = <factory>, safety: SafetyConfig = <factory>, vector_store: VectorStoreConfig = <factory>, verbose_logging: bool = False, debug_mode: bool = False, custom_config: dict[str, ~typing.Any]=<factory>, _FIELD_MAP: dict[str, str] | None=None)[source]
Bases:
objectConfiguration for CortexFlow.
- agents: AgentConfig
- classifier: ClassifierConfig
- emotion: EmotionConfig
- episodic: EpisodicConfig
- events: EventConfig
- classmethod from_dict(config_dict: dict[str, Any]) CortexFlowConfig[source]
Create configuration from a dictionary.
- Parameters:
config_dict – Configuration dictionary
- Returns:
CortexFlowConfig instance
- graph_rag: GraphRagConfig
- inference: InferenceConfig
- knowledge_store: KnowledgeStoreConfig
- memory: MemoryConfig
- metadata: MetadataConfig
- ontology: OntologyConfig
- performance: PerformanceConfig
- persona: PersonaConfig
- reflection: ReflectionConfig
- relationship: RelationshipConfig
- safety: SafetyConfig
- session: SessionConfig
- temporal: TemporalConfig
- to_dict(*, redact: bool = False) dict[str, Any][source]
Convert configuration to a flat dictionary.
- Parameters:
redact – If True, replace sensitive values with
"***".- Returns:
Dictionary representation of configuration
- uncertainty: UncertaintyConfig
- vector_store: VectorStoreConfig
Sub-Configuration Classes
CortexFlow configuration is organized into the following nested sections:
MemoryConfig
Controls the multi-tier memory system.
- class cortexflow.config.MemoryConfig(active_token_limit: int = 4096, working_token_limit: int = 8192, archive_token_limit: int = 16384, use_dynamic_weighting: bool = False, dynamic_weighting_learning_rate: float = 0.1, dynamic_weighting_min_tier_size: int = 1000, dynamic_weighting_default_ratios: dict[str, float]=<factory>, use_fact_extraction: bool = False)[source]
Memory configuration settings.
active_token_limit- Maximum tokens in the active memory tier (default: 4096)working_token_limit- Maximum tokens in the working memory tier (default: 8192)archive_token_limit- Maximum tokens in the archive memory tier (default: 16384)use_dynamic_weighting- Enable dynamic tier weighting (default: False)
LLMConfig
Configures which LLM backend and model to use.
- class cortexflow.config.LLMConfig(default_model: str = 'gemma3:1b', ollama_host: str = 'http://localhost:11434', conversation_style: str = 'casual', system_persona: str = 'helpful assistant', backend: str = 'ollama', vertex_project_id: str | None = None, vertex_location: str | None = None, vertex_api_key: str | None = None, vertex_credentials_path: str | None = None, vertex_model: str = 'gemini-1.5-flash')[source]
LLM Integration configuration settings.
default_model- Model used for generating responsesbackend- LLM backend:"ollama"or"vertex_ai"(default:"ollama")ollama_host- Host URL for Ollama (default:"http://localhost:11434")vertex_project_id- GCP project ID for Vertex AIvertex_location- GCP region for Vertex AIvertex_credentials_path- Path to service account JSON for Vertex AI
KnowledgeStoreConfig
Settings for knowledge persistence and retrieval.
- class cortexflow.config.KnowledgeStoreConfig(knowledge_store_path: str = 'cortexflow.db', retrieval_type: str = 'hybrid', trust_marker: str = '📚', use_reranking: bool = True, rerank_top_k: int = 15, vector_model: str = 'all-MiniLM-L6-v2')[source]
Knowledge store configuration settings.
knowledge_store_path- Path to persistent storage (default:"cortexflow.db")retrieval_type- Retrieval strategy:"hybrid","bm25","dense"(default:"hybrid")use_reranking- Enable result reranking (default: True)
GraphRagConfig
Settings for graph-based retrieval-augmented generation.
- class cortexflow.config.GraphRagConfig(use_graph_rag: bool = False, enable_multi_hop_queries: bool = False, max_graph_hops: int = 3, graph_weight: float = 0.5, use_graph_partitioning: bool = False, graph_partition_method: str = 'louvain', target_partition_count: int = 5, use_multihop_indexing: bool = False, max_indexed_hops: int = 2)[source]
Graph RAG configuration settings.
use_graph_rag- Enable GraphRAG (default: False)enable_multi_hop_queries- Allow multi-hop graph traversal (default: False)max_graph_hops- Maximum traversal depth (default: 3)
AgentConfig
Settings for the Chain of Agents framework.
- class cortexflow.config.AgentConfig(use_chain_of_agents: bool = False, chain_complexity_threshold: int = 5, chain_agent_count: int = 3)[source]
Chain of Agents configuration settings.
use_chain_of_agents- Enable Chain of Agents (default: False)chain_complexity_threshold- Minimum complexity to trigger agents (default: 5)
ReflectionConfig
Settings for self-reflection and verification.
- class cortexflow.config.ReflectionConfig(use_self_reflection: bool = False, reflection_relevance_threshold: float = 0.6, reflection_confidence_threshold: float = 0.7)[source]
Self-Reflection configuration settings.
use_self_reflection- Enable self-verification (default: False)reflection_relevance_threshold- Minimum relevance score (default: 0.6)
Other Config Sections
OntologyConfig- Ontology evolution settingsMetadataConfig- Provenance and confidence trackingUncertaintyConfig- Contradiction detection and handlingPerformanceConfig- Cache sizes and TTL settingsClassifierConfig- ML classifier settingsInferenceConfig- Inference engine settings
ConfigBuilder
The ConfigBuilder class provides a fluent API for constructing CortexFlowConfig
instances:
- class cortexflow.config.ConfigBuilder[source]
Builder class for CortexFlowConfig to allow fluent configuration.
- build() CortexFlowConfig[source]
Build the final configuration object.
- with_agents(**kwargs) ConfigBuilder[source]
Configure chain of agents settings.
- with_classifier(**kwargs) ConfigBuilder[source]
Configure classifier settings.
- with_debug(verbose_logging: bool = None, debug_mode: bool = None) ConfigBuilder[source]
Configure debug and logging settings.
- with_emotions(**kwargs) ConfigBuilder[source]
Enable and configure emotion tracking.
- with_episodic(**kwargs) ConfigBuilder[source]
Enable and configure episodic memory.
- with_events(**kwargs) ConfigBuilder[source]
Enable and configure event system.
- with_fact_extraction(enabled: bool = True) ConfigBuilder[source]
Enable or disable personal fact extraction for deep memory recall.
- with_graph_rag(**kwargs) ConfigBuilder[source]
Configure graph RAG settings.
- with_inference(**kwargs) ConfigBuilder[source]
Configure inference engine settings.
- with_knowledge_store(**kwargs) ConfigBuilder[source]
Configure knowledge store settings.
- with_llm(**kwargs) ConfigBuilder[source]
Configure LLM integration settings.
- with_memory(**kwargs) ConfigBuilder[source]
Configure memory settings.
- with_metadata(**kwargs) ConfigBuilder[source]
Configure metadata framework settings.
- with_ontology(**kwargs) ConfigBuilder[source]
Configure ontology settings.
- with_performance(**kwargs) ConfigBuilder[source]
Configure performance optimization settings.
- with_persona(**kwargs) ConfigBuilder[source]
Enable and configure persona management.
- with_reflection(**kwargs) ConfigBuilder[source]
Configure self-reflection settings.
- with_relationship(**kwargs) ConfigBuilder[source]
Enable and configure relationship tracking.
- with_safety(**kwargs) ConfigBuilder[source]
Enable and configure the safety pipeline.
- with_sessions(**kwargs) ConfigBuilder[source]
Enable and configure session management.
- with_temporal(**kwargs) ConfigBuilder[source]
Enable and configure temporal fact management.
- with_uncertainty(**kwargs) ConfigBuilder[source]
Configure uncertainty handling settings.
- with_vector_store(**kwargs) ConfigBuilder[source]
Configure vector store backend.
- with_vertex_ai(project_id=None, location=None, default_model='gemini-1.5-flash', api_key=None, credentials_path=None) ConfigBuilder[source]
Configure Vertex AI as the LLM backend.
Example Usage
Nested dataclass style:
from cortexflow import CortexFlowConfig, MemoryConfig, LLMConfig
config = CortexFlowConfig(
memory=MemoryConfig(
active_token_limit=2000,
working_token_limit=4000,
archive_token_limit=6000,
),
llm=LLMConfig(
default_model="llama3",
backend="ollama",
),
)
Builder pattern style:
from cortexflow import ConfigBuilder
config = (ConfigBuilder()
.with_memory(active_token_limit=2000, working_token_limit=4000)
.with_llm(default_model="llama3")
.with_graph_rag(use_graph_rag=True)
.build())
Vertex AI configuration:
from cortexflow import ConfigBuilder
config = (ConfigBuilder()
.with_llm(backend="vertex_ai", default_model="gemini-2.0-flash")
.with_memory(active_token_limit=8192)
.build())
Loading from a dictionary (useful for YAML/JSON files):
from cortexflow import CortexFlowConfig
config = CortexFlowConfig.from_dict({
"active_token_limit": 2000,
"default_model": "llama3",
"use_graph_rag": True,
})