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:
-
AgentAssignment–A single agent assigned to a repository.
-
ConfigError–Raised when config loading or validation fails.
-
IdentityConfig–Bot GitHub identity configuration.
-
LLMConfig–LLM backend configuration.
-
NightBrownieConfig–Top-level Night Brownie runtime configuration.
-
PollingConfig–GitHub polling configuration.
-
QueueConfig–Task queue configuration.
-
RepoConfig–Configuration for a single repository.
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:
-
type(str) -
config(dict[str, Any]) -
allow_close(bool)
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(SecretStr) -
github_user(str)
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:
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:
-
identity(IdentityConfig) -
llm(LLMConfig) -
polling(PollingConfig) -
queue(QueueConfig) -
repos(list[RepoConfig])
Validators:
-
_check_required
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:
Fields:
-
interval_seconds(int)
interval_seconds
pydantic-field
¶
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.dbat 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:
-
db_path(Path | None) -
claim_timeout_seconds(int) -
max_retries(int) -
drain_interval_seconds(int) -
requeue_interval_seconds(int)
claim_timeout_seconds
pydantic-field
¶
Seconds before an uncompleted claimed task is re-enqueued.
db_path
pydantic-field
¶
Path to the SQLite queue database; defaults to ~/.night-brownie/queue.db at runtime.
drain_interval_seconds
pydantic-field
¶
How often (seconds) the harness drains completed tasks from the queue.
max_retries
pydantic-field
¶
Maximum number of times a task is re-enqueued before being marked failed.
requeue_interval_seconds
pydantic-field
¶
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:
-
owner(str) -
name(str) -
agents(list[AgentAssignment])
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:
-
NightBrownieConfig–A validated
NightBrownieConfiginstance.
Raises:
-
ConfigError–If anything goes wrong during loading or validation.