Captain Cool AI is a production-ready, futuristic sports-broadcast style dashboard that acts as a digital dugout. It orchestrates 5 specialized AI agents inside a collaborative debate mesh to analyze complex T20 match situations, execute live meteorological tool calls, evaluate counterfactual risks, and propose champion-level tactical decisions with high-fidelity confidence scores.
In high-stakes T20 cricket like the IPL, decision-making is incredibly fast-paced. Coaches and captains are flooded with raw data: matchups, venue humidity, run rates, boundary dimensions, and player history.
However:
- Data alone lacks strategy: Generic raw metrics do not translate into situational dugout wisdom.
- Biased decisions cost matches: Captains make instinctual choices without stress-testing worst-case risks.
- Generic AI is flat: Standard single-agent LLM prompts fail to weigh complex, competing perspectives.
Why it matters: A single tactical error (e.g., bowling a spinner with heavy dew, or bad field placements against a hitter) instantly flips a 100-crore franchise match.
Captain Cool AI solves this by establishing a Multi-Agent Orchestration Mesh that acts as a real-time advisory committee. Instead of a single flat answer, specialized Gemini agents—each with distinct roles, system prompts, and tool access—sequentially debate the match situation:
- The Stats Analyst fetches real-world weather data.
- The Pitch Analyst determines swing and spin.
- The Devil's Advocate stress-tests proposed plans.
- The Captain Strategist synthesizes the final decisions.
- The Commentator brings Shastri-style hype to the output.
- Sequential Multi-Agent Debate: Watch specialized Gemini agents discuss and challenge your tactical decisions in real time.
- Native Weather Tool Calling: Real-time stadium telemetry (temperature, humidity, dew warnings) fetched dynamically from the Open-Meteo API using native Gemini Function Calling.
- Futuristic Sports HUD Aesthetic: Gorgeous dark-mode styling with custom neon borders, active score widgets, animated CSS waveforms, and spring-physics page routing.
- Win Probability Gauge: Beautiful custom SVG radial gauge displaying real-time confidence scores and counterfactual situational analysis.
- Live Match Importer (Preview): A clean live scoreboard parser designed to ingest Cricbuzz and ESPN Cricinfo scorecards.
- Voice dugout Captain (Preview): Speak questions directly to the dugout and simulate audio-visual Dhoni-style responses.
- Visual Architecture Blueprint: A live graphical walkthrough demonstrating the orchestrated five-agent step-by-step pipeline.
- Framework: React 18 + Vite
- Styling: Tailwind CSS v3 + Custom HSL Variables
- Animations: Framer Motion (spring transitions, stagger feeds, particles)
- Icons: Lucide React (Premium emoji-free sports layout)
- Runtime: Node.js + Express
- AI SDK: Official
@google/genai(Agent Development Kit approach)
- API integrations: Open-Meteo Meteorological API (Grounded Weather coordinates)
- Core LLM:
gemini-2.5-flash(Engineered for multi-turn reasoning speed & native tool schema execution)
graph TD
A[User / Cricket Coach] -->|Inputs Match State| B(React Frontend - Vite)
B -->|POST /api/debate| C{Express Orchestrator}
C -->|Instantiates Thread| D[Stats Analyst Agent]
D <-->|Native Tool Call: getVenueWeather| E((Open-Meteo API))
C -->|Thread Context| F[Pitch Analyst Agent]
D --> G[Devil's Advocate Agent]
F --> G
G -->|Stress Tests Plan| H[Captain Strategist Agent]
H -->|Final Decision & Win Prob| I[Commentary Agent]
I -->|Synthesized Pipeline JSON| C
C -->|JSON Stream/Response| B
B -->|Interactive Broadcast HUD| A
- Match Initialization: The coach inputs stadium venue, striker details, bowler, batting/bowling teams, and exact scorecard values.
- Environmental Grounding: The Stats Analyst executes a tool call using stadium coordinates to retrieve real-time weather telemetry. Dew risk is calculated based on temperature-to-humidity thresholds.
- Drafting Strategy: The Pitch Analyst outlines specific game plans based on match phase (Powerplay/Middle/Death) and weather.
- Stress Testing: The Devil's Advocate acts as a cynic, aggressively finding flaws in the proposed strategy (e.g. bowler matchup risks, boundary configurations).
- Dhoni-Style Decision: The Captain Strategist consumes the entire debate log, makes a final structured decision, outputs counterfactual alternatives, and scores the win probability.
- Hype Generation: The Commentator translates the outcome into an authentic, energetic IPL commentator commentary block.
- Node.js (v18+ recommended)
- NPM or Yarn
- A Google Gemini API Key (from Google AI Studio)
git clone https://github.com/VIDYANKSHINI/Captain-Cool.git
cd Captain-Coolcd backend
npm installConfigure your environment variables:
Create a .env file in the /backend folder:
Start the backend service:
npm run devIn a new terminal window:
cd ../frontend
npm install
npm run devOpen http://localhost:5173 in your web browser.
- Launch the application and enter the Strategy Room via the navigation bar.
- Enter the current match context (e.g. CSK vs MI, Wankhede Stadium, Striker name, Target to defend, Current Bowler).
- Hit Initialize Strategy Protocol.
- Watch the telemetry box load live stadium metrics, followed by the sequential staggering debate thread of the specialized agents.
- Click on individual cards to expand detailed debate logs, view the confidence meter, and copy Shastri-AI commentary transcripts.
- Endpoint:
/api/debate - Method:
POST - Content-Type:
application/json - Payload:
{
"battingTeam": "Chennai Super Kings",
"bowlingTeam": "Mumbai Indians",
"score": "180/4",
"overs": "18.2",
"target": "195",
"striker": "MS Dhoni (28 off 12)",
"nonStriker": "Ravindra Jadeja (12 off 8)",
"bowler": "Jasprit Bumrah",
"venue": "Wankhede Stadium, Mumbai",
"impactPlayerAvailable": true
}- Response:
{
"weather": {
"temperature": "29°C",
"humidity": "78%",
"dewWarning": "High",
"isRealData": true
},
"timeline": [
{ "agent": "Stats Analyst", "role": "analyst", "text": "..." },
{ "agent": "Pitch Analyst", "role": "pitch", "text": "..." },
{ "agent": "Devil's Advocate", "role": "devil", "text": "..." },
{ "agent": "Captain Strategist", "role": "captain", "confidence": "85", "text": "..." },
{ "agent": "Commentator", "role": "commentary", "text": "..." }
]
}- Stats Analyst: Strict, data-driven, calculating. Translates coordinates, evaluates moisture levels, and warns about bowlers' average ER under dew.
- Pitch Analyst: Conditions assessor. Focuses on spin index, turf hardness, boundary metrics, and swing duration.
- Devil's Advocate: Severe risk analyst. Evaluates counter-matchups, potential dropped catches, edge cases, and run-rate pressures.
- Captain Strategist (MS Dhoni Cognitive Clone): Calm, situational, intuitive, and decisive. Balances risk, optimizes field placements, and chooses the highest probability of success.
Captain-Cool/
├── backend/
│ ├── src/
│ │ ├── controllers/
│ │ │ └── debateController.js # Multi-agent orchestrator & prompt pipelines
│ │ ├── services/
│ │ │ ├── geminiService.js # @google/genai client initialization & function calling
│ │ │ └── weatherService.js # Open-Meteo API integrations
│ │ └── index.js
│ ├── .env
│ └── package.json
└── frontend/
├── src/
│ ├── components/
│ │ ├── AgentCard.jsx # Interactive accordions with custom icons
│ │ ├── FinalDecisionCard.jsx # SVG Radial Gauge with MS Dhoni decision UI
│ │ ├── MatchInputForm.jsx # Clean sport HUD custom dropdowns
│ │ └── Navbar.jsx # Neon glassmorphism responsive nav
│ ├── pages/
│ │ ├── LandingPage.jsx # Floating widgets, scroll indices, particle canvas
│ │ ├── Dashboard.jsx # Main Strategy dugout feed
│ │ ├── LiveMatchMode.jsx # Cricbuzz import page preview
│ │ ├── VoiceCaptain.jsx # CSS waveform mic preview page
│ │ └── ArchitecturePage.jsx # Live system blueprint
│ ├── index.css # Custom styling overrides & global animations
│ └── App.jsx
├── tailwind.config.js
└── postcss.config.js
- Interactive SVG Fielding Map: A clickable 2D cricket stadium SVG where dots dynamically arrange to match the Captain's field placements.
- Deep Historical Scorecard RAG: Grounding the Stats Agent using a vector database populated with historical IPL ball-by-ball scorecards.
- Full Speech synthesis: Using the Google Cloud Text-to-Speech API to vocalize Shastri-AI's commentaries.
- Tailwind ESM PostCSS Class compilation: Downgraded to Tailwind v3 and declared custom background colors using global CSS variables inside
index.cssto bypass static config resolution errors in ESM. - Lucide React Version imports: Handled version-specific exports elegantly by swapping missing icons for standard high-end components to guarantee hot reloading without compilation locks.
- Real Function Calling groundings: Handled meteorological telemetry coordinates dynamically by implementing rigorous weather parameter fallbacks to avoid crashes during high API traffic.
- Vidyankshini - Full-Stack Developer & AI Systems Engineer
- GDG Cloud Pune & Google AI Studio organizers for the Agentic Premier League hackathon.
- The Open-Meteo meteorological database.
- Every cricket captain who ever trusted their gut in the final over of an IPL final.