~ portfolio

Satvik Sawhney

software engineer

loading000%
case studypublished

FarmWise.

Multi-agent assistant for 126M Indian farmers · Gemini + Vertex AI

Agriculture in India is the largest underserved AI market in the world. The bottleneck isn't model quality — it's that the user might be reading the question in Punjabi on a 2G connection.
farmwise · gemini · multilingual6 languages
अगले हफ्ते क्या उगाना चाहिए?
Punjab · 28°C · light rain expected
Recommended · soybean · maize · pulses
01the problem

India has 126 million smallholder farmers. Their information bottleneck isn't lack of expertise — it's lack of localized, multilingual, real-time guidance. A monolingual English chatbot is useless. A model that doesn't know it's raining in Bathinda right now gives stale crop advice. A solution that ignores the wholesale price of soybean in the nearest mandi tells the farmer to grow the wrong thing. The problem is integration: language, location, weather, market, and crop science all need to be in the same answer.

02the approach

I built FarmWise as a multi-agent system on Vertex AI / Gemini. A router classifies intent and locale (Hindi / Punjabi / Tamil / Telugu / Marathi / English). Specialists handle weather (OpenWeather), crop recommendation (RAG over agronomy literature), market prices, and pest identification. The user's location enters via Google Maps API, propagates through the agent graph, and shapes every retrieved chunk. The whole stack runs on Google Cloud Run from a Docker image with a YAML service spec — Firestore as the conversational + user-data store.

03decisions i made

The choices that mattered, with the reasoning at the time.

  1. Language-aware system prompts, not post-hoc translation

    Translating a finished English response into Punjabi loses idiom and agricultural vocabulary that only exists in the source language. Each specialist agent has a per-locale system prompt; outputs come out in the user's language natively.

    decision · 01
  2. Location as first-class state

    Geo-context isn't a side-channel — it's part of the agent state object. Every retrieval call filters by region, every weather call hits the user's coordinates, every crop recommendation cross-references local agronomy. The 'who is the user' question is always answered before 'what is the answer'.

    decision · 02
  3. Cloud Run + Firestore, not a custom infra build

    For a capstone with no infra team, Cloud Run handles autoscaling and zero-ops deployment. Firestore is overkill for conversation history but pairs with Google Auth out-of-the-box and means I don't run a database in production. The whole stack is one `gcloud run deploy` command.

    decision · 03
04the key insight

One code surface that captures the structural decision.

farmwise/agents/router.pypython
from google import genai
from google.genai.types import GenerateContentConfig
from dataclasses import dataclass

@dataclass
class FarmQuery:
    text: str
    locale: str            # "hi-IN", "pa-IN", "ta-IN", "te-IN", "mr-IN", "en-IN"
    location: GeoPoint     # from Google Maps API
    season: Season

def route(q: FarmQuery, client: genai.Client) -> AgentResponse:
    """Multi-agent router on Vertex AI Gemini — picks specialist + locale."""
    cfg = GenerateContentConfig(
        temperature=0.2,
        response_mime_type="application/json",
        system_instruction=load_prompt("router", q.locale),
    )
    plan = client.models.generate_content(model="gemini-2.5-flash",
                                          contents=q.text, config=cfg).parsed
    specialist = SPECIALISTS[plan.agent]        # weather | crop | market | pest
    weather    = openweather.fetch(q.location)
    return specialist.respond(q, weather, locale=q.locale)
05what happened

Capstone delivered for Google's Generative AI Intensive Course. Writeup published on Medium April 2025. Multi-agent assistant with 6-language support; full integration of Gemini + Vertex AI + Google Maps + Firestore + OpenWeather + Cloud Run.

target users
126M+
languages supported
6
Google services used
Gemini · Vertex · Maps · Firestore · Cloud Run
06what i’d do differently

Voice interface is the obvious next step — text input over 2G is a UX failure for the target user. Whisper or Gemini's audio modality would close that gap. I'd also expand the agronomy corpus from public PDFs to ICRISAT and IARI primary sources for genuine accuracy gains.

appendixarchitecture
  • Gemini API + Vertex AI for multi-agent reasoning
  • Firestore as the conversational + user-data store
  • Google Maps API for location-aware crop / weather context
  • OpenWeather API for current and forecast weather
  • Python dataclasses for typed structured outputs to the UI
  • Deployed on Google Cloud Run (Docker image + service YAML)
stack
Gemini APIVertex AIGoogle MapsFirestoreCloud RunRAG
FarmWise — Satvik Sawhney