AWS Builder Center
From Cloud to Crop: Building Kisan Mausam, an AI-Powered Farming Assistant on AWS

From Cloud to Crop: Building Kisan Mausam, an AI-Powered Farming Assistant on AWS

How I built Kisan Mausam, a Hindi-first agricultural weather and crop-advisory platform using Flutter, FastAPI, AWS EC2, real-time weather data, and grounded AI. Explore the architecture, multi-horizon weather risk engine, offline-resilient design, and lessons from building technology for Indian farmers.

From Cloud to Crop: Building Kisan Mausam, an AI-Powered Farming Assistant on AWS

1. Introduction: Technology That Reaches Beyond the Screen

What if a farmer could do more than check tomorrow's weather? What if they could understand an approaching weather hazard, receive practical crop guidance in their own language, and make better-informed decisions—even when their internet connection is unreliable?
That question inspired Kisan Mausam (किसान मौसम), a Hindi-first, Android-first agricultural weather intelligence and crop-advisory platform designed around the real challenges faced by Indian farmers.
Agriculture depends heavily on weather, yet forecasts alone do not always tell farmers what action to take. A temperature prediction is useful; understanding how it may affect a crop, when a risk might occur, and what precautions to consider is even more valuable.
Kisan Mausam brings weather forecasting, climate-risk analysis, crop recommendations, AI-powered conversations, and alerts into one application.
In this article, I'll walk through the architecture, the technology choices, the engineering challenges, and the lessons behind the project.

2. The Problem: Weather Information Is Not the Same as Actionable Advice

Farmers need information that is timely, understandable, and relevant to their specific conditions.
Several challenges shaped the design of Kisan Mausam:
  • Unpredictable weather: Heavy rainfall, heat waves, frost, hailstorms, and dry spells can affect agricultural decisions.
  • Different planning horizons: Farmers need to understand immediate threats as well as risks developing over the coming weeks.
  • Language barriers: Complex weather terminology can be difficult to act upon, particularly when information is not available in a farmer's preferred language.
  • Connectivity constraints: A mobile application should remain useful when a rural internet connection is intermittent.
  • Generic recommendations: Crop advice becomes more relevant when soil type, irrigation, terrain, crop stage, and the local weather outlook are considered together.
The core engineering question became:
How can we turn complex meteorological data into timely, understandable, and practical agricultural guidance?

3. The Solution: Kisan Mausam

Kisan Mausam is designed as more than a conventional weather application. It connects forecasts and agricultural context to risk assessment and farmer-friendly guidance.
Its main capabilities include:
A. Weather intelligence
The application retrieves hourly and daily forecasts, precipitation information, soil-related metrics, and seasonal outlooks through meteorological data services.
B. Three-horizon weather risk analysis
Instead of treating every forecast as equally certain, the backend organizes risk assessment into three planning horizons:
  • Horizon 1 — Days 1–3: Near-term hazards where timely warnings and immediate precautions matter most.
  • Horizon 2 — Days 4–10: Medium-range trends, including rainfall deficits or surpluses and forecast uncertainty.
  • Horizon 3 — Days 10–46: Longer-range seasonal outlooks informed by forecast anomalies and ENSO climate conditions.
The risk engine uses configured thresholds aligned with relevant India Meteorological Department (IMD) warning criteria. These outputs are intended to support decisions, not replace official warnings or local agricultural expertise.
C. AI Krishi Sahayak
Farmers can ask questions through text or voice in Hindi or English. The AI advisory pipeline incorporates available weather, soil-moisture, crop, and hazard context, with ICAR-oriented safety guardrails, to produce more context-aware responses.
D. Crop recommendations
A deterministic scoring algorithm ranks suitable crops using factors such as season, soil type, terrain, irrigation, and the 30-day rainfall outlook. The system includes seed data covering 30 Indian crops.
E. Alerts and accessibility
The application supports local notifications and configured push/SMS alert pathways. Voice input, spoken responses, localized text, and a high-contrast interface help make the experience more accessible.

4. Architecture: Combining Mobile, Cloud, and Scientific Data

The architecture follows a resilient hybrid client-cloud approach.
The mobile application can communicate with a cloud backend, while selected weather and AI fallback paths and locally cached information help it continue operating when the backend is unreachable.
The main components are:

Flutter mobile application

Flutter provides the Android-first user experience, including the weather dashboard, crop recommendations, voice assistant, localization, alerts, and farm profile management.
The application separates screens and widgets from service logic. Dedicated services handle API communication, location, voice, notifications, storage, and application updates.

FastAPI backend on AWS EC2

The backend is built with Python FastAPI and deployed on AWS EC2 using Docker-based infrastructure.
Nginx acts as the reverse proxy, while Uvicorn serves the asynchronous application. REST endpoints organize operations for authentication, farm registration, weather, risk evaluation, AI advice, and crop recommendations.

Data and persistence

SQLAlchemy 2.0 with asynchronous database access supports the persistence layer. The project accommodates SQLite for local or edge use and PostgreSQL for deployments that require it.
On the mobile side, cached weather and risk snapshots, preferences, and other selected data are stored locally to improve resilience.

External intelligence providers

Kisan Mausam integrates several non-AWS services:
  • Open-Meteo for forecast, ensemble, soil, and seasonal weather data.
  • NOAA Climate Prediction Center data for ENSO-related information.
  • Google Gemini 2.0 Flash for grounded AI-assisted advice.
  • Firebase Cloud Messaging, MSG91, and SMTP for configured notification channels.
This separation matters: AWS provides the application's cloud hosting foundation, while specialized external services provide meteorological data, AI inference, and communication capabilities.

5. The Interesting Part: Designing for Multiple Time Horizons

One of the most important architectural decisions was to avoid collapsing every weather risk into a single forecast or warning.
Different time windows serve different purposes.
A hazard expected within the next three days calls for a different response from a possible rainfall anomaly several weeks away. Near-term alerts can support immediate precautions, whereas longer-range outlooks are better suited to planning and monitoring.
The risk engine therefore evaluates three horizons using different inputs and confidence expectations.
For near-term risks, configured rules evaluate factors such as rainfall, maximum and minimum temperatures, hailstorm indicators, and wind gusts. The medium-range horizon considers cumulative rainfall patterns and ensemble spread. The seasonal horizon combines rainfall and temperature anomalies with ENSO conditions.
This architecture also separates risk assessment from communication. Once a risk is evaluated, the system can format localized messages and dispatch configured alerts through supported channels.
The broader lesson: an agricultural advisory system should communicate not just what might happen, but also the relevant time horizon and uncertainty.

6. Making AI More Useful Through Grounding

Generative AI can make agricultural information easier to access, but an answer that sounds convincing is not necessarily an answer that fits the farmer's situation.
Kisan Mausam's AI pipeline therefore supplies contextual information to the advisory service.
The flow is:
  1. A farmer asks a question by text or voice.
  1. The backend retrieves relevant weather, soil, crop, and active-risk context.
  1. The AI service receives the question alongside that context and configured agricultural safety instructions.
  1. The application presents the resulting advisory in the selected language, with optional text-to-speech playback.
The application also provides access to the KVK helpline, 1800-180-1551, for additional agricultural support.
Grounding is not a guarantee that every AI response will be correct. Weather data can be uncertain, and generated recommendations need appropriate validation. The goal is to make the assistant more context-aware while preserving sensible safeguards and pathways to human expertise.

7. Resilience: What Happens When the Connection Fails?

For a rural-facing application, connectivity is an architectural concern—not merely a user-interface detail.
Kisan Mausam combines three approaches:
  • Local caching: Selected weather and risk information remains available on the device.
  • Direct fallback paths: When the backend is unreachable, the application can use supported direct weather and AI paths.
  • Modular services: Networking, location, voice, alerts, and storage are handled separately, making the system easier to maintain and improve.
These mechanisms improve resilience, but they do not make the entire application fully offline. Fresh forecasts, remote AI responses, and message delivery still depend on the availability of the relevant network and service.
Being explicit about this distinction is important. A reliable system should communicate the freshness and limitations of its information rather than imply that live data is always available.

8. Deployment, Security, and Maintainability

The deployment uses Docker-based services on AWS EC2, with Nginx in front of the FastAPI application. The project also includes configuration for environment-based settings, database connectivity, and external service credentials.
The authentication flow supports phone-based OTP verification, session tokens, and granular consent settings. The application includes account-deletion functionality and controls for selected data and notification preferences.
These features are particularly important when an application handles location, farm details, and personal contact information.
The project also includes frontend test suites and backend tests covering areas such as authentication, consent, risk evaluation, AI grounding, and crop recommendations.
A key lesson here is that building an AI-powered application involves more than connecting a model to an API. It also requires thoughtful data handling, error management, testing, deployment, and clear operational boundaries.

9. What I Learned

Building Kisan Mausam reinforced several lessons that apply to real-world cloud projects:
Start with the user, not the technology. The purpose of the platform is to help farmers interpret information and make better-informed decisions—not to demonstrate the largest possible technology stack.
Treat resilience as a feature. Local caching and fallback paths are essential design considerations when the target environment has unreliable connectivity.
Use AI where it adds value. Deterministic rules are appropriate for configured risk thresholds and crop-ranking logic, while generative AI can make contextual information easier to explore conversationally.
Separate components clearly. Keeping the mobile application, backend, risk engine, data providers, and notification services modular makes the system easier to test and evolve.
Be honest about uncertainty. Weather forecasts and AI-generated advice have limitations. A useful system communicates those limitations and encourages appropriate verification.

10. What's Next?

There are several promising directions for future development:
  • Evaluate warning accuracy and false-alarm rates against historical observations.
  • Conduct field testing with farmers and agricultural experts.
  • Improve offline access to previously downloaded guidance and essential reference material.
  • Add monitoring for API latency, service failures, and alert delivery.
  • Evaluate the system's accessibility and usefulness across different regions, languages, and farming practices.
  • Explore managed AWS services where they provide measurable benefits in reliability, operations, or scalability.
Any expansion should be guided by measured needs and actual deployment requirements rather than by adding cloud services for their own sake.

Conclusion: Building Technology Around Real Needs

Kisan Mausam brings together a Flutter mobile application, a FastAPI backend hosted on AWS EC2, meteorological data, a multi-horizon risk engine, crop recommendations, and grounded AI assistance.
The most valuable part of the project is not any single API or framework. It is the attempt to connect these components into a system designed around a real-world constraint: farmers need information they can understand and act upon, even when conditions and connectivity are less than ideal.
For me, this project represents an important principle of cloud engineering: the best architecture is not the one with the most services, but the one that reliably solves the right problem.
I built Kisan Mausam with that principle in mind, and I see it as a foundation for further testing, learning, and improvement.
If you're building an AWS-powered application for a real-world problem, I'd love to hear how you're approaching reliability, responsible AI, and the gap between technical capability and practical impact.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article