dnd_strategy
Analyze port congestion and dwell distributions to recommend optimal free days and expected demurrage/detention costs.
Instructions
Optimize the DEMURRAGE & DETENTION free-time strategy for a destination — beyond the simple D&D line: how many FREE DAYS should you negotiate, and what is the EXPECTED D&D cost of accepting fewer, given how long the box will actually DWELL at this (possibly congested) port? It reads the destination port's CONGESTION on your ship date and builds a DWELL DISTRIBUTION (mean + the right tail that a busy port fattens), then for a ladder of candidate free-day grants computes the PROBABILITY of breaching free time (incurring any D&D), the EXPECTED chargeable days, the EXPECTED D&D cost (on the destination region's tiered, escalating per-day schedule — US West-Coast steep, North-Europe gentler) and the p90 bad-case cost. It finds the marginal value of each extra free day and recommends a free-day TARGET — 'in this congested port the dwell tail is fat, so the default 4-5 free days carries $X expected D&D; negotiate 7+'. Demurrage (box sits FULL in the terminal) and detention (box held OUTSIDE past the empty-return grace) are modeled together as combined free time. Pass a carrier to refine the default grant, or your own mean dwell if you know your unpack speed. Modeled from industry-typical regional free days + a congestion-driven dwell distribution — NOT a carrier's filed free-time tariff (regla 7). PREMIUM: pay per call with x402 (USDC on Base) or set a prepaid key (FREIGHT_PULSE_KEY). Same UN/LOCODE port normalization as get_spot_rate.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| origin_port | Yes | Origin port (city, UN/LOCODE, or 'City, Country'). | |
| dest_port | Yes | Destination port — its congestion drives the dwell distribution and the regional D&D schedule. | |
| container_type | No | Container size '20ft'/'40ft'/'40HC' (drives the per-day D&D rate). Optional; defaults to '40ft'. | |
| ship_date | No | Intended ship date (ISO 'YYYY-MM-DD'). The destination congestion (peak windows, disruptions) is evaluated for THIS date. Optional; defaults to today. | |
| carrier | No | Optional carrier — refines the default free-day grant (mega lines often grant a touch more). | |
| mean_dwell_days | No | Override the modeled mean dwell (days) with your own unpack/return speed. Optional. | |
| min_free_days | No | Lowest free-day grant to evaluate (default 3). | |
| max_free_days | No | Highest free-day grant to evaluate (default 10 or default+4). |