Multi-agent crop advisory for smallholder farmers: weather + mandi prices + agronomy rules, orchestrated by Claude or served over MCP. Zero-key offline demo.
# AgroSage
**Multi-agent crop advisory system for smallholder farmers.**
Ask a free-form question — *"Should I irrigate my cotton this week?"*, *"When should I sell my wheat?"* — and an LLM orchestrator delegates to specialist tools (weather, mandi prices, agronomy rules), then returns a short, actionable advisory. Optionally in the farmer's own language.
```
Farmer question + farm context
|
v
An LLM decides which tools to call. Either:
- the built-in orchestrator (agrosage[llm], Anthropic SDK)
- or your own MCP client (agrosage[mcp], Claude Desktop / Code)
|
|-- get_weather -> Open-Meteo (free, no key)
|-- get_mandi_prices -> data.gov.in Agmarknet (free key)
`-- get_agronomy_hints -> deterministic rule engine
|
v
Advisory: headline + 3-6 actions + reasoning
```
The rule engine also runs on its own with no LLM and no keys at all (`--no-llm`).
## Try it in 30 seconds (no API keys)
Needs Python 3.12+.
```bash
pip install -e .
agrosage advise --crop cotton --location "Rajkot, Gujarat" --offline --no-llm
agrosage weather --location "Rajkot" --offline
agrosage prices --commodity Cotton --offline
```
Offline mode uses deterministic demo data, so you can see the full pipeline instantly. Drop `--offline` to use live data: weather works with **no key at all** (Open-Meteo), mandi prices need a free key from data.gov.in set as `DATA_GOV_IN_API_KEY`.
Every command takes `--json` for scripting, which prints the raw dataclass:
```bash
agrosage prices --commodity Cotton --offline --json | jq '.trend'
agrosage advise --crop cotton --location "Rajkot" --offline --no-llm --json | jq '.actions'
```
## Full agentic mode
```bash
pip install -e ".[llm]"
export ANTHROPIC_API_KEY=sk-ant-...
agrosage advise --crop cotton --location "Rajkot, Gujarat" \
--stage flowering --language gu \
--question "Rain is coming, should I spray or irrigate this week?"
```
The orchestrator decides which tools to call, grounds every claim in tool outputs, and answers in the req …