Skip to content

automaton.config

WARNING

This documentation is almost entirely "vibe coded"; while a helpful resource for humans and agents to understand this codebase, it should not be considered a source of ground truth in the way documentation normally is, and the user is responsible for verifying that all instructions given here are safe.

automaton.config

Configuration loading and management for Automaton.

AutomatonConfig

AutomatonConfig(config_path: Path | None = None)

Automaton configuration.

Loads and manages provider-based model configuration from YAML file. Providers define API endpoints and authentication once, then models reference providers by name.

Attributes:

Name Type Description
config_path Path

Path to the loaded configuration file

data dict

Raw configuration data

Examples:

>>> config = AutomatonConfig()
>>> model = config.get_model("example-model")
>>> model["provider"]
'example'

Load configuration from file or use defaults.

Parameters:

Name Type Description Default
config_path Path

Path to YAML config file. If None, uses default.

None

Raises:

Type Description
FileNotFoundError

If config file not found

Source code in automaton/config.py
def __init__(self, config_path: Path | None = None):
    """Load configuration from file or use defaults.

    Parameters
    ----------
    config_path : Path, optional
        Path to YAML config file. If None, uses default.

    Raises
    ------
    FileNotFoundError
        If config file not found
    """
    if config_path is None:
        config_path = initialize_user_config()

    self.config_path = Path(config_path).expanduser().resolve()
    if not self.config_path.exists():
        raise FileNotFoundError(f"Config file not found: {self.config_path}")

    with open(self.config_path) as f:
        self.data = yaml.safe_load(f)

providers property

providers: dict[str, Any]

Get configured providers.

Returns:

Type Description
dict[str, Any]

Dictionary mapping provider names to their configurations

models property

models: dict[str, Any]

Get configured models.

Returns:

Type Description
dict[str, Any]

Dictionary mapping model names to their configurations

agents property

agents: dict[str, Any]

Get configured agents.

harnesses property

harnesses: dict[str, Any]

Get configured harnesses.

Returns:

Type Description
dict[str, Any]

Dictionary mapping harness names to their configurations

defaults property

defaults: dict[str, Any]

Get default settings.

Returns:

Type Description
dict[str, Any]

Dictionary of default settings

timeout_seconds property

timeout_seconds: int

Get default timeout in seconds.

Returns:

Type Description
int

Default timeout in seconds

sandbox_network property

sandbox_network: bool

Return whether harness and verification use loopback-only networking.

allowed_provider_executed_tools property

allowed_provider_executed_tools: frozenset[str]

Provider-executed tool types the model proxy is permitted to forward.

Empty by default, which blocks all of them. These tools run on the model provider's infrastructure rather than inside the sandbox, so the sandbox network namespace cannot confine them and their use leaves no trace in the harness transcript. Allowing one is an explicit, auditable decision.

Configure under defaults in config.yaml::

defaults:
  allowed_provider_executed_tools:
    - web_search

Returns:

Type Description
frozenset[str]

Lowercased tool type names.

get_provider

get_provider(name: str) -> dict[str, Any]

Get provider configuration by name.

Parameters:

Name Type Description Default
name str

Provider name to look up

required

Returns:

Type Description
dict[str, Any]

Provider configuration dictionary

Raises:

Type Description
ValueError

If provider not found in config

Source code in automaton/config.py
def get_provider(self, name: str) -> dict[str, Any]:
    """Get provider configuration by name.

    Parameters
    ----------
    name : str
        Provider name to look up

    Returns
    -------
    dict[str, Any]
        Provider configuration dictionary

    Raises
    ------
    ValueError
        If provider not found in config
    """
    if name not in self.providers:
        raise ValueError(f"Provider '{name}' not found in config")
    return self.providers[name]

get_model

get_model(name: str) -> dict[str, Any]

Get model configuration by name, with provider settings merged in.

Automatically normalizes base_url to ensure it ends with /v1.

Parameters:

Name Type Description Default
name str

Model name to look up in configuration

required

Returns:

Type Description
dict[str, Any]

Merged model configuration dictionary with keys: - model: str - base_url: str - api_key_env: str - cert: str | None - api: str | None (opaque API-style hint, interpreted by the harness)

Raises:

Type Description
ValueError

If model not found in configuration

Examples:

>>> config = AutomatonConfig()
>>> model = config.get_model("example-model")
>>> "base_url" in model
True
Source code in automaton/config.py
def get_model(self, name: str) -> dict[str, Any]:
    """Get model configuration by name, with provider settings merged in.

    Automatically normalizes base_url to ensure it ends with /v1.

    Parameters
    ----------
    name : str
        Model name to look up in configuration

    Returns
    -------
    dict[str, Any]
        Merged model configuration dictionary with keys:
        - model: str
        - base_url: str
        - api_key_env: str
        - cert: str | None
        - api: str | None (opaque API-style hint, interpreted by the harness)

    Raises
    ------
    ValueError
        If model not found in configuration

    Examples
    --------
    >>> config = AutomatonConfig()  # doctest: +SKIP
    >>> model = config.get_model("example-model")  # doctest: +SKIP
    >>> "base_url" in model
    True
    """
    if name not in self.models:
        raise ValueError(f"Model '{name}' not found in config")

    model_config = self.models[name].copy()

    # If model references a provider, merge provider settings
    if "provider" in model_config:
        provider_name = model_config["provider"]
        provider_config = self.get_provider(provider_name)

        # Merge provider settings, with model-specific overrides taking precedence.
        # `api` is carried through for the harness, which owns how a style is
        # wired. Core reads it for one purpose only: the model proxy needs the
        # style to choose the upstream authentication scheme, since Anthropic
        # Messages requires x-api-key rather than Authorization: Bearer.
        merged = {
            "base_url": _normalize_base_url(provider_config.get("base_url")),
            "api_key_env": provider_config.get("api_key_env"),
            "cert": provider_config.get("cert"),
            "api": provider_config.get("api"),
        }
        merged.update(model_config)
        # Normalize base_url if it was overridden in model config
        if "base_url" in model_config:
            merged["base_url"] = _normalize_base_url(model_config["base_url"])
        merged["cost"] = _normalize_cost(model_config.get("cost"))
        return merged

    # Direct model config (no provider reference)
    # Normalize base_url if present
    if "base_url" in model_config:
        model_config["base_url"] = _normalize_base_url(model_config["base_url"])
    model_config["cost"] = _normalize_cost(model_config.get("cost"))
    return model_config

get_agent

get_agent(name: str) -> dict[str, Any]

Get agent configuration by name.

Source code in automaton/config.py
def get_agent(self, name: str) -> dict[str, Any]:
    """Get agent configuration by name."""
    if name not in self.agents:
        raise ValueError(f"Agent '{name}' not found in config")
    return self.agents[name]

get_harness

get_harness(name: str) -> dict[str, Any]

Get harness configuration by name.

Parameters:

Name Type Description Default
name str

Harness name to look up

required

Returns:

Type Description
dict[str, Any]

Harness configuration dictionary

Raises:

Type Description
ValueError

If harness not found in config

Source code in automaton/config.py
def get_harness(self, name: str) -> dict[str, Any]:
    """Get harness configuration by name.

    Parameters
    ----------
    name : str
        Harness name to look up

    Returns
    -------
    dict[str, Any]
        Harness configuration dictionary

    Raises
    ------
    ValueError
        If harness not found in config
    """
    if name not in self.harnesses:
        raise ValueError(f"Harness '{name}' not found in config")
    return self.harnesses[name]

initialize_user_config

initialize_user_config() -> Path

Create the default user config directory and template if missing.

Returns:

Type Description
Path

Path to the created config file

Examples:

>>> initialize_user_config()
PosixPath('/home/user/.automaton/config.yaml')
Source code in automaton/config.py
def initialize_user_config() -> Path:
    """Create the default user config directory and template if missing.

    Returns
    -------
    Path
        Path to the created config file

    Examples
    --------
    >>> initialize_user_config()  # doctest: +SKIP
    PosixPath('/home/user/.automaton/config.yaml')
    """
    config_dir = DEFAULT_CONFIG_DIR.expanduser()
    config_path = DEFAULT_CONFIG_PATH.expanduser()

    config_dir.mkdir(parents=True, exist_ok=True)
    if not config_path.exists():
        config_path.write_text(DEFAULT_CONFIG_TEMPLATE)

    return config_path