feat: ExpressDispatchAgent — tenant-scoped batch assignment + sequencing
New agent that owns the DoormileExpress dispatch flow. The normal B2C booking flow is untouched; this handles express orders that a console operator has let accumulate batch by batch, then dispatches in one go. Triggered by express.dispatch_requested (the console's manual dispatch action). For the tenant it: reads the pending bookings and the tenant's available riders (Go internal API), distributes them across riders by proximity + load with a radius guard, asks routes.workolik.com (Valhalla) for each rider's stop order, and writes the assignments back through the Go internal API — which stays the single writer of assignment state; the agent only decides who and what order. - agents/express_dispatch_agent.py: the agent (mirrors DispatchAgent's NATS binding; pure consumer of the backend-owned EXPRESS stream). - config/system_config.py: ROUTE_OPTIMIZER_URL. - registered under JARVIS in main.py / agents package. - tests: distribution (radius, load, cap, no-GPS fallback) and sequencing (single-stop, remap, optimizer-down, unknown-id) — deterministic, no network. Gated off by default on the backend (EXPRESS_AGENT_ENABLED); EXPRESS_AGENT_ AUTONOMOUS=false runs it observe-only (logs the plan, writes nothing). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2
main.py
2
main.py
@@ -37,6 +37,7 @@ from agents.hub_agent import HubAgent
|
||||
from agents.customer_agent import CustomerAgent
|
||||
from agents.exception_agent import ExceptionAgent
|
||||
from agents.route_optimizer_agent import RouteOptimizerAgent
|
||||
from agents.express_dispatch_agent import ExpressDispatchAgent
|
||||
|
||||
|
||||
class LogiFlowAI:
|
||||
@@ -61,6 +62,7 @@ class LogiFlowAI:
|
||||
self.agents["CUSTOMER_AGENT"] = CustomerAgent()
|
||||
self.agents["EXCEPTION_AGENT"] = ExceptionAgent()
|
||||
self.agents["ROUTE_OPTIMIZER"] = RouteOptimizerAgent()
|
||||
self.agents["EXPRESS_DISPATCH_AGENT"] = ExpressDispatchAgent()
|
||||
|
||||
for agent in self.agents.values():
|
||||
self.master_agent.register_sub_agent(agent)
|
||||
|
||||
Reference in New Issue
Block a user