my tomato leaves have brown spots
Esta página ainda não foi traduzida. É exibida em inglês.
Agronomist API
The API and SDK let organisations build DeepLeaf infrastructure into their own services. OpenAI-compatible: set model to agronomist, send a stable farmer id. Same id, same chat.
Quick start
curl https://<host>/v1/chat/completions \
-H "Authorization: Bearer $DEEPLEAF_API_KEY" \
-H "X-Farmer-Id: your-farmer-12345" \
-H "Content-Type: application/json" \
-d '{"model": "agronomist",
"messages": [{"role": "user", "content": "my tomato leaves have brown spots"}]}'Brown rings with a yellow halo, lower canopy first. Field is day 41, 18 mm of rain in three days.
Consistent with early blight. Need registered products before naming any.
- Input
{"hours": 72}- Output
- 18 mm rain over 3 days. Dry 06:00 to 12:00 tomorrow, wind 5 to 8 km/h.
Likely early blight (Alternaria solani). Remove the lowest leaves today and spray tomorrow 06:00 to 10:00 with a product on the national register.
Diagnose a photo
curl https://<host>/v1/chat/completions \
-H "Authorization: Bearer $DEEPLEAF_API_KEY" \
-H "X-Farmer-Id: your-farmer-12345" \
-d '{"model": "agronomist",
"messages": [{"role": "user", "content": [
{"type": "text", "text": "what is wrong with this plant?"},
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,..."}}]}]}'
What is wrong with this plant?

Early blightFungus
Alternaria solaniVery likelyNext actionRemove the lowest affected leaves today. Spray tomorrow between 06:00 and 10:00.
- confidence
- 91%
- path
- photo → leaf lesions → field history
This looks like early blight, most likely from the wet spell. Tomorrow morning is a good window to spray.
Ask for a spray window
curl https://<host>/v1/chat/completions \
-H "Authorization: Bearer $DEEPLEAF_API_KEY" \
-H "X-Farmer-Id: your-farmer-12345" \
-d '{"model": "agronomist",
"messages": [{"role": "user", "content": "when can I spray this week?"}]}'When can I spray the tomatoes this week?
Best window tomorrow 06:00 to 10:00. Rain likely from 14:00.
- Wind
- 5 to 8 km/h until 10:00
- Rain
- 40% from 14:00, 6 mm
- Delta T
- 3.1 °C at 08:00
- Tue 13Good06:00–10:00
- Wed 14AvoidRain
- Thu 15Fair07:00–09:00
Spray tomorrow morning. Wednesday is out because of the rain.
What you get
- Stable farmer id
- Send X-Farmer-Id or the user field. Same id, same farmer, same fields, same memory.
- SDKs
- React SDK for embedding, Python SDK for servers.
- Embed tokens
- Short-lived tokens for browsers. API keys never reach a browser.
- WhatsApp relay
- Keep your own number and bot; relay messages to Agronomist.
- Voice calls
- POST /v1/calls starts a real-time call for a farmer.
- Webhooks
- Field briefings and events, signed with HMAC (X-Agronomist-Signature) and carrying an idempotency key.
- Versioned docs
- Open /v1/openapi.json; Deprecation and Sunset headers before any meaning change.
- Playground
- Try requests against a sandbox farmer before writing code.
SDKs
The React SDK embeds the Agronomist chat and voice in your app. The Python SDK wraps this API for servers and WhatsApp bots, with the farmer id as a first-class argument. Both are shared with partners ahead of their public npm and PyPI release.
Agronomist SDKsVerify a webhook
import hmac, hashlib
def verify(secret: bytes, body: bytes, header: str) -> bool:
expected = "sha256=" + hmac.new(secret, body, hashlib.sha256).hexdigest()
return hmac.compare_digest(expected, header) # X-Agronomist-Signature- Scout zone 3DueLow vigour, 0.4 ha
- Spray windowGood06:00–10:00
- IrrigationSkip today, 18 mm fell
Add spray to the calendar
Tue 13 Oct06:00–10:00Nothing is written until you confirm.
Security
Keys are scoped to an organisation and stay on your servers. Image URLs are not fetched by the API; send images inline. Report issues to trust@deepleaf.org.