Generative AI can produce an answer in seconds.
But when that answer could influence a real-world decision, speed and fluency are not enough.
Imagine asking an AI assistant:
What does current research say about irrigation strategies for drought-stressed tomatoes grown in clay soil, and what additional local information is needed before applying the findings?
A conventional chatbot may return a polished recommendation. It may even sound authoritative.
But a researcher, agronomist, grower, or responsible AI developer should ask harder questions:
Those questions inspired me to build the open-source Gemini Agriculture Research Assistant—an educational reference application that turns a complex question into a transparent, evidence-grounded, and observable research journey.
The project combines:
In this article, I’ll explain the architecture, why each component exists, and the patterns you can reuse when building trustworthy AI agents in other domains.
GitHub repository:
From complex crop questions to transparent, evidence-grounded research.
Gemini Agriculture Research Assistant is an open-source, evidence-grounded crop research and developer-learning system. It demonstrates how Gemini (via the google-genai Interactions API), Google Search Grounding, deterministic Python verification, Google ADK, and OpenTelemetry work together to turn complex agricultural questions into transparent, citation-backed research—while keeping consequential agronomic decisions under human control.
Important
Research Assistant — Not an Autonomous Agronomist: This system helps researchers, extension professionals, educators, and developers investigate agricultural literature. It never prescribes chemical dosages, fertilizer rates, or rigid irrigation schedules, and it never replaces field inspection or local Cooperative Extension advice.
Agricultural questions involve interacting biological, soil-physics, climatic, and economic variables. Single-shot LLM answers often blend peer-reviewed findings with unverified web advice, gloss over cultivar/stage trade-offs, or emit confident schedules without knowing local soil moisture or evapotranspiration ($\text{ET}_o$)…
PyPi Package:
The application does not treat research as one enormous prompt.
Instead, it models research as a sequence of explicit, inspectable stages:
User Question
↓
Research Planning
↓
Query Fan-Out
↓
Google Search Grounding
↓
Source Normalization and Deduplication
↓
Evidence Extraction
↓
Claim Verification
↓
Cited Synthesis
↓
Conversational Follow-Up
This separation matters.
When retrieval, verification, and synthesis are hidden inside one model call, the final prose may look impressive while the underlying process remains impossible to inspect.
In this application, every stage leaves an artifact:
The goal is not simply to generate an answer.
The goal is to build an answer that can show its work.
The application starts with a focused interface where the user can enter a research question, select a preset, provide optional field context, and choose between live and demonstration modes.
The interface supports two execution modes.
Live mode uses Gemini and Google Search grounding to retrieve current public information.
Demo mode uses a reproducible offline evidence fixture and does not require an API key.
This is more important than it may initially appear.
A deterministic mode allows the project to run during:
It also makes the behavior easier to test. A developer can validate the complete user journey without depending on continuously changing search results.
Research questions are rarely atomic.
The tomato irrigation question contains several independent concerns:
The Gemini-powered planner extracts the relevant context and decomposes the original question into focused research tasks.
Instead of hiding this decomposition inside the model, the application exposes it to the user.
A visible plan allows the user to ask:
This is one of the most reusable agent-design patterns:
Make the plan inspectable before asking users to trust the result.
One search query represents only one phrasing of a problem.
A useful research process often needs several targeted searches covering:
The application fans the research plan out into explicit Google Search tasks.
The Query Fan-Out view shows:
This solves an important trust problem:
There are no silent searches.
The user can see what the agent searched for and where retrieval may have missed an important angle.
Query fan-out improves recall, but more search results do not automatically create more truth.
The next step is to preserve source identity and evidence provenance.
Search results are only candidates.
The assistant normalizes and deduplicates the retrieved sources before using them as evidence.
For every source, the application preserves information such as:
There is an important difference between a URL list and an evidence record.
A URL tells us where information came from.
An evidence record also tells us:
This provenance chain is useful far beyond agriculture.
The same pattern can support:
Whenever users must inspect the path from a source to a conclusion, provenance must survive every stage of the pipeline.
The answer composer should not be the only component deciding whether a statement is established.
Before synthesis, the application evaluates candidate claims against the collected evidence.
Each claim receives one of five statuses:
| Status | Meaning |
|---|---|
| Supported | Retrieved evidence directly supports the claim. |
| Partially Supported | Evidence supports only part of the statement or requires qualification. |
| Conflicting | Retrieved sources disagree or describe incompatible conditions. |
| Unknown | Available evidence is insufficient. |
| Suppressed | The claim is withheld from established findings because of evidence-quality or safety rules. |
This gives the final answer a safer vocabulary.
Instead of smoothing over disagreement, the assistant can explicitly state:
That qualification is especially important in agriculture.
Results from one cultivar, climate, irrigation system, market class, growth stage, or soil profile may not transfer directly to another field.
The application is therefore a research-transparency and decision-support tool.
It is not an autonomous agronomist.
Human experts and local field validation remain in control.
After verification, the answer composer produces a synthesis that distinguishes between:
The result is not merely a collection of links.
It connects the research question to:
A confident sentence should never become disconnected from the evidence that produced it.
A static report is useful, but users naturally want to ask follow-up questions:
The Google ADK research agent answers questions against the selected research run.
The agent can use tools to:
This grounding boundary is intentional.
A normal follow-up should not silently detach itself from the evidence already under review or launch unrelated searches without making that behavior visible.
The research agent should know which run, sources, claims, and trace the user is discussing.
The visible response is only the final event in an agentic workflow.
Developers also need to inspect:
Google ADK Dev UI makes this behavior inspectable.
In the screenshot, we can see the agent:
get_selected_run
This is valuable when debugging agent behavior.
If the final response is incomplete, we can ask:
Without this visibility, developers are left debugging only the final text.
“We added observability” can mean many different things.
In this architecture, each component has a distinct responsibility.
| Component | Responsibility | Question it answers |
|---|---|---|
| OpenTelemetry | Instruments the application and exports telemetry | What telemetry does the application produce? |
| Prometheus | Stores and queries time-series metrics | How many runs occurred, how slow were they, and how often did they fail? |
| Tempo | Stores distributed traces and spans | What happened inside this specific run? |
| Grafana | Visualizes metrics and explores traces | How can developers navigate and correlate system behavior? |
This distinction prevents a common source of confusion:
PromQL is used for Prometheus metrics. TraceQL is used for Tempo traces.
OpenTelemetry instruments the application.
It creates telemetry describing important operations such as:
The OpenTelemetry Collector receives this telemetry and routes it to the appropriate backend.
Prometheus answers aggregate operational questions:
Tempo answers questions about an individual execution:
Grafana provides the navigation and visualization layer.
It connects aggregate metrics with individual traces and gives developers a practical place to investigate system behavior.
The Grafana overview dashboard shows the overall health of the research assistant.
The dashboard includes:
This answers the operational question:
Is the research system healthy overall?
But aggregate metrics cannot explain everything.
When one execution is unexpectedly slow or produces an unusual result, we need the trace.
The trace explorer separates different types of activity:
Developers can filter traces by:
Each trace ID opens the full parent-child waterfall in Tempo.
A useful trace should mirror the mental model of the application.
For this project, that means creating spans for:
When a run is slow or degraded, the waterfall can show whether the delay came from:
That is the difference between knowing that an agent failed and knowing where and why it failed.
Observability is not only an infrastructure feature.
For AI agents, observability is part of product trust.
An agentic application is rarely one process.
This project requires:
Installing and configuring all of these components independently would create unnecessary friction for learners and contributors.
Docker Compose turns the architecture into one reproducible environment.
Docker provides:
From a Docker perspective, the lesson is broader than packaging:
Containers make a complex architecture teachable.
The same services and relationships can be reproduced across:
Clone the repository:
git clone https://github.com/hastimal/gemini-agriculture-research-assistant.git
cd gemini-agriculture-research-assistant
Start the deterministic demonstration stack:
./scripts/run_all.sh demo
The script starts the complete environment and prints the available service URLs.
When you are finished:
./scripts/run_all.sh stop
For live Gemini and Google Search grounding, copy the environment example, configure the required Gemini API key, and use the live mode documented in the repository.
You can also install the Python package:
pip install gemini-agriculture-research-assistant
Explore the CLI:
crop-research --help
The most reusable parts of this project are not specific to agriculture.
Users should see how a broad goal becomes smaller tasks.
Hidden decomposition is difficult to evaluate.
Show the executed queries, not only the final citations.
This exposes both research coverage and omissions.
A final sentence should be traceable to:
Final Statement
↓
Verified Claim
↓
Evidence Passage
↓
Normalized Source
↓
Original URL
The component that writes persuasive prose should not be the only component deciding whether a statement is established.
Conflicting, unknown, and partially supported findings should not be hidden.
They are valuable research results.
APIs time out.
Quotas expire.
Models become unavailable.
Schemas change.
A responsible system should display degraded and failed states instead of returning a confident-looking fallback without explanation.
Display run and trace IDs in the application.
A developer should be able to move from an unexpected answer directly to the trace that produced it.
The most interesting question is no longer:
Can an LLM answer this question?
The better questions are:
Can the system show how it planned the work?
Can it identify the evidence behind every important claim?
Can it surface disagreement and uncertainty?
Can users inspect the searches that were executed?
Can developers reproduce, observe, test, and improve the workflow?
Gemini provides the intelligence.
Google ADK provides inspectable orchestration, state, agents, and tools.
Google Search grounding supplies current public evidence.
OpenTelemetry captures the workflow.
Prometheus measures aggregate behavior.
Tempo stores individual traces.
Grafana connects operational health with deep investigation.
Docker makes the complete system reproducible.
Together, these technologies turn a clever AI demo into an engineering system that developers can study, challenge, and extend.
Although this project focuses on agricultural research, the same architecture can be adapted to other evidence-heavy domains:
The domain can change while the core engineering contract remains the same:
Plan transparently. Retrieve explicitly. Verify before synthesis. Preserve provenance. Trace everything. Keep humans in control.
GitHub:
github.com/hastimal/gemini-agriculture-research-assistant
PyPI installation:
pip install gemini-agriculture-research-assistant
CLI:
crop-research --help
If you build on the project, I would love to hear:
I build and teach practical AI-agent systems across Google technologies, Docker, and cloud-native observability.
As a Cloud & AI Expert and an open-source-focused community builder, I believe the next generation of AI education should go beyond model prompts. Developers should learn how to build complete systems that are grounded, observable, reproducible, and responsible.
This project is an educational reference implementation. Its research output should support—not replace—qualified agricultural expertise and local field validation.