After building a cart and providing a validated destination address, call the merchant's shipping options endpoint or read the options returned during cart/checkout flow; capture carrier, service level, estimated delivery date, and cost for each option.
Apply user-defined preferences as a scoring function: e.g., weight delivery speed vs cost according to a configurable urgency parameter (high urgency = minimize transit days, low urgency = minimize cost).
Filter out shipping options that do not meet hard constraints: minimum required delivery date, prohibited carriers, or options that don't include tracking.
If the cheapest option is within a configurable threshold of the fastest option (e.g., cost difference < $2), prefer the faster option to reduce delivery risk.
Log the selected option and the full set of alternatives with scores so the selection rationale is auditable.
If no shipping option meets constraints (e.g., merchant cannot deliver to the address within the required timeframe), emit a fallback event to try an alternative merchant.
Known gotchas
Estimated delivery dates from merchants are business-day estimates and do not account for carrier delays or peak season surcharges; add buffer when the delivery date is a hard deadline.
Free shipping thresholds can make a higher-quantity order cheaper overall; factor in the order total vs free shipping cutoff before finalizing quantities.
Some merchants show delivery dates only after payment information is entered; if your agent needs delivery estimates earlier in the flow, you may need to use a carrier rate-shopping API with the merchant's warehouse ZIP as the origin.
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