Skip to content
Night Brownie Night Brownie

Config

YAML config loader and Pydantic validation for Night Brownie.

All secrets are ${VAR} environment variable references — the config file itself never contains raw secret values.

Classes:

Functions:

  • load_config

    Load and validate a Night Brownie YAML configuration file.

AgentAssignment pydantic-model

Bases: BaseModel

A single agent assigned to a repository.

Parameters:

  • type (str) –

    Agent type identifier (e.g. issue-triage).

  • config (dict[str, Any], default: {} ) –

    Agent-specific configuration options.

  • allow_close (bool, default: False ) –

    Whether this agent may close issues.

Show JSON schema:
{
  "description": "A single agent assigned to a repository.",
  "properties": {
    "type": {
      "title": "Type",
      "type": "string"
    },
    "config": {
      "additionalProperties": true,
      "default": {},
      "title": "Config",
      "type": "object"
    },
    "allow_close": {
      "default": false,
      "title": "Allow Close",
      "type": "boolean"
    }
  },
  "required": [
    "type"
  ],
  "title": "AgentAssignment",
  "type": "object"
}

Fields:

allow_close pydantic-field

allow_close: bool = False

Whether this agent may close issues.

config pydantic-field

config: dict[str, Any] = {}

Agent-specific configuration options.

type pydantic-field

type: str

Agent type identifier (e.g. issue-triage).

ConfigError

Bases: Exception

Raised when config loading or validation fails.

IdentityConfig pydantic-model

Bases: BaseModel

Bot GitHub identity configuration.

Parameters:

  • github_token (SecretStr) –

    GitHub Personal Access Token for the bot account.

  • github_user (str) –

    GitHub username of the bot account.

Show JSON schema:
{
  "description": "Bot GitHub identity configuration.",
  "properties": {
    "github_token": {
      "format": "password",
      "title": "Github Token",
      "type": "string",
      "writeOnly": true
    },
    "github_user": {
      "title": "Github User",
      "type": "string"
    }
  },
  "required": [
    "github_token",
    "github_user"
  ],
  "title": "IdentityConfig",
  "type": "object"
}

Fields:

github_token pydantic-field

github_token: SecretStr

GitHub Personal Access Token for the bot account.

github_user pydantic-field

github_user: str

GitHub username of the bot account.

LLMConfig pydantic-model

Bases: BaseModel

LLM backend configuration.

Parameters:

  • provider (str) –

    LLM provider identifier (e.g. anthropic, ollama).

  • model (str) –

    Model name / identifier.

  • api_key (SecretStr | None, default: None ) –

    API key; omit for local providers such as Ollama.

Show JSON schema:
{
  "description": "LLM backend configuration.",
  "properties": {
    "provider": {
      "title": "Provider",
      "type": "string"
    },
    "model": {
      "title": "Model",
      "type": "string"
    },
    "api_key": {
      "anyOf": [
        {
          "format": "password",
          "type": "string",
          "writeOnly": true
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Api Key"
    }
  },
  "required": [
    "provider",
    "model"
  ],
  "title": "LLMConfig",
  "type": "object"
}

Fields:

api_key pydantic-field

api_key: SecretStr | None = None

API key; omit for local providers such as Ollama.

model pydantic-field

model: str

Model name / identifier.

provider pydantic-field

provider: str

LLM provider identifier (e.g. anthropic, ollama).

NightBrownieConfig pydantic-model

Bases: BaseModel

Top-level Night Brownie runtime configuration.

Parameters:

  • identity (IdentityConfig) –

    Bot GitHub identity.

  • llm (LLMConfig) –

    LLM backend configuration.

  • polling (PollingConfig, default: PollingConfig(interval_seconds=60) ) –

    GitHub polling settings.

  • queue (QueueConfig, default: QueueConfig(db_path=None, claim_timeout_seconds=300, max_retries=3, drain_interval_seconds=10, requeue_interval_seconds=60) ) –

    Task queue settings.

  • repos (list[RepoConfig], default: [] ) –

    Repositories to monitor.

Show JSON schema:
{
  "$defs": {
    "AgentAssignment": {
      "description": "A single agent assigned to a repository.",
      "properties": {
        "type": {
          "title": "Type",
          "type": "string"
        },
        "config": {
          "additionalProperties": true,
          "default": {},
          "title": "Config",
          "type": "object"
        },
        "allow_close": {
          "default": false,
          "title": "Allow Close",
          "type": "boolean"
        }
      },
      "required": [
        "type"
      ],
      "title": "AgentAssignment",
      "type": "object"
    },
    "IdentityConfig": {
      "description": "Bot GitHub identity configuration.",
      "properties": {
        "github_token": {
          "format": "password",
          "title": "Github Token",
          "type": "string",
          "writeOnly": true
        },
        "github_user": {
          "title": "Github User",
          "type": "string"
        }
      },
      "required": [
        "github_token",
        "github_user"
      ],
      "title": "IdentityConfig",
      "type": "object"
    },
    "LLMConfig": {
      "description": "LLM backend configuration.",
      "properties": {
        "provider": {
          "title": "Provider",
          "type": "string"
        },
        "model": {
          "title": "Model",
          "type": "string"
        },
        "api_key": {
          "anyOf": [
            {
              "format": "password",
              "type": "string",
              "writeOnly": true
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Api Key"
        }
      },
      "required": [
        "provider",
        "model"
      ],
      "title": "LLMConfig",
      "type": "object"
    },
    "PollingConfig": {
      "description": "GitHub polling configuration.",
      "properties": {
        "interval_seconds": {
          "default": 60,
          "title": "Interval Seconds",
          "type": "integer"
        }
      },
      "title": "PollingConfig",
      "type": "object"
    },
    "QueueConfig": {
      "description": "Task queue configuration.",
      "properties": {
        "db_path": {
          "anyOf": [
            {
              "format": "path",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Db Path"
        },
        "claim_timeout_seconds": {
          "default": 300,
          "title": "Claim Timeout Seconds",
          "type": "integer"
        },
        "max_retries": {
          "default": 3,
          "title": "Max Retries",
          "type": "integer"
        },
        "drain_interval_seconds": {
          "default": 10,
          "title": "Drain Interval Seconds",
          "type": "integer"
        },
        "requeue_interval_seconds": {
          "default": 60,
          "title": "Requeue Interval Seconds",
          "type": "integer"
        }
      },
      "title": "QueueConfig",
      "type": "object"
    },
    "RepoConfig": {
      "description": "Configuration for a single repository.",
      "properties": {
        "owner": {
          "title": "Owner",
          "type": "string"
        },
        "name": {
          "title": "Name",
          "type": "string"
        },
        "agents": {
          "default": [],
          "items": {
            "$ref": "#/$defs/AgentAssignment"
          },
          "title": "Agents",
          "type": "array"
        }
      },
      "required": [
        "owner",
        "name"
      ],
      "title": "RepoConfig",
      "type": "object"
    }
  },
  "description": "Top-level Night Brownie runtime configuration.",
  "properties": {
    "identity": {
      "$ref": "#/$defs/IdentityConfig"
    },
    "llm": {
      "$ref": "#/$defs/LLMConfig"
    },
    "polling": {
      "$ref": "#/$defs/PollingConfig",
      "default": {
        "interval_seconds": 60
      }
    },
    "queue": {
      "$ref": "#/$defs/QueueConfig",
      "default": {
        "db_path": null,
        "claim_timeout_seconds": 300,
        "max_retries": 3,
        "drain_interval_seconds": 10,
        "requeue_interval_seconds": 60
      }
    },
    "repos": {
      "default": [],
      "items": {
        "$ref": "#/$defs/RepoConfig"
      },
      "title": "Repos",
      "type": "array"
    }
  },
  "required": [
    "identity",
    "llm"
  ],
  "title": "NightBrownieConfig",
  "type": "object"
}

Fields:

Validators:

  • _check_required

identity pydantic-field

identity: IdentityConfig

Bot GitHub identity.

llm pydantic-field

llm: LLMConfig

LLM backend configuration.

polling pydantic-field

polling: PollingConfig

GitHub polling settings.

queue pydantic-field

queue: QueueConfig

Task queue settings.

repos pydantic-field

repos: list[RepoConfig] = []

Repositories to monitor.

PollingConfig pydantic-model

Bases: BaseModel

GitHub polling configuration.

Parameters:

  • interval_seconds (int, default: 60 ) –

    How often to poll GitHub for new events (in seconds).

Show JSON schema:
{
  "description": "GitHub polling configuration.",
  "properties": {
    "interval_seconds": {
      "default": 60,
      "title": "Interval Seconds",
      "type": "integer"
    }
  },
  "title": "PollingConfig",
  "type": "object"
}

Fields:

interval_seconds pydantic-field

interval_seconds: int = 60

How often to poll GitHub for new events (in seconds).

QueueConfig pydantic-model

Bases: BaseModel

Task queue configuration.

Parameters:

  • db_path (Path | None, default: None ) –

    Path to the SQLite queue database; defaults to ~/.night-brownie/queue.db at runtime.

  • claim_timeout_seconds (int, default: 300 ) –

    Seconds before an uncompleted claimed task is re-enqueued.

  • max_retries (int, default: 3 ) –

    Maximum number of times a task is re-enqueued before being marked failed.

  • drain_interval_seconds (int, default: 10 ) –

    How often (seconds) the harness drains completed tasks from the queue.

  • requeue_interval_seconds (int, default: 60 ) –

    How often (seconds) the harness checks for stale claimed tasks to re-enqueue.

Show JSON schema:
{
  "description": "Task queue configuration.",
  "properties": {
    "db_path": {
      "anyOf": [
        {
          "format": "path",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Db Path"
    },
    "claim_timeout_seconds": {
      "default": 300,
      "title": "Claim Timeout Seconds",
      "type": "integer"
    },
    "max_retries": {
      "default": 3,
      "title": "Max Retries",
      "type": "integer"
    },
    "drain_interval_seconds": {
      "default": 10,
      "title": "Drain Interval Seconds",
      "type": "integer"
    },
    "requeue_interval_seconds": {
      "default": 60,
      "title": "Requeue Interval Seconds",
      "type": "integer"
    }
  },
  "title": "QueueConfig",
  "type": "object"
}

Fields:

claim_timeout_seconds pydantic-field

claim_timeout_seconds: int = 300

Seconds before an uncompleted claimed task is re-enqueued.

db_path pydantic-field

db_path: Path | None = None

Path to the SQLite queue database; defaults to ~/.night-brownie/queue.db at runtime.

drain_interval_seconds pydantic-field

drain_interval_seconds: int = 10

How often (seconds) the harness drains completed tasks from the queue.

max_retries pydantic-field

max_retries: int = 3

Maximum number of times a task is re-enqueued before being marked failed.

requeue_interval_seconds pydantic-field

requeue_interval_seconds: int = 60

How often (seconds) the harness checks for stale claimed tasks to re-enqueue.

RepoConfig pydantic-model

Bases: BaseModel

Configuration for a single repository.

Parameters:

  • owner (str) –

    Repository owner (user or organization).

  • name (str) –

    Repository name.

  • agents (list[AgentAssignment], default: [] ) –

    Agents assigned to this repository.

Show JSON schema:
{
  "$defs": {
    "AgentAssignment": {
      "description": "A single agent assigned to a repository.",
      "properties": {
        "type": {
          "title": "Type",
          "type": "string"
        },
        "config": {
          "additionalProperties": true,
          "default": {},
          "title": "Config",
          "type": "object"
        },
        "allow_close": {
          "default": false,
          "title": "Allow Close",
          "type": "boolean"
        }
      },
      "required": [
        "type"
      ],
      "title": "AgentAssignment",
      "type": "object"
    }
  },
  "description": "Configuration for a single repository.",
  "properties": {
    "owner": {
      "title": "Owner",
      "type": "string"
    },
    "name": {
      "title": "Name",
      "type": "string"
    },
    "agents": {
      "default": [],
      "items": {
        "$ref": "#/$defs/AgentAssignment"
      },
      "title": "Agents",
      "type": "array"
    }
  },
  "required": [
    "owner",
    "name"
  ],
  "title": "RepoConfig",
  "type": "object"
}

Fields:

agents pydantic-field

agents: list[AgentAssignment] = []

Agents assigned to this repository.

name pydantic-field

name: str

Repository name.

owner pydantic-field

owner: str

Repository owner (user or organization).

load_config

load_config(path: Path | str) -> NightBrownieConfig

Load and validate a Night Brownie YAML configuration file.

Resolves ${VAR} environment variable references before validation. Fails fast with a ConfigError if the file is missing, the YAML is malformed, a required field is absent, or a referenced environment variable is not set.

Parameters:

  • path (Path | str) –

    Path to the YAML configuration file.

Returns:

Raises:

  • ConfigError

    If anything goes wrong during loading or validation.