EngineConfiguration Reference
This page documents naas_abi_core/engine/engine_configuration/EngineConfiguration.py in detail.
Related pages: Configuration, Engine, EngineConfiguration-Services-Reference, Overview, Built-in-Module-Templatable-SPARQL.
Purpose
EngineConfiguration is the runtime configuration model and loader for ABI core. It combines:
- pydantic schema validation,
- Jinja2 templating,
- secret bootstrap/loading,
- environment-aware file selection,
- default service/module insertion.
Data models defined in the file
ServicesConfiguration
Defines top-level service configuration and built-in defaults.
Default services if omitted in YAML:
object_storage: FS adapter,base_path: storage/datastoretriple_store: FS adapter,store_path: storage/triplestore,triples_path: triplesvector_store:qdrant_in_memorysecret: dotenv adapterbus:python_queuekv:python
ApiConfiguration
Default API settings:
title:ABI APIdescription:API for ABI, your Artifical Business Intelligencelogo_path:assets/logo.pngfavicon_path:assets/favicon.icocors_origins:["http://localhost:9879"]reload:True
FirstPassConfiguration
Minimal model containing only services.secret.
Used during bootstrap so secrets can be resolved before validating/loading all other service configs.
ModuleConfig
Module entry model:
path: str | Nonemodule: str | Noneenabled: boolconfig: dict
Validation rule: at least one of path or module must be provided.
GlobalConfig
Currently enforces:
ai_modeincloud | local | airgap
EngineConfiguration
Top-level engine schema:
api: ApiConfigurationdeploy: DeployConfiguration | Noneservices: ServicesConfigurationglobal_config: GlobalConfigmodules: list[ModuleConfig]default_agent: str(default:naas_abi AbiAgent)
Default module injection
EngineConfiguration.ensure_default_modules() auto-appends:
naas_abi_core.modules.templatablesparqlquery
if not already present in either modules[].module or modules[].path.
This is called by validate_modules() model validator.
Loading pipeline
1) from_yaml(path)
- Reads file content and forwards to
from_yaml_content(content).
2) from_yaml_content(content)
Performs two-pass rendering:
- Detect bootstrap dotenv adapter directly from raw YAML.
- First-pass Jinja render using
SecretServiceWrapper(secret_service=None, bootstrap_dotenv_adapter=...). - Validate/load
FirstPassConfigurationand build realSecretservice. - Second-pass Jinja render using
SecretServiceWrapper(secret_service=<loaded>). - Parse rendered YAML and validate full
EngineConfiguration.
3) load_configuration(configuration_yaml=None)
- If
configuration_yamlis passed, parse it directly (used by tests and inline configs). - Otherwise resolve file with this algorithm:
- read
ENVfrom process env; - if missing and
config.yamlexists, try bootstrap dotenv and readENVfrom it; - if
ENVexists andconfig.<ENV>.yamlexists, pick that file; - else fallback to
config.yaml; - if no file, raise
FileNotFoundError.
- read
Secret resolution behavior (SecretServiceWrapper)
The wrapper powers {{ secret.NAME }} in Jinja templates.
First pass (secret_service is None)
Lookup order:
os.environ[NAME]- bootstrap dotenv adapter value
- fallback message string: “secret not found while loading secret service”
The fallback string is intentional to let the first pass continue even when some secrets are unresolved.
Second pass (secret_service is set)
Lookup order:
os.environ[NAME](environment wins)secret_service.get(NAME)- if missing:
- non-interactive runtime (
stdinnot TTY): raiseValueError - interactive runtime: prompt user via
rich.prompt.Prompt, then persist usingsecret_service.set(NAME, value)
- non-interactive runtime (
Bootstrap dotenv adapter extraction
_load_bootstrap_dotenv_adapter_from_yaml_content inspects raw YAML (no template render) and returns a dotenv adapter if configured.
Validation rule:
services.secret.secret_adapters[].config.pathmust be a non-empty string when adapter isdotenv.
If invalid, a ValueError is raised before full config load.
Operational implications
- You can centralize secrets in
.envand still move to other secret backends later. - Environment variables always override secret backend values at load time.
- CI/CD should avoid interactive prompts by providing all required secrets in env or secret adapter.
- Missing
config.yamlandconfig.<ENV>.yamlis a hard startup failure.
Example with templated secrets
services:
secret:
secret_adapters:
- adapter: "dotenv"
config:
path: ".env"
vector_store:
vector_store_adapter:
adapter: "qdrant"
config:
host: "{{ secret.QDRANT_HOST }}"
port: {{ secret.QDRANT_PORT }}
api_key: "{{ secret.QDRANT_API_KEY }}"
global_config:
ai_mode: "local"
modules:
- module: "naas_abi_core.modules.templatablesparqlquery"
enabled: trueService adapter field reference
For the adapter-specific schema (bus, kv, object storage, secret, triple store, vector store, and deploy), see EngineConfiguration-Services-Reference.