config

Bot configuration loaded from config.yaml with environment variable overrides.

Supports a platforms list so multiple chat platforms (Matrix, Discord, …) can be configured independently alongside the shared LLM / web settings.

class config.PlatformConfig(type='', enabled=True, settings=<factory>)[source]

Bases: object

Configuration for a single chat platform.

Parameters:
type: str = ''

"matrix", "discord", etc.

Type:

Platform identifier

enabled: bool = True

Whether this platform should be started.

settings: dict[str, Any]

All remaining keys from the YAML block are stored here.

get(key, default=None)[source]

Get.

Parameters:
  • key (str) – Dictionary or cache key.

  • default (Any) – The default value.

Returns:

The result.

Return type:

Any

class config.Config(api_key='', gemini_api_key='', llm_base_url='http://localhost:3000/openai', model='x-ai/grok-4.1-fast', temperature=0.7, max_tokens=60000, system_prompt_file='system_prompt.j2', max_history=100, tools_dir='tools', tool_permissions=<factory>, api_keys=<factory>, redis_url='', redis_tls_cert='', redis_tls_key='', redis_tls_ca='', embedding_model='google/gemini-embedding-001', embedding_batch_size=50, embedding_flush_interval=3600.0, kg_extraction_model='gemini-3-flash-preview', kg_max_hops=2, kg_seed_top_k=8, kg_max_context_entities=30, kg_entity_dedup_threshold=0.9, kg_relationship_decay_factor=0.95, kg_per_message_extraction=False, kg_min_message_length=100, kg_per_user_extraction_limit=5, kg_extraction_channel_hints=<factory>, llm_filter_enabled=False, proactive_enabled=False, proactive_default_frequency=0.05, proactive_triage_enabled=True, proactive_triage_model='gemini-3.1-flash-lite-preview', batch_window=5.0, max_batch_size=10, dna_vault_path='data/dna_vault', api_key_encryption_db_path='data/api_key_encryption_keys.db', media_cache_dir='media_cache', media_cache_max_mb=500, user_sandboxes_dir='data/user_sandboxes', tor_gateway_container='stargazer-tor-gateway', sandbox_curl_image='curlimages/curl:8.11.1', resolve_emojis_as_images=True, max_emojis_per_message=5, web_host='127.0.0.1', web_port=8080, admin_user_ids=<factory>, webhook_secret='', discord_oauth_client_id='', discord_oauth_client_secret='', discord_oauth_redirect_uri='', oauth_encryption_key='', oauth_base_url='', oauth_providers=<factory>, platforms=<factory>, homeserver='https://matrix.org', user_id='', password='', store_path='nio_store', credentials_file='credentials.json')[source]

Bases: object

Config.

Parameters:
  • api_key (str)

  • gemini_api_key (str)

  • llm_base_url (str)

  • model (str)

  • temperature (float)

  • max_tokens (int)

  • system_prompt_file (str)

  • max_history (int)

  • tools_dir (str)

  • tool_permissions (dict[str, list[str]])

  • api_keys (dict[str, Any])

  • redis_url (str)

  • redis_tls_cert (str)

  • redis_tls_key (str)

  • redis_tls_ca (str)

  • embedding_model (str)

  • embedding_batch_size (int)

  • embedding_flush_interval (float)

  • kg_extraction_model (str)

  • kg_max_hops (int)

  • kg_seed_top_k (int)

  • kg_max_context_entities (int)

  • kg_entity_dedup_threshold (float)

  • kg_relationship_decay_factor (float)

  • kg_per_message_extraction (bool)

  • kg_min_message_length (int)

  • kg_per_user_extraction_limit (int)

  • kg_extraction_channel_hints (dict[str, str])

  • llm_filter_enabled (bool)

  • proactive_enabled (bool)

  • proactive_default_frequency (float)

  • proactive_triage_enabled (bool)

  • proactive_triage_model (str)

  • batch_window (float)

  • max_batch_size (int)

  • dna_vault_path (str)

  • api_key_encryption_db_path (str)

  • media_cache_dir (str)

  • media_cache_max_mb (int)

  • user_sandboxes_dir (str)

  • tor_gateway_container (str)

  • sandbox_curl_image (str)

  • resolve_emojis_as_images (bool)

  • max_emojis_per_message (int)

  • web_host (str)

  • web_port (int)

  • admin_user_ids (list[str])

  • webhook_secret (str)

  • discord_oauth_client_id (str)

  • discord_oauth_client_secret (str)

  • discord_oauth_redirect_uri (str)

  • oauth_encryption_key (str)

  • oauth_base_url (str)

  • oauth_providers (dict[str, dict[str, Any]])

  • platforms (list[PlatformConfig])

  • homeserver (str)

  • user_id (str)

  • password (str)

  • store_path (str)

  • credentials_file (str)

api_key: str = ''
gemini_api_key: str = ''
llm_base_url: str = 'http://localhost:3000/openai'
model: str = 'x-ai/grok-4.1-fast'
temperature: float = 0.7
max_tokens: int = 60000
system_prompt_file: str = 'system_prompt.j2'
max_history: int = 100
tools_dir: str = 'tools'
tool_permissions: dict[str, list[str]]
api_keys: dict[str, Any]
redis_url: str = ''
redis_tls_cert: str = ''
redis_tls_key: str = ''
redis_tls_ca: str = ''
embedding_model: str = 'google/gemini-embedding-001'
embedding_batch_size: int = 50
embedding_flush_interval: float = 3600.0
kg_extraction_model: str = 'gemini-3-flash-preview'
kg_max_hops: int = 2
kg_seed_top_k: int = 8
kg_max_context_entities: int = 30
kg_entity_dedup_threshold: float = 0.9
kg_relationship_decay_factor: float = 0.95
kg_per_message_extraction: bool = False
kg_min_message_length: int = 100
kg_per_user_extraction_limit: int = 5
kg_extraction_channel_hints: dict[str, str]

channel_id` -> human label for KG extraction prompts.

Type:

Optional `platform

property openrouter_api_key: str

Backward-compat alias – embeddings code still reads this.

property API_KEYS: dict

tools expect config.API_KEYS[‘brave’], etc.

Type:

Backward-compat

llm_filter_enabled: bool = False
proactive_enabled: bool = False
proactive_default_frequency: float = 0.05
proactive_triage_enabled: bool = True
proactive_triage_model: str = 'gemini-3.1-flash-lite-preview'
batch_window: float = 5.0
max_batch_size: int = 10
dna_vault_path: str = 'data/dna_vault'
api_key_encryption_db_path: str = 'data/api_key_encryption_keys.db'
media_cache_dir: str = 'media_cache'
media_cache_max_mb: int = 500
user_sandboxes_dir: str = 'data/user_sandboxes'

Root directory for {user_id}/workspace sandbox trees.

tor_gateway_container: str = 'stargazer-tor-gateway'

Docker container name for docker run --network container:... Tor sidecar.

sandbox_curl_image: str = 'curlimages/curl:8.11.1'

Image for HTTPS downloads into a user sandbox over the Tor netns.

resolve_emojis_as_images: bool = True
max_emojis_per_message: int = 5
web_host: str = '127.0.0.1'
web_port: int = 8080
admin_user_ids: list[str]
webhook_secret: str = ''
discord_oauth_client_id: str = ''
discord_oauth_client_secret: str = ''
discord_oauth_redirect_uri: str = ''
oauth_encryption_key: str = ''
oauth_base_url: str = ''
oauth_providers: dict[str, dict[str, Any]]
platforms: list[PlatformConfig]
homeserver: str = 'https://matrix.org'
user_id: str = ''
password: str = ''
store_path: str = 'nio_store'
credentials_file: str = 'credentials.json'
classmethod load(path='config.yaml')[source]

Load config from a YAML file, then apply environment variable overrides.

Return type:

Config

Parameters:

path (str | Path)

redis_ssl_kwargs()[source]

Return SSL keyword arguments for redis.asyncio clients.

Returns an empty dict when mTLS is not configured, so callers can unconditionally unpack the result into Redis() / from_url().

All certificate verification is explicitly disabled.

Return type:

dict