Configuration API

KonfAI builds workflows from YAML by combining configuration decorators, constructor signatures, and recursive object instantiation.

class konfai.utils.config.Config(key)[source]

Bases: object

Context manager for reading and updating a subtree of the active YAML config.

Parameters:

key (str) – Dot-separated path pointing to the configuration subtree to inspect or materialize.

konfai.utils.config.config(key=None)[source]

Attach a KonfAI configuration key to a class or callable.

Parameters:

key (str | None) – Configuration branch handled by the decorated object.

Returns:

Decorator storing the key on the decorated object.

Return type:

Callable

konfai.utils.config.apply_config(konfai_args=None)[source]

Recursively instantiate callables from the active KonfAI configuration.

Parameters:

konfai_args (str | None) – Root configuration path used to resolve nested constructor arguments.

Returns:

Decorator that injects configuration-backed arguments at call time.

Return type:

Callable

See also