Inspiration

India has more than 100 million smallholder farms. When a crop shows disease, the farmer has a few days to act, and the advice available is usually generic, out of date, or comes from the shop selling the pesticide. A good decision needs three things at once: what the disease is, whether treatment is worth its cost against the crop's market price, and whether rain will wash the spray away. Extension officers combine these, but there are far too few of them.

What it does

A farmer uploads a photo of the affected plant and asks a question, typed or spoken, in one of nine Indian languages. KisanAgent:

  1. Diagnoses the problem from the photo, with a confidence level and the visible symptoms.
  2. Researches current treatment guidance, local mandi prices for that crop, and the weather forecast for the farmer's location.
  3. Writes a short, step-by-step plan in the farmer's language: what to do today (with active ingredient, dose per litre and safety guidance), whether it is worth the cost, when to spray given the forecast, and when to call an expert.

Every price, forecast and recommendation is cited. If no price or forecast is found, the plan says so instead of making one up.

How we built it

The agent is a four-stage pipeline. Each stage is sent to the model that suits it, and the interface shows which model handled which stage and how long it took:

Stage Model
Diagnose the photo NVIDIA Nemotron 3.5 Super VL
Understand the question and plan searches NVIDIA Nemotron 3 Nano
Research treatment, prices and weather in parallel Tavily Search API
Reason over everything and write the plan (streamed) NVIDIA Nemotron 3 Ultra

All three Nemotron models are served by Nebius Token Factory through one OpenAI-compatible endpoint, so routing between models is just a change of model name. The quick structured intake step runs on Nano because it's fast and cheap. The final decision, which weighs severity, cost, price and rain against each other, goes to Ultra.

The backend is FastAPI and streams progress and advice to the browser as server-sent events. The frontend is plain HTML, CSS and JavaScript with no build step, and uses browser speech recognition for voice input. The pipeline keeps going when something fails: if the photo can't be read it continues from the question alone, if intake output is malformed it falls back to fixed queries, and if one search fails the others are still used. 24 tests cover every fallback path using in-memory fakes. The app is deployed on Hugging Face Spaces.

Challenges we ran into

  • Reasoning models and token budgets. Nemotron 3.5 Super VL reasons before it answers, and our first diagnosis responses were cut off mid-JSON. We raised the token budget and strip reasoning tags from the output, including tags split across streamed chunks.
  • Keeping the advice honest. Early plans quoted prices for the wrong crop. We tightened the prompt so prices and forecasts must come from the research notes, must be cited, and must be for the farmer's own crop.
  • Specific diagnoses. Generic answers like "fungal disease" aren't actionable, so the vision prompt asks for the specific condition, for example "Early blight".
  • Free hosting. Getting a FastAPI app running on a free Hugging Face Space meant working within the ZeroGPU runtime, even though all inference happens on Token Factory.

Accomplishments that we're proud of

  • A full consultation (photo diagnosis, three live web searches and a cited plan in Hindi) completes in about 20 to 30 seconds.
  • Model routing is visible: judges and users can see exactly which Nemotron model did what, and how long it took.
  • The agent says "I don't know" instead of inventing a market price.
  • The code is cleanly layered: the agent logic has no HTTP or vendor code, so the same pipeline could feed a WhatsApp bot unchanged.

What we learned

  • Sending each step to the right model matters more than using the largest model everywhere. Nano handles intake in a second or two, and Ultra's reasoning is saved for the one step that needs it.
  • Reasoning models need different handling: larger token budgets, and output cleaning that copes with streaming.
  • For advice people will act on, citations and explicit "not found" answers matter as much as model quality.

What's next for KisanAgent

  • A WhatsApp and IVR (phone call) channel, since that's where farmers already are.
  • Grounding in official sources: government agriculture advisories, Agmarknet mandi prices and IMD district forecasts.
  • A review mode for Krishi Vigyan Kendra extension officers, so one officer can check many AI-drafted plans.
  • Offline-tolerant photo capture for low-connectivity villages.

"Try it out" links

Built With

  • css3
  • fastapi
  • html5
  • hugging-face-spaces
  • javascript
  • nebius-token-factory
  • nemotron-3-nano
  • nemotron-3-ultra
  • nemotron-3.5-super-vl
  • nvidia-nemotron
  • openai-sdk
  • pytest
  • python
  • server-sent-events
  • tavily
  • uv
  • web-speech-api
Share this project:

Updates

Submission history