Server
Foreman FastAPI application and dispatch loop.
| CLASS | DESCRIPTION |
|---|---|
Dispatcher |
Orchestrates the harness dispatch loop: fetch memory → build task → enqueue → nudge agent. |
Classes¶
Dispatcher
¶
Dispatcher(config: ForemanConfig, memory: MemoryStore, task_queue: TaskQueue)
Orchestrates the harness dispatch loop: fetch memory → build task → enqueue → nudge agent.
One :class:Dispatcher instance is created at startup and shared across
the entire process. Tasks are enqueued in the durable :class:~foreman.queue.TaskQueue
before the agent is nudged; results are drained asynchronously by the background loop.
| PARAMETER | DESCRIPTION |
|---|---|
config
|
Validated :class:
TYPE:
|
memory
|
Open :class:
TYPE:
|
task_queue
|
Durable :class:
TYPE:
|
| METHOD | DESCRIPTION |
|---|---|
dispatch |
Enqueue event for the agent described by route_target and nudge it. |
Functions¶
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 :class:~foreman.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.
| PARAMETER | DESCRIPTION |
|---|---|
event
|
Poller event dict with |
route_target
|
Resolved :class:
TYPE:
|