Integrate a real-time traffic data provider (such as a mapping API with live traffic) to retrieve current estimated travel times between the restaurant and each pending delivery address
Maintain a live driver state table tracking each courier's current location, active order count, and estimated completion time of their current drop
When a new order arrives, score each available courier by computing the sum of: estimated drive time from courier location to restaurant plus estimated drive time from restaurant to customer address
Assign the order to the courier with the lowest composite ETA score, subject to maximum concurrent order constraints per courier
Push the assignment to the courier's mobile app via a push notification or delivery platform driver API, including the pickup time target derived from kitchen prep time estimates
Monitor actual delivery times against ETA predictions and feed back residuals to recalibrate the traffic-adjusted scoring model
Known gotchas
Real-time traffic APIs introduce per-query costs that scale with fleet size and order volume; cache traffic estimates with short TTLs rather than querying per assignment decision
Courier location data from mobile apps may have GPS accuracy errors of 10-50 meters in urban environments; apply a location smoothing filter before using coordinates for distance calculations
Multi-order stacking (assigning two deliveries to one courier) significantly complicates ETA calculations because the optimal pickup sequence is a small traveling-salesman problem; cap stacking at two orders and enumerate both permutations
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp