Identify the cache key dimensions: origin ZIP, destination ZIP, carrier, service level, package weight bucket, and DIM weight bucket
Set a TTL of no more than 24 hours for domestic rates and 4 hours for international rates, as carrier surcharges and fuel adjustments update frequently
On a rate request, check the cache first; on a cache miss, call the carrier API and store the result with the TTL
Store the raw carrier response alongside the extracted rate so that downstream logic can re-parse if rate structure interpretation changes
Implement a stale-while-revalidate pattern: serve the cached rate immediately and trigger a background refresh if the entry is within a configurable staleness window
Invalidate the cache proactively when a carrier publishes a general rate increase (GRI) or emergency surcharge update
Known gotchas
Caching at too coarse a weight bucket (e.g. 0–10 lbs) can serve rates that are incorrect for specific weights within the bucket; use narrow buckets or exact weights to avoid undercharging customers
Fuel surcharges are updated weekly by most major carriers; a 24-hour TTL that happens to span a surcharge adjustment date will serve stale rates until cache expiry
Carrier sandbox APIs often return fixed or dummy rates that do not reflect real pricing; do not populate production caches from sandbox responses
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