Inspiration

Smallholder farmers lose produce and income to two things they can't control alone: post-harvest spoilage and fragmented, expensive logistics. A single farm can't fill a truck efficiently, and when weather disrupts a harvest, the entire downstream chain — who ships what, when, and at what price — has to be re-planned fast. We wanted to see if a team of cooperating AI agents could absorb that kind of disruption the way a well-run operation would: each part adapting in its own domain, without a central controller barking orders.

What it does

Agent Farm is a multi-agent system that keeps an agricultural supply chain running when a storm hits. Three specialized agents — a Greenhouse, a Transport planner, and a Merchant — coordinate through a shared MongoDB "blackboard." No agent calls another directly; each reads the documents it depends on and writes its own.

When a storm strikes, the disruption cascades through all three:

  • The Greenhouse agent detects degrading conditions, uses Gemini to assess plant health, and republishes a reduced harvest yield.
  • The Transport agent reads the new yields and re-plans cost-optimal delivery routes around blocked roads using a real OR-Tools optimizer.
  • The Merchant agent, watching the blackboard, automatically reallocates the now-scarce supply across competing buyers by priority and applies scarcity pricing.

A unified four-tab interface visualizes the whole cascade in real time, and a Gemini-written situation report reads the entire shared database through the MongoDB MCP server and narrates the chain's health.

How we built it

  • Gemini for agent reasoning, plant-health vision analysis, and the cross-agent situation report
  • Google Cloud / Vertex AI as the model platform, with agents built on the Agent Development Kit
  • MongoDB Atlas as the shared blackboard, accessed through the MongoDB MCP server
  • Google OR-Tools for the vehicle-routing optimization
  • FastAPI services (one per agent) behind a single deployment, with a vanilla HTML5 canvas frontend and server-sent events for live log streaming
  • Deployed on Google Cloud Run

Challenges we ran into

  • Coordinating three independently built agents into one coherent system. The shared-state approach helped, but agreeing on document schemas and getting every service to read and write the same cluster took real care.
  • The integration was harder than any single agent — connection strings, environment configuration across services, and making the cascade fire reliably end to end were where most of our time went.
  • Deploying a multi-service system to the cloud, with the database reachable and the model authentication working in a container rather than locally.

What we learned

  • Coordinating agents through shared state instead of direct calls lets a team build in parallel and compose the pieces into one adaptive system.
  • The right division of labor is to let the LLM reason (which farms to include, how to handle constraints) while a deterministic optimizer does the math — intelligent and reliable.
  • In multi-agent systems, the agents are the easy part; integration and reliable coordination are the real work.

What's next

  • Real sensor and weather feeds in place of the simulated greenhouse
  • Smarter, learned policies for the merchant's allocation and pricing
  • Scaling to more agents and more farms on the same blackboard pattern

Built With

Share this project:

Updates