WorkflowForgeAI Agent and Workflow Laboratory
WorkflowForgeAgentsghatguard
Home
WorkflowForge · AI Agent and Workflow Laboratory © 2026Built by Shivang GitHub
Agents
Agent

ghatguard

aicreditsgpt-4o-minitemp 0.1max 3000 tokensagents/ghatguardcustom result view

Route-and-time-specific hazard copilot for mountain and monsoon road trips: landslides, storms, snow, fog and live closures where you will be, when you will be there. Try extra inputs {"demo": "monsoon"} for an offline run.

Open in Playground

README

agents/ghatguard/README.md

GhatGuard

Route-and-time-specific hazard intelligence for mountain & monsoon road travel. India-first (Himalaya, Western Ghats, North-East); works anywhere.

"Chandigarh se Manali kal subah 9 baje — safe hai? Kab niklein? Highway khula hai?"

Weather apps forecast a city. Maps know traffic, not landslides. Closure news is scattered across local papers. GhatGuard answers what travellers and operators actually need: what will the road be like where I'll be, when I'll be there, and what should I change? Every claim is backed by model data, a historical record, or a verified source.

CHANGE ROUTE · confidence high
Take route B (NH205, Kataula road, NH3) leaving 04:00: peak risk SEVERE → HIGH, risk-hours 51.4 → 14.6;
it bypasses the landslide near 7 Mile (one-way / partly open).
Ensemble of 4 weather models — P(HIGH+) 100% · P(SEVERE) 100% · agreement 96% (planned start)
- SEVERE on Mandi → Bajaura (km 183–252) around 13:17–16:17: ... known slide zone (4 past landslides within ~3 km)

(offline demo scenario; full outputs in examples/)

Try it

Playground → Single agent → ghatguard.

Evaluation

agents/ghatguard/evaluation · 3 cases · suite ghatguard_scenarios

Offline monsoon and seasonal scenarios: expected decision, a verdict for every leg, and a recommendation that actually lowers the risk.

Cases passed
3/3
Mean score
100%
last 6 runs
decision match
100%
recommendation lowers risk
100%
verdict or clean error
100%

Past runs

standalone runs from the Playground · latest 50
Runs listed
19
Landed
19
completed
Signal lost
0
failed
Shields held
0
blocked by guardrails
  • Landedcompletedeval
You sendWhat happens
Chandigarh to Manali tomorrow 6amlive assessment: routing, terrain, 4-model weather ensemble, news, verdict
Shimla se Kaza parso subah 5 baje, bikeHindi/Hinglish works; the vehicle is read from the text
Extra inputs {"demo": "monsoon"}offline scenario: no network, no keys, no LLM credits; same pipeline
Extra inputs {"demo": "seasonal"}offline trip two months out → climatology-based seasonal outlook
Extra inputs {"vehicle": "suv", "window": [4, 12], "style": "hinglish"}override vehicle, acceptable departure hours, briefing style
Extra inputs {"trip": {"origin": "Dehradun", "destination": "Joshimath", "depart": "2026-10-20T05:00"}}structured trip instead of free text

The run shows the Markdown briefing as the response, the full assessment as structured output, and a result view (viewer.html): the route map coloured by risk at time of passage, NASA slide zones, incidents, the risk profile (plan vs recommendation), departure heatmaps and the step trace.

API: POST /api/v1/agents/ghatguard/runs with {"user_input": "...", "inputs": {...}}.

Keys (all in backend/.env, shared with every agent)

KeyUsed forWithout it
AICREDITS_API_KEYthe LLM steps (platform LLM, gpt-4o-mini): intake parsing, grounded news extraction, the narrativethe rules-based fallbacks answer (still a full verdict)
TAVILY_API_KEY / SERPER_API_KEY / BRAVE_API_KEYlive closure news (first one set leads, the others are failover)no news step; weather, terrain and memory still run
JINA_API_KEYfull article text via Jina Reader (better extraction)snippets only
PUBLIC_API_CONTACTyour email/URL in the User-Agent sent to OpenStreetMap / Open-Meteo (their usage policies ask for it)a placeholder is sent; set it before heavy use

Routing, weather, terrain and places use keyless free APIs (Open-Meteo, OSRM demo, Overpass, Nominatim).

How it works

intake ─┬─ legN.route ─┬─ legN.terrain ─┬─ legN.news ───────┐
        │              │                └─ legN.community ──┤   (legs run concurrently)
        │              └─ legN.weather (4-model ensemble) ──┴─ legN.judge ─┐
        └─ ...                                                             └─ briefing (LLM + FactGuard)
StepJobDataLLM
IntakeEN/HI/Hinglish → validated legs, vehicle, window—optional (rules fallback)
Route scoutproximity-disambiguated places, route options, ~70 samplesOpen-Meteo geocoding, Nominatim, OSRM—
TerrainDEM relief 1 km either side of the road; towns, villages, passesCopernicus DEM via Open-Meteo, Overpass—
Corridor weatherhourly precip/snow/temp/gusts/visibility/WMO codes + 3 days history × 4 models; climatology beyond 14 daysOpen-Meteo forecast / ERA5 archive—
Community intelNASA + verified-report slide-zone prior; incidents remembered from earlier runshazard memory—
News intelgeography-driven queries → extraction → grounding → corridor → freshnessTavily › Serper › Braveoptional (rules fallback)
Risk judgeensemble hazards, stretches, risk-hours, departure × route optimiser, decision policy——
BriefingMarkdown/JSON; narrative behind FactGuard—optional

Decisions: GO · GO_WITH_CAUTION · SHIFT_DEPARTURE · CHANGE_ROUTE · POSTPONE · SEASONAL_OUTLOOK · INSUFFICIENT_DATA, with confidence from lead time, model agreement, terrain and news coverage.

What makes it trustworthy

LayerWhat it is
Time-of-passage risksimulates when you reach each point (vehicle-specific mountain slowdown, breaks) and scores conditions there, then
Probabilistic 4-model ensembleECMWF, GFS, ICON, GEM scored independently; risk-averse consensus (level backed by ≥ 40% of models), P(SEVERE), agreement → confidence
Real susceptibility priorbundled NASA Global Landslide Catalog subset: 1,766 rainfall-triggered landslides in India/Nepal/Bhutan (2007–2016)
Anti-hallucination by constructionnews incidents need a verbatim quote found in the article, a location inside your corridor, and freshness; the LLM narrative is FactGuard-checked (no number it can't trace to the facts). Verdicts never come from an LLM
Departure × route optimiserre-scores every 30-min start over 3 days on every route × every model from data already in memory: zero extra API calls
Reliabilityper-host circuit breakers, search failover, per-step timeouts and a run deadline (120 s); non-critical steps fail soft

On the platform, every LLM call goes through the platform client (providers/llm.py), so it shows up on the run replay with tokens and cost, in Jaeger traces and in Grafana.

Evaluation

  • Platform suite (evaluation/, Run evaluation on this page or POST /api/v1/evaluations/ghatguard/trigger): the offline monsoon and seasonal scenarios through the real pipeline. Metrics: decision_match, verdict_or_clean_error, recommendation_lowers_risk. Costs nothing (no network, no LLM).
  • Backtest of the landslide rule on NASA-catalogued landslide days vs same-place control days with ERA5 rainfall → POD, POFD, FAR, CSI, lift. Needs network; run by hand: docker compose exec backend python -m agents.ghatguard.backtest --state Uttarakhand --limit 120. Thresholds live in risk.py::Thresholds.
  • Tests (tests/, 101, offline): unit, property (Hypothesis: more rain or steeper terrain never lowers risk), a chaos suite (25% of upstream calls failing at random → always a verdict or a clean error), and a scripted-LLM run with planted hallucinations (both caught). pytest agents/ghatguard.

Limits & licensing

  • Risk levels are transparent heuristics, not an official warning service. Point users to IMD district warnings (mausam.imd.gov.in) and state/district traffic advisories.
  • Global models (~9–25 km) under-resolve cloudbursts; the tool flags conditions that favour them.
  • NASA GLC is a media-reported catalogue (2007–2016); absence of records ≠ safe slope. Cite Kirschbaum et al. (2010, 2015).
  • Open-Meteo is free for non-commercial use; buy a plan before charging customers. Respect Overpass/Nominatim usage policies (set PUBLIC_API_CONTACT); the map uses CARTO basemap tiles.
  • Hazard memory is in-memory per worker process: the catalogue prior is always there; incidents verified in a run are remembered until that worker restarts.

Not ported yet

GhatGuard was built as a standalone product. These parts need platform support first and were left out (the original code is in the owner's backup):

  • Trip watches & alerts (re-check a saved trip on a schedule; signed webhooks / Telegram on verdict change): needs persistent tables, an endpoint to create watches and a scheduled job in the worker.
  • Crowd hazard reports with reporter reputation (store.py still has the corroboration logic): needs an endpoint and persistent storage shared by the API and the worker.
  • Persistent hazard memory across restarts: Supabase tables (PostGIS-friendly) instead of in-memory SQLite.

Layout

agent.py      GhatGuardAgent (platform entry: run inputs → pipeline → AgentResult)
workflow.py   async DAG with timeouts          agents/     intake · route_scout · terrain · weather · community · news · judge · briefing
providers/    geocode · routing · weather (ensemble) · osm · search (failover) · llm (platform adapter)
risk.py       hazard engine + ensemble          planner.py  optimiser + decision policy
store.py      hazard memory + crowd logic       report.py   Markdown + JSON
config.py     settings from backend/.env        demo.py     offline world (demo mode + tests)
evaluate.py   backtest harness                  backtest.py backtest CLI (python -m agents.ghatguard.backtest)
evaluation/   platform evaluation suite         viewer.html result view (map, profile, heatmaps)
data/         NASA GLC South Asia subset        tests/      offline test suite
  • monsoon_gorge_storms3 metrics · lowest 100%Replay
    • decision match100%
      Expected
      ["CHANGE_ROUTE","SHIFT_DEPARTURE"]
      Actual
      CHANGE_ROUTE
    • recommendation lowers risk100%
      planned_risk_hours
      51.36
      recommended_risk_hours
      15.24
    • verdict or clean error100%
      legs
      1
      status
      completed
  • monsoon_gorge_storms_by_bike3 metrics · lowest 100%Replay
    • verdict or clean error100%
      legs
      1
      status
      completed
    • recommendation lowers risk100%
      planned_risk_hours
      54.16
      recommended_risk_hours
      20.78
    • decision match100%
      Expected
      ["CHANGE_ROUTE","SHIFT_DEPARTURE","POSTPONE"]
      Actual
      CHANGE_ROUTE
  • seasonal_outlook_beyond_forecast2 metrics · lowest 100%Replay
    • decision match100%
      Expected
      ["SEASONAL_OUTLOOK"]
      Actual
      SEASONAL_OUTLOOK
    • verdict or clean error100%
      legs
      1
      status
      completed

Last run Nov 21, 06:39 PM · a case passes when every metric reaches 90% · open a case for expected vs actual

All suites

Nov 21, 06:39 PM1.2 s0 tok$0.0000
  • Landedcompletedeval
    Nov 21, 06:39 PM2.2 s0 tok$0.0000
  • Landedcompletedeval
    Nov 21, 06:39 PM1.8 s0 tok$0.0000
  • Landedcompletedeval
    Nov 18, 05:35 AM1.1 s0 tok$0.0000
  • Landedcompletedeval
    Nov 18, 05:35 AM1.8 s0 tok$0.0000
  • Landedcompletedeval
    Nov 18, 05:35 AM1.9 s0 tok$0.0000
  • Landedcompletedeval
    Nov 15, 08:41 AM1.1 s0 tok$0.0000
  • Landedcompletedeval
    Nov 15, 08:41 AM1.9 s0 tok$0.0000
  • Landedcompletedeval
    Nov 15, 08:41 AM1.8 s0 tok$0.0000
  • Landedcompletedeval
    Nov 13, 08:56 AM1.2 s0 tok$0.0000
  • Landedcompletedeval
    Nov 13, 08:56 AM1.9 s0 tok$0.0000
  • Landedcompletedeval
    Nov 13, 08:56 AM1.9 s0 tok$0.0000
  • Landedcompletedeval
    Nov 5, 07:05 PM1.2 s0 tok$0.0000
  • Landedcompletedeval
    Nov 5, 07:05 PM1.8 s0 tok$0.0000
  • Landedcompletedeval
    Nov 5, 07:05 PM2.0 s0 tok$0.0000
  • Landedcompletedeval
    Oct 16, 12:18 PM1.1 s0 tok$0.0000
  • Landedcompletedeval
    Oct 16, 12:18 PM1.9 s0 tok$0.0000
  • Landedcompletedeval
    Oct 16, 12:18 PM1.8 s0 tok$0.0000
  • Landedcompleted
    Oct 5, 08:31 PM86.4 s3976 tok$0.0007
  • StatusTrace IDDurationTokensCostStarted
    Landedcompletedevale2b6d100…1.2 s0$0.0000Nov 21, 06:39 PMReplay
    Landedcompletedeval60880291…2.2 s0$0.0000Nov 21, 06:39 PMReplay
    Landedcompletedeval25af670a…1.8 s0$0.0000Nov 21, 06:39 PMReplay
    Landedcompletedevalf2b4a130…1.1 s0$0.0000Nov 18, 05:35 AMReplay
    Landedcompletedevalfc5cef2f…1.8 s0$0.0000Nov 18, 05:35 AMReplay
    Landedcompletedevalf5873207…1.9 s0$0.0000Nov 18, 05:35 AMReplay
    Landedcompletedevalf86220da…1.1 s0$0.0000Nov 15, 08:41 AMReplay
    Landedcompletedevalf485f4b2…1.9 s0$0.0000Nov 15, 08:41 AMReplay
    Landedcompletedevalfef4f379…1.8 s0$0.0000Nov 15, 08:41 AMReplay
    Landedcompletedevalc39d5ca1…1.2 s0$0.0000Nov 13, 08:56 AMReplay
    Landedcompletedeval66780e61…1.9 s0$0.0000Nov 13, 08:56 AMReplay
    Landedcompletedevale7be9747…1.9 s0$0.0000Nov 13, 08:56 AMReplay
    Landedcompletedevalf7da885e…1.2 s0$0.0000Nov 5, 07:05 PMReplay
    Landedcompletedevalf7da885e…1.8 s0$0.0000Nov 5, 07:05 PMReplay
    Landedcompletedevalf7da885e…2.0 s0$0.0000Nov 5, 07:05 PMReplay
    Landedcompletedevalc888f80d…1.1 s0$0.0000Oct 16, 12:18 PMReplay
    Landedcompletedevalc888f80d…1.9 s0$0.0000Oct 16, 12:18 PMReplay
    Landedcompletedevalc888f80d…1.8 s0$0.0000Oct 16, 12:18 PMReplay
    Landedcompletedc845618d…86.4 s3976$0.0007Oct 5, 08:31 PMReplay