Recipe: Weather for any location
Two weather packs in Pipeworx, two coverage areas. Picking wrong is the #2 source of agent errors right now (39 failures in a 7-day window from agents calling NOAA with non-US coordinates).
Tools used: noaa.get_forecast, noaa.get_alerts, weather.get_forecast, weather.get_weather.
Calls: 1.
Decision tree
| Where? | Use this pack | Why |
|---|---|---|
| United States (50 states + territories) | noaa | Native NWS source, official alerts, finer-grained forecast |
| Anywhere outside US | weather (Open-Meteo) | Global coverage, aggregated from national met agencies |
| Need active severe-weather alerts | noaa.get_alerts (US only) | NWS is the authoritative US alert source |
| Mixed list of locations | weather for all of them | Simpler than per-location routing |
The shapes of failure
// Wrong: NOAA for Tokyo
noaa.get_forecast({ lat: 35.6762, lon: 139.6503 })
// → {found: false, coverage: 'us-only', hint: "Use the weather pack instead..."}
NOAA’s NWS API only serves US points. The pack now returns a structured {found: false} instead of crashing — but the agent still wastes a call. Just route correctly the first time.
Worked examples
US location with severe weather
// Forecast
noaa.get_forecast({ lat: 37.7749, lon: -122.4194 })
// → 7-period forecast with NWS detailed prose
// Active alerts for the state
noaa.get_alerts({ state: "CA" })
// → tornado warnings, flood watches, etc. with severity and affected areas
Non-US location (Tokyo, London, anywhere)
weather.get_forecast({ location: "Tokyo" })
// or
weather.get_forecast({ latitude: 35.6762, longitude: 139.6503 })
// → 7-day forecast with high/low, precipitation chance
Just current conditions
weather.get_weather({ location: "Denver" })
// → temp, humidity, wind, conditions
Auto-routing pattern
If your agent might receive any global coordinate:
const isUS = lon > -125 && lon < -66 && lat > 24 && lat < 50 // CONUS bbox
// Add Alaska / Hawaii / territories ranges if you want full US coverage
const forecast = isUS
? await noaa.get_forecast({ lat, lon })
: await weather.get_forecast({ latitude: lat, longitude: lon })
Or skip the bbox check entirely and always use weather unless you specifically need NOAA’s US-specific alerts/products. Open-Meteo aggregates NOAA data for US points, so you don’t lose US accuracy.
Citation pattern
Forecast for Tokyo (next 24h) shows highs near 22°C with light rain, per Open-Meteo aggregated from JMA. For US severe weather, follow NWS active alerts.
Caveats
- NOAA hits the gateway 5-min default cache. Forecasts update every few hours, so this is fine. For severe-weather alerts, agents should
Cache-Control: no-cacheif available. - Open-Meteo timezone defaults to UTC. The response includes the location’s timezone — convert client-side when displaying to users.
- Forecast accuracy degrades after day 3. Day 7+ is “directional weather signal,” not a confident prediction. Don’t quote 10-day forecasts as facts.
- No global severe-weather alerts source in Pipeworx today. If you need typhoon/cyclone warnings outside the US, file via
pipeworx_feedback.