DEV Community

Sahil Kumar Singh
Sahil Kumar Singh

Posted on

# 🏏 Captain Cool β€” The Multi-Agent IPL Match Strategist (Built on Google Gemini)

πŸš€ Project Overview
Cricket is a game of fine margins managed in high-pressure dugouts. "Captain Cool" is an advanced agentic AI system engineered on the official Google Gemini stack. It acts as an autonomous virtual IPL captain that processes real-time match context parameters and executes an internal multi-turn reasoning loop between analytical modules to output structural tactical maneuvers explained in authentic cricket slang.
πŸ—οΈ Multi-Agent Architecture
The system utilizes three distinct, named Gemini-powered agents, avoiding a single prompt wearing multiple hats:

  1. πŸ“Š Performance Analyst (gemini-2.5-flash): Clinical and entirely data-driven. It triggers a native Gemini tool (calculate_match_metrics) via function calling to evaluate Live Run Rates and Win Probabilities before proposing a base tactical strategy.
  2. 🀬 Devil's Advocate (gemini-2.5-flash): The cynical dugout assistant coach. Its system instruction forces it to pick apart the Analyst's data-backed layout by introducing real ground parameters like boundary dimensions and dew factors.
  3. πŸ† Captain Cool (gemini-2.5-pro): The ultimate Dhoni-Rohit synthesis module. It analyzes the conflicting arguments in the dugout and delivers a definitive, vernacular command.

πŸ› οΈ The Power Tech Stack

Gemini API: Invoked natively using the new unified google-genai engine infrastructure.
Google AI Studio: Used for foundational system prompt layout, alignment tuning, and playground verification.
Google Antigravity: The complete codebase environment structure was initialized, written, and engineered within Google's agentic IDE ecosystem.
Gemini Tool Use: Direct orchestration of native Function Calling to automate algorithmic calculations.

πŸ”— Google AI Studio Prototype Link

🌐 **CLICK HERE TO VIEW MY GOOGLE AI STUDIO WORKSPACE

🏟️ Live Evaluation Match Scenario Trace

Match Config Input: Innings: 2 (Chasing) | Venue: M. Chinnaswamy Stadium, Bengaluru

Score: 142/4 in 14.2 overs | Target: 185 | Pitch:Turning & Spin-friendly | Dew:Yes

Multi-Turn Output Sequence:

Data Analyst:"Tool outputs confirm Chasing Win Prob at 68.2%. The track has clear turn. I recommend bringing on the leg-spinner to throttle the run flow immediately."
Devil's Advocate:"Absolutely disastrous call! It's Chinnaswamy and the dew is heavy. The ball is too wet to spin or grip, and any loose delivery will fly over the tiny boundaries. Spin is suicide here."
Captain Cool:"Dugout chatter stop karo. Numbers apni jagah hain par heavy dew me ball wrap nahi hogi. Spin ko hold karenge. Bring back the premium seamer, hit the deck with heavy lengths, and take the pace off. Settle down boys, let's execute!"
massive thanks to @GDGCloudPune

πŸ“ Open Source Code Matrix

Link to Public GitHub Repository

thankyou #GDGCloudPune

Top comments (0)