Agent
Routes GitHub events (repo + event_type) to configured agent URLs.
Classes:
-
RouteTarget–The resolved destination for a routed event.
-
Router–Maps GitHub events to agent URLs based on the Night Brownie config.
-
RoutingError–Raised when a repo is not found in the Night Brownie config.
RouteTarget
dataclass
¶
RouteTarget(url: str, agent_assignment: AgentAssignment)
The resolved destination for a routed event.
Attributes:
Parameters:
-
url(str) – -
agent_assignment(AgentAssignment) –
Router
¶
Router(config: NightBrownieConfig)
Maps GitHub events to agent URLs based on the Night Brownie config.
Initialized once at startup with the parsed config. The container
lifecycle manager calls register_url after each agent container
starts so that dynamically assigned ports are used at dispatch time.
Parameters:
-
config(NightBrownieConfig) –Validated
night_brownie.config.NightBrownieConfig.
Methods:
-
register_url–Register a runtime URL for
agent_type. -
route–Return the
RouteTargetforevent_typeinrepo, orNone.
register_url
¶
Register a runtime URL for agent_type.
Overrides any url value from the YAML config. Called by the
container lifecycle manager after a container is started.
Parameters:
-
agent_type(str) –Agent type identifier (e.g.
"issue-triage"). -
url(str) –Base URL of the running container (e.g.
"http://localhost:9001").
route
¶
route(event_type: str, repo: str) -> RouteTarget | None
Return the RouteTarget for event_type in repo, or None.
Parameters:
-
event_type(str) –GitHub event type string (e.g.
"issue.triage"). -
repo(str) –Repository in
owner/repoformat.
Returns:
-
RouteTarget | None–A
RouteTargetwhen a matching agent with a known URL is found, orNone -
RouteTarget | None–when no agent handles this event type.
Raises:
-
RoutingError–When
repois not present in the config.
RoutingError
¶
Bases: Exception
Raised when a repo is not found in the Night Brownie config.