← Back to Directory
🍳

Weather-Aware Commute Planner

Combines weather, maps, and your calendar to give smart commute advice: 'Leave 15 min early, it's raining and traffic is heavy on I-95.'

🤖 00 ↓  |  👤 00
intermediate15 min setup🔄 8 swappable alternatives

🧂 Ingredients

🔌 APIs

check_weather_conditions_for_commute_time

🔄 Alternatives:

Weatherapi Better free tier, more dataVisual Crossing Historical data includedTomorrow Io Minute-by-minute forecasts

get_traffic_aware_route_and_eta

🔄 Alternatives:

Mapbox Better customization, developer-friendlyHere Good for logistics/routingOpenstreetmap Free, open data

find_first_meeting_time

🔄 Alternatives:

Outlook Calendar Microsoft ecosystemCal Com Open-source scheduling

📋 Step-by-Step Build Guide

STEP 1

Check today's calendar for first in-person meeting/event

Check today's calendar for first in-person meeting/event

Fetch today's calendar events using the Google Calendar API.

GET https://www.googleapis.com/calendar/v3/calendars/{calendarId}/events?timeMin={todayStart}&timeMax={todayEnd}&orderBy=startTime&singleEvents=true

For each event, extract: summary (title), start/end time, location, attendees (names + emails), description.
Sort chronologically. Flag any conflicts (overlapping events).
Format each event as: "9:00-10:00 AM | Team Standup | Conference Room B | 5 attendees"

If no events today, return "No events scheduled today."
STEP 2

Get current weather and forecast for commute window

Get current weather and forecast for commute window

Use the OpenWeatherMap API to fetch weather data for the user's location.

GET https://api.openweathermap.org/data/2.5/forecast?q={city}&appid={api_key}&units=imperial

Extract: current temperature, conditions, humidity, wind speed, and rain probability.
Format concisely: "72°F, Partly Cloudy, 45% humidity, 8mph wind, 10% rain"

If the API returns an error, retry once with a 2-second delay. If it fails again, use "Weather data unavailable" as a placeholder and continue with the remaining steps.
STEP 3

Query Google Maps for route with real-time traffic

Query Google Maps for route with real-time traffic

Query Google Maps for route with real-time traffic

Steps:
1. Validate all required inputs are available
2. Execute the operation described above
3. Verify the result meets expected output format
4. Handle errors gracefully — retry transient failures, log and alert on persistent ones
5. Return structured output with status and any relevant data

If any required data is missing, request it from the user before proceeding.
STEP 4

Factor weather into timing (rain = +10 min, snow = +20 min)

Factor weather into timing (rain = +10 min, snow = +20 min)

Factor weather into timing (rain = +10 min, snow = +20 min)

Steps:
1. Validate all required inputs are available
2. Execute the operation described above
3. Verify the result meets expected output format
4. Handle errors gracefully — retry transient failures, log and alert on persistent ones
5. Return structured output with status and any relevant data

If any required data is missing, request it from the user before proceeding.
STEP 5

Calculate when to leave for on-time arrival

Calculate when to leave for on-time arrival

Process the data and calculate the requested metrics.

Steps:
1. Validate input data — check for nulls, out-of-range values, duplicates
2. Apply the calculation/aggregation logic
3. Compare against benchmarks or previous periods if available
4. Format results with appropriate precision (2 decimal places for percentages, whole numbers for counts)

Include: current value, previous value, change (absolute and %), trend direction (↑↓→).
Flag any anomalies: values >2 standard deviations from the mean.

If insufficient data for a reliable calculation, state the minimum needed and return partial results.
STEP 6

Send alert with departure time, route, and weather gear reminder

Send alert with departure time, route, and weather gear reminder

Send a notification to the user via the configured messaging channel.

For Pushover:
POST https://api.pushover.net/1/messages.json
Body: { token: {APP_TOKEN}, user: {USER_KEY}, message: "{notification_text}", title: "{title}", priority: 0 }

For Twilio SMS:
POST https://api.twilio.com/2010-04-01/Accounts/{SID}/Messages
Body: To={phone}, From={twilio_number}, Body={message_text}

Keep the message concise — under 160 characters for SMS, under 500 for push.
Include the most actionable information first.
Log: timestamp, channel, recipient, message preview, delivery status.

🤖 Example Agent Prompt

Fetch today's calendar events using the Google Calendar API.

GET https://www.googleapis.com/calendar/v3/calendars/{calendarId}/events?timeMin={todayStart}&timeMax={todayEnd}&orderBy=startTime&singleEvents=true

For each event, extract: summary (title), start/end time, location, attendees (names + emails), description.
Sort chronologically. Flag any conflicts (overlapping events).
Format each event as: "9:00-10:00 AM | Team Standup | Conference Room B | 5 attendees"

If no events today, return "No events scheduled today."

Copy this prompt into your agent to get started.

🍳 Weather-Aware Commute Planner — PincerAPI Cookbook