Skip to content
Night Brownie Night Brownie

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:

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:

Methods:

  • register_url

    Register a runtime URL for agent_type.

  • route

    Return the RouteTarget for event_type in repo, or None.

register_url

register_url(agent_type: str, url: str) -> None

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/repo format.

Returns:

  • RouteTarget | None

    A RouteTarget when a matching agent with a known URL is found, or None

  • RouteTarget | None

    when no agent handles this event type.

Raises:

RoutingError

Bases: Exception

Raised when a repo is not found in the Night Brownie config.