Inspiration

In Uganda's Wakiso District, a maize farmer sells her harvest for UGX 700 per kilogram. Ten kilometers away in Kampala, a buyer pays UGX 1,200 for the same grain. That 42% gap isn't a market inefficiency it's theft by information asymmetry, and it repeats itself every single harvest across 3.5 million smallholder farming households in Uganda alone.

We built AgroMarket AI because we live in this context. We've watched farmers make planting decisions based on tradition rather than data, lose produce to post-harvest rot because they couldn't find buyers fast enough, and sell at exploitative prices because they had no way to compare alternatives. The technology to fix this has existed for years. What was missing was someone building it specifically for African agriculture.

What it does

AgroMarket AI is an intelligent agricultural marketplace powered by five specialized Google Gemini agents that work together to serve smallholder farmers across the entire crop lifecycle:

  • Market Intelligence Agent— Provides real-time and predicted crop prices across Ugandan markets, identifies price trends, and tells farmers the optimal time and place to sell.
  • Buyer Matching Agent — Matches farmers with verified buyers ranked by price offered, proximity, and reliability score. Eliminates the need to depend on a single local trader.
  • Farm Advisory Agent— Answers crop management questions, recommends planting schedules based on location and season, and provides pest and disease guidance in plain language.
  • Financial Planning Agent — Tracks farm income and expenses, generates monthly profit/loss reports, and provides budgeting advice farmers can actually act on.
  • Logistics Agent — Suggests transportation options (bodaboda, shared truck, bus cargo), estimates costs, and optimizes routes from farm to market.

Farmers interact with all five agents through a single conversational interface — typing or speaking their questions in English or Luganda — and get practical, actionable responses in under two seconds.

How we built it

The system is built entirely on Google Cloud infrastructure:

Backend: FastAPI running on Cloud Run receives all user requests and routes them to a Vertex AI Agent Builder orchestrator. The orchestrator classifies intent and dispatches to the appropriate specialized agent or chains multiple agents for complex queries like "What should I plant next season and where can I sell it?" (which chains Farm Advisory → Market Intel → Financial Planning in sequence).

AI Layer: Each agent is powered by Gemini 1.5 Flash with custom system prompts, specialized tool definitions, and access to Uganda-specific data sources including market price feeds and agricultural calendars. We used Vertex AI's concurrent tool-calling to parallelize agent chains and keep latency below 2 seconds.

Data: Firestore stores farmer profiles, crop listings, buyer registrations, market prices, and transaction records with real-time sync. Firebase Authentication handles SMS OTP login critical for farmers who don't have email addresses. Cloud Storage holds crop images and market reports.

Frontend: Next.js 14 with Tailwind CSS, deployed on Vercel. Designed mobile-first for 360px screens with large tap targets, high contrast for sunlight readability, and offline capability via Firestore's offline SDK and service workers. We integrated Web Speech API for voice input to reduce literacy barriers

Market Data: Uganda's crop prices aren't available via public API. We built a Gemini-powered extraction pipeline that processes Uganda Commodity Exchange PDF reports and structures them into Firestore turning unstructured documents into queryable real-time data.

Challenges we faced

Agent coordination without redundancy. Getting five agents to share context without each one making duplicate API calls required careful orchestrator prompt engineering and explicit state-passing between agent tool calls. We went through four iterations of the orchestration layer before latency and accuracy were both acceptable.

Uganda-specific data scarcity. Most agricultural AI tools are trained on global or Western datasets. Getting meaningful price predictions for Ugandan crops required building our own data pipeline from local sources, including the Uganda Commodity Exchange and district-level extension officer reports.

Low-connectivity performance. The platform must work on 2G connections on budget Android phones. Every frontend decision , lazy loading, Firestore offline caching, text-first design, image compression was driven by this constraint. First meaningful paint is under 1.2 seconds on a simulated 2G connection.

Multilingual support. Luganda doesn't have robust NLP tooling. We approached this pragmatically: English responses with Luganda key terms, culturally appropriate phrasing reviewed by native speakers, and a voice input pipeline that handles common Ugandan English accent patterns.

What we learned

Building for a specific, underserved community forces a level of design discipline that building for a generic user never does. Every technical decision had to pass a single test: will a farmer in Wakiso actually use this? That filter eliminated a lot of complexity and made the product better.

We also learned that multi-agent architectures are genuinely powerful but only when each agent has a clear, narrow responsibility and the orchestration layer is designed thoughtfully. The temptation to build one "super-agent" is real, but the results are worse for users.

What's next

AgroMarket AI is built to grow. Immediate next steps include USSD support for feature phone users (no smartphone required), mobile money payment settlement via MTN MoMo and Airtel Money, satellite crop monitoring via Google Earth Engine for yield prediction, and expansion to Kenya and Tanzania markets. The long-term vision is a pan-African agricultural intelligence platform that gives every smallholder farmer the same data advantages that large commercial operations take for granted.

Built With

Share this project:

Updates