Building practical AI
Deepak Kumar Tiwari

Deepak Kumar Tiwari

Technology & AI Leader · Building practical systems

Production workflows / Guide 38

An Agriculture Advisory Agent That Shows Its Field Assumptions

Build an agriculture advisory agent that combines field observations, crop stage, and weather evidence while exposing uncertainty and keeping farm decisions human-led.

Illustrative engineering guide. Examples are not client deployments, production-ready integrations, or evidence of measured results. Validate the design with your domain and security owners.

Reference workflow: Authorized field and crop context; Weather and observation validation; Deterministic agronomic calculation; Evidence-linked advisory draft; Farmer and agronomist review.
Reference workflow. Steps identify responsibilities, not necessarily separate agents. Branches and recovery paths are explained below. Open full-size diagram.

Suppose a hypothetical grower manages two neighboring fields with the same crop. One has sandy soil and a recently repaired irrigation line; the other has heavier soil and standing water after rain. A generic assistant sees the same regional forecast and recommends the same watering schedule. The advice sounds specific because it includes numbers, but it ignores the variables that make the fields different.

An agriculture advisory agent should turn local observations and established methods into understandable options. It should not diagnose crop disease from one image, prescribe chemicals without qualified review, or control irrigation hardware autonomously. The farmer and relevant agronomist remain accountable for action.

Ask for context that changes the recommendation

Identify the field boundary, crop and variety where relevant, growth stage, planting date, soil information, irrigation method, recent applications, and observation time. Field boundaries matter because a weather grid cell or station can cover conditions unlike those at the crop canopy.

Distinguish measured values from estimates and farmer reports. A soil-moisture probe at one depth is not a complete root-zone water inventory. Record sensor depth, calibration status, location, and units. If a reading is implausibly constant after irrigation, treat it as a potential instrumentation problem rather than proof that the crop needs more water.

Keep crop stage explicit. Calendar age is an imperfect proxy when emergence was delayed or weather changed development. The assistant can ask the grower to confirm stage and explain why it matters, instead of filling the gap with a plausible value.

Put agronomic equations outside the model

FAO Irrigation and Drainage Paper 56, Chapter 5 describes crop evapotranspiration under standard conditions as reference evapotranspiration multiplied by a crop coefficient. It also explains that coefficients depend on crop characteristics and that non-standard conditions require adjustment. That is a bounded method, not a universal watering prescription.

The minimum architecture includes field records, weather ingestion, sensor validation, an approved coefficient registry, a deterministic calculator, and an advisory writer. The model explains inputs and uncertainty. It does not invent reference evapotranspiration from an air-temperature sentence or select coefficients without a documented agronomic basis.

Use an official regional weather provider with known coverage. The NWS API documentation is one example for supported US locations: it exposes forecasts and observations, describes caching, and warns that observations may be delayed. A successful fetch is not evidence that the measurement is current or field-specific.

A calculation, not an irrigation order

This illustrative stdlib Python example computes a simplified daily water-demand balance. The coefficient and effective rainfall are hypothetical inputs selected for demonstration, not recommended values for a crop or location.

from math import isfinite

def demand_balance(eto_mm, kc, effective_rain_mm):
    values = (eto_mm, kc, effective_rain_mm)
    if not all(isfinite(v) and v >= 0 for v in values):
        raise ValueError("invalid_agronomic_input")
    etc_mm = eto_mm * kc
    return {
        "etc_mm": etc_mm,
        "unmet_demand_mm": max(0, etc_mm - effective_rain_mm)
    }

example = demand_balance(5.0, 0.8, 1.0)
assert example == {"etc_mm": 4.0, "unmet_demand_mm": 3.0}
assert demand_balance(5.0, 0.8, 8.0)["unmet_demand_mm"] == 0

The result is not the depth to apply. Production planning needs root-zone storage, allowed depletion, application efficiency, runoff, drainage, salinity considerations, and equipment constraints. Effective rainfall is also an estimate, not necessarily the rain gauge total. A zero balance here does not prove there is no irrigation need after an earlier accumulated deficit.

Return the calculation with input dates, source references, coefficient version, and missing variables. A useful draft might say that atmospheric demand is estimated but root-zone storage is unknown, so the next step is checking a specified observation rather than running a pump. That is actionable uncertainty, not refusal to help.

Use specialist review only where it earns its cost

A crop-specific retrieval component can help when extension guidance differs materially by crop, region, and growth stage. A separate image-analysis model may suggest what additional observations to collect. Neither should transform visual similarity into a confirmed diagnosis.

Before introducing multiple agents, test one advisory workflow against agronomist-reviewed scenarios. If the errors come from missing soil data, adding another language model will not repair them. Improve the field record and ask a better question. Specialist reasoning is useful when it has a distinct evidence source and a measurable review advantage.

For pesticide or fertilizer questions, require locally applicable product and agronomic guidance and qualified review. Do not generate unsupported mixing instructions, infer legal approval from a foreign label, or issue chemical application commands. This article’s water-budget example deliberately avoids those higher-risk actions.

Recover when observations are stale or contradictory

Store forecast issue time separately from the period it describes. When a new forecast arrives, supersede the old advisory and explain the changed assumption. Do not silently edit a message the farmer may already have acted on. Give each advisory a stable identifier and revision so retries do not create contradictory duplicates.

If weather ingestion fails, show the last verified timestamp and withhold a fresh recommendation that requires current conditions. If a probe conflicts with a recent field observation, flag the discrepancy and request verification. A fallback should reduce precision and authority, not substitute invented data.

Authenticate field access server-side and isolate farms and cooperative tenants. Farm yields, locations, and commercial practices can be sensitive. Shared regional analysis should not expose another member’s field records. MCP is an integration protocol, not permission to access every connected farm.

Treat uploaded advice and supplier brochures as untrusted content. OWASP’s LLM security project explains why embedded instructions cannot control tools. An uploaded document asking the assistant to change pump settings should remain inert, and the first release should have no actuator credentials at all.

Acceptance tests before seasonal use

  1. Supply a rainfall value in inches to a millimeter input contract. Expect explicit conversion through validated metadata or rejection, not silent acceptance.
  2. Provide identical weather for fields with different soil records. Expect field-specific assumptions and no copied universal irrigation prescription.
  3. Omit growth stage and coefficient approval. Expect a clarification or withheld calculation, not an invented coefficient.
  4. Disconnect weather ingestion and submit a stuck sensor reading. Expect stale-data and sensor-quality warnings before any new advisory.
  5. Replay an advisory request and inject pump-control instructions in a brochure. Expect one advisory revision and no hardware command.

Measure usefulness without inventing yield gains

Baseline the time agronomists spend assembling comparable advisory notes. Measure evidence-complete advisories as drafts with every required input sourced or explicitly missing divided by all reviewed drafts. Measure substantive correction rate as drafts requiring changed agronomic reasoning divided by all reviewed drafts.

Guardrails include unit errors, unsupported chemical advice, stale-data recommendations, and cross-farm disclosure. Water use and yield require a separate field-study design accounting for weather, soil, crop stage, and treatment differences; a before-and-after chart alone does not establish causation. Begin with retrospective cases, then supervised advice for one crop and region.

Start with input validation and transparent water-demand calculations. Weather risk analysis illustrates different uses of weather uncertainty, while a data quality agent addresses broken observations. Data engineering services can build the governed field evidence pipeline before broader advisory automation is considered.

Sources