Inspiration

Inspiration

Freight dispatch is one of the highest-stakes, most time-sensitive workflows in logistics operations. A wrong vehicle assignment or a missed delivery window can cost thousands of dollars and break SLAs. I wanted to show that a Gemini-powered agent can own that entire decision loop autonomously — no human clicks required.

What it does

The AI Logistics Operations Agent takes a shipment request (origin, destination, cargo weight, priority, delivery window) and autonomously dispatches it through 5 sequential tool calls:

  1. analyze_shipment — computes route distance and minimum transit feasibility
  2. check_fleet_availability — finds vehicles with sufficient capacity
  3. evaluate_delivery_constraints — checks whether the best vehicle meets the SLA
  4. generate_dispatch_order — creates the official dispatch record with decision ID
  5. log_to_persistent_store — persists the decision to Google Cloud Firestore

After all 5 steps, the agent writes a 3–5 sentence operations summary for the ops team. No human is in the loop — the agent decides, acts, and logs autonomously.

How I built it

  • Gemini 3.6 Flash via the Google GenAI SDK (google-generativeai) with enable_automatic_function_calling=True — Gemini drives the entire tool-call sequence
  • Google Cloud Firestore (Native mode) for persistent decision logging, with an automatic local JSON fallback when credentials aren't configured
  • Streamlit for the browser UI — shipment form on the left, live agent activity log + dispatch metrics on the right
  • The 5 tool functions are plain Python callables passed directly to GenerativeModel(tools=[...]) — the GenAI SDK handles the function-call loop

Challenges I ran into

  • Getting Gemini to strictly respect the 5-step tool order required careful system prompt engineering ("MUST call IN EXACT ORDER" with numbered steps)
  • Handling API quota limits gracefully — implemented a demo-mode fallback that runs all 5 tools directly when the Gemini API is unavailable, so the agent workflow is always demonstrable
  • Firestore credential configuration across local dev and Streamlit Cloud deployment required a robust optional-import pattern with silent fallback

Accomplishments I'm proud of

This is a genuine TASKMASTER agent — not a chatbot wrapper. Every run produces a real operational action: a timestamped dispatch order with a unique decision ID, persisted to cloud storage. The agent's reasoning is fully visible through the live activity log in the UI.

What I learned

  • How Google's automatic function calling differs from manual tool-use loops — the SDK manages the chat turn cycle internally, which simplifies multi-step agentic workflows dramatically
  • Firestore Native mode's document-based model maps cleanly onto audit-log patterns for agentic decision records

What's next

  • Real fleet data via a Firestore-backed fleet registry
  • Multi-agent coordination: a separate route-optimization agent feeding into dispatch
  • Webhook notifications to drivers on assignment ## What it does

How I built it

Challenges I ran into

Accomplishments that I'm proud of

What I learned

What's next for AI Logistics Operations Agent

Built With

  • cloud
  • firestore
  • gemini
  • genai
  • googlecloudfirespace
  • python
  • sdk
  • streamlit
Share this project:

Updates