Skip to content
Night Brownie Night Brownie

Server

Night Brownie FastAPI application and dispatch loop.

Classes:

  • Dispatcher

    Orchestrates the harness dispatch loop: fetch memory → build task → enqueue → nudge agent.

Dispatcher

Dispatcher(config: NightBrownieConfig, memory: MemoryStore, task_queue: TaskQueue)

Orchestrates the harness dispatch loop: fetch memory → build task → enqueue → nudge agent.

One Dispatcher instance is created at startup and shared across the entire process. Tasks are enqueued in the durable night_brownie.queue.TaskQueue before the agent is nudged; results are drained asynchronously by the background loop.

Parameters:

  • config (NightBrownieConfig) –

    Validated night_brownie.config.NightBrownieConfig.

  • memory (MemoryStore) –

    Open night_brownie.memory.MemoryStore instance.

  • task_queue (TaskQueue) –

    Durable night_brownie.queue.TaskQueue instance.

Methods:

  • dispatch

    Enqueue event for the agent described by route_target and nudge it.

dispatch async

dispatch(event: dict[str, Any], route_target: RouteTarget) -> None

Enqueue event for the agent described by route_target and nudge it.

Sequence: 1. Fetch memory summary for this repo+issue. 2. Build a night_brownie.protocol.TaskMessage. 3. Enqueue the task in the durable queue. 4. Fire-and-forget POST <agent_url>/task nudge with {"task_id": ...}. Network errors are logged and swallowed — the drain loop will retry.

Parameters:

  • event (dict[str, Any]) –

    Poller event dict with repo, issue_number, and payload keys.

  • route_target (RouteTarget) –

    Resolved night_brownie.routers.agent.RouteTarget.