π "Captain Cool" β The Multi-Agent IPL Match Strategist (Built on Google Gemini)
Cricket is a captainβs game. While data analysts sit in the dugout with spreadsheets, the captain stands under the lights making split-second tactical decisions. Should you bowl a mystery spinner against a left-hander in the dew? When do you pull the trigger on the Impact Player?
To solve this, I built Captain Cool during an intense 3-hour vibe-coding session. Itβs an agentic AI system built entirely on the Google Gemini stack that acts as a virtual IPL captain. Instead of just spitting out a generic recommendation, it forces multiple specialized AI agents into a high-stakes internal debate before committing to the final call.
π The Multi-Agent Architecture
To build a system that genuinely thinks like an elite tactician, a single prompt wrapper won't cut it. Using Google's Agent Development Kit (ADK), Captain Cool decomposes the problem into four distinct, Gemini-powered agents:
π The Stats Guru (Data Analyst): Uses live tools and function calling to pull real-time match context, venue history, and player matchups.
π The Tactical Skipper (The Strategist): Formulates the primary on-field strategy based on the current match state.
π The Devil's Advocate (The Dissenter): Aggressively critiques the Skipperβs plan, pointing out blind spots, pitch variations, and worst-case scenarios.
π The Comms Box (The Explainer): Translates the raw strategic outcome into authentic, colorful cricket commentary.
π The Native Google Tech Stack
This project was built from the ground up using Googleβs premier AI ecosystem:
Gemini API (google-genai Python SDK): Driven by gemini-2.5-pro for deep reasoning during the agent debate and gemini-2.5-flash for rapid stats extraction.
Google Antigravity: Google's agentic IDE. The entire build left autonomous traces, commit histories, and self-healing debug logs right in the .antigravity/ folder.
Agent Development Kit (ADK): Orchestrates the multi-turn reasoning loop and handles state transitions between the disputing agents.
Google AI Studio: Used for rapid prompt prototyping and setting system instructions.
π The Internal Debate Loop in Action
Here is an end-to-end walkthrough of a high-pressure match state processed by the system.
The Input Context
Match State: M. A. Chidambaram Stadium (Chepauk), Innings 2, Over 17.4. Heavy dew.
Batter on Strike: Shivam Dube (Left-handed power hitter).
Bowlers Remaining: Right-arm Leg-Spinner (1 over), Left-Arm Fast-Medium (2 overs).
The Under-the-Hood Agent Argument
π The Stats Guru: Executing fetch_venue_stats(venue="Chepauk", metric="dew_impact")... Live data confirms spin effectiveness drops by 22% after Over 15 due to grip issues. Furthermore, Dube averages 42 against leg-spin but struggles against high-pace short balls.
π The Tactical Skipper: "Let's bring on our Leg-Spinner for the next over. Spin is king at Chepauk; we buy a wicket or choke the runs."
π The Devil's Advocate: "Hold on, Skipper, that's massive gamble. The dew is heavyβthe ball is like a cake of soap right now, meaning the leggie will slip up and bowl full tosses. Plus, Dube absolutely destroys leg-spin. If he gets underneath one, itβs clearing the stadium roof."
π The Tactical Skipper (Revised): "Valid point on the wet seam. Letβs pivot. We'll hold the spin back. Bring in the Left-Arm Fast-Medium bowler. Instruct him to bowl cross-seam, digging it into the deck to target Dube's weakness against the hard, rising delivery."
π The Final Output
The system resolves the debate and outputs three clean, fan-friendly components:
- The Next Decision Action: Deploy the Left-Arm Fast-Medium bowler for the 18th over.
Blueprint: Bowl cross-seam deliveries targeting back-of-a-length, angling away from the left-hander's swinging arc.
The Tactical Reasoning (Cricket-Speak)
"Look, with the dew setting in at Chepauk, throwing the ball to a leggie against a well-set left-handed monster like Dube is absolute suicide. The ball is too slick. Youβve got to take spin out of the equation. We are going with our left-arm quick, pounding the cross-seam into the deck. Make him hit against the wet sheen off a hard length!"What the Dissenting Agent Said
The Vice-Captain strongly pushed to exploit the turning pitch with our premier spinner, but was ultimately overruled due to verified live data showing a massive drop in spin control under heavy night dew.
π Key Takeaways
Building with Google Antigravity and the ADK completely changed how I approach multi-agent workflows. Instead of manually writing complex state machines and parsing messy JSON layers, the Gemini-native framework managed the orchestration implicitly. Passing Python typings directly into the google-genai SDK allowed the model to execute live tool-calling flawlessly.
Top comments (0)