Inspiration

Kenya loses over 5,000 hectares of forest annually to fires and illegal logging. Forest rangers don't just need a forest monitoring platform, they need a platform that proactively protects forests. A fire doesn't happen in an instant; it evolves from rising temperatures, dropping humidity, and wind patterns over days. Current systems are reactive historians, notifying us only after the damage is visible from space.

The goal was to build an autonomous agent that reasons about environmental context over 48+ hour cycles, distinguishes between a harmless campfire and a spreading wildfire, and communicates fluently in both English and Swahili to coordinate local response teams.

What It Does

Sauti Porini (Swahili for “Voice of the Wilderness”) is a marathon agent that operates as an autonomous forest warden. Unlike traditional systems that trigger on single data points, it maintains a continuous operational loop:

Extended Context Monitoring

It ingests multi-modal data into a single Gemini 3 Pro context window:

  • Real-time weather patterns (ERA5-Land)
  • Satellite fire anomalies (NASA FIRMS)
  • IoT sensor logs

Autonomous State Reasoning

Instead of hard-coded if/else logic, the agent asks Gemini to evaluate risk history. The AI decides whether to transition the zone status:

[ \text{State}(t) = f_{\text{Gemini}}(\text{WeatherHistory}_{t-3...t}, \text{FireEvents}, \text{CurrentState}) ]

Bilingual Crisis Communication

When a threat is validated (e.g., State → ALERT), the agent generates context-aware SMS alerts:

  • English for HQ
  • Swahili for community rangers

Each alert explains why it was sent (e.g., “Rising temperatures correlated with acoustic chainsaw detection”).

Persistent Vigilance

The agent runs indefinitely, maintaining memory of previous checks to detect slow-building threats that instant snapshots would miss.

How We Built It

We built Sauti Porini as a modular, AI-native Python application:

The Brain (Gemini 3 Pro Preview)

We used the gemini-3-pro-preview model as the core reasoning engine. In ai_analyzer.py, we construct a JSON-based prompt feeding the model:

  • The last 3 weather data points
  • Recent fire events

Gemini is tasked with acting as a Forest Ranger Assistant, outputting structured decision data:

  • Status
  • Reasoning
  • Message

The Memory (Supabase)

Supabase (PostgreSQL) stores the World State. The agent:

  • Reads from weather_logs and fire_events
  • Writes decisions to zones and alert_history

The Body (Python & FastAPI)

A persistent loop (main_agent.py) orchestrates the fetch → analyze → act cycle.
A FastAPI backend (api.py) serves data to a dashboard and accepts incoming IoT webhooks.

Data Simulation

For the hackathon, we simulated NASA and ERA5 data streams to demonstrate the agent’s reasoning across scenarios (normal days vs. fire outbreaks).


Challenges We Ran Into

Context vs. Noise

Feeding too much raw data caused analysis paralysis. We learned to curate input history using trends (last 3 data points) instead of raw dumps to enable reliable state transitions.

The “Stateless” Illusion

LLMs are stateless, but Marathon Agents need memory. We solved this by designing the evaluate_risk function to query previous state and reasoning from Supabase before asking Gemini for the next decision creating a synthetic memory chain.

Language Nuance

Direct translations of technical terms (e.g., thermal anomaly) confused local rangers. We prompted Gemini to use colloquial Swahili (e.g., “Hatari ya moto”), which dramatically improved clarity.

Accomplishments We’re Proud Of

AI-Driven Logic Control

We removed traditional control flow logic entirely. Transitions like NORMAL → WATCH are not Python if statements, they’re Gemini 3 decisions. This allows the system to adapt contextually across different forest zones.

Bilingual Accessibility

Swahili is treated as a first-class language, ensuring the technology is accessible to the people actually protecting the forest.

True Autonomy

The agent recovers from API failures, respects rate limits, and resumes exactly where it left off meeting the Marathon Agent requirement for long-running reliability.

What We Learned

Reasoning > Classification

Gemini 3 excels at reasoning about risk (“The temperature is rising rapidly, warn them”) rather than simple classification (“Temperature > 30°C”).

Contextual Latency

“Real-time” isn’t always better. Buffering data into a 3-hour window significantly reduced false positives compared to reacting to every sensor spike.

The Human Element

Adding an explicit Reasoning field to database logs transformed the AI from a black box into a trusted collaborator for forest rangers.

Built With

  • and-alert-history.-external-apis-&-data-sources:-nasa-firms-api:-for-real-time-satellite-fire-anomaly-detection-mapping.-ecmwf-/-era5-land-(via-open-meteo):-for-historical-and-real-time-climate-variables-(temperature
  • era5-land
  • fastapi
  • gemini
  • humidity
  • nasafirms
  • python
  • react
  • supabase
  • zone-state-management
Share this project:

Updates