AI tool-calling agent for mandi price discovery - checks real Agmarknet price data and flags favorable selling windows.
# 📈 MandiMitra
An AI agent that checks real mandi (market) prices and tells a farmer or small trader
whether now looks like a favorable window to sell — instead of them having to track
prices manually or guess based on gut feel.
## What this project is
Small farmers and traders often sell as soon as they harvest, without visibility into
whether prices are currently high, low, or trending in a useful direction — they don't
have time to track multiple markets themselves. **MandiMitra** is an agent that, given a
question like *"Should I sell tomatoes in Guntur this week?"*, decides to look up real
price data, computes a trend summary, and answers with a specific recommendation grounded
in that data — not a guess.
## What it's related to
- **Agentic AI / GenAI portfolio project** — unlike its siblings
AnnadataAI and
VaradaAI, which are RAG systems answering
from static PDFs, MandiMitra is a **tool-calling agent** working with live, structured
data — a deliberately different technique to show range beyond RAG.
- **Domain**: agricultural market price discovery, using India's public Agmarknet dataset
(mandi prices) via data.gov.in.
- **Roadmap**:
- **v1 (this)** — mandi price agent for agricultural commodities, English, single tool
- **v2** — shrimp/aquaculture export price tracking (a second data source + tool),
multi-commodity comparison, price alerts over time (not just point-in-time)
- **v3** — scheduled monitoring with push notifications when a tracked commodity crosses
a favorable threshold, rather than only answering on request
## Flow of the code
**`prices.py`** — the data layer, no LLM involved:
```
fetch_mandi_prices(commodity, state, district)
│
▼
GET
api.data.gov.in... (Agmarknet dataset)
│
▼
raw price records (date, market, min/max/modal price)
│
▼
compute_trend(records)
→ sort by arrival_date, pull modal prices
→ latest_price, avg_price, pct_vs_avg
→ favorable_window = latest price >= 5% above the recent average
```
**`agen …