<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: GitPhantom700</title>
    <description>The latest articles on DEV Community by GitPhantom700 (@gitphantom700).</description>
    <link>https://dev.to/gitphantom700</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3936185%2F5801aead-c001-49dc-9b4d-c333fd62304b.png</url>
      <title>DEV Community: GitPhantom700</title>
      <link>https://dev.to/gitphantom700</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gitphantom700"/>
    <language>en</language>
    <item>
      <title>🏏 Captain Cool: The Multi-Agent IPL Match Strategist Built on Google Gemini</title>
      <dc:creator>GitPhantom700</dc:creator>
      <pubDate>Sun, 17 May 2026 12:28:58 +0000</pubDate>
      <link>https://dev.to/gitphantom700/captain-cool-the-multi-agent-ipl-match-strategist-built-on-google-gemini-jhp</link>
      <guid>https://dev.to/gitphantom700/captain-cool-the-multi-agent-ipl-match-strategist-built-on-google-gemini-jhp</guid>
      <description>&lt;h1&gt;
  
  
  🏏 "Captain Cool" — The Multi-Agent IPL Match Strategist Built on Google Gemini
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;This is a submission for the Google Gemini Multi-Agent Hackathon! Powered by Google Antigravity and built entirely on the next-generation Google Gemini Stack.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 The Vision
&lt;/h2&gt;

&lt;p&gt;In cricket-crazy nations, fans don't just watch the game—they play the role of "armchair captains," constantly arguing about who should bowl the 19th over, when the strategic timeout should be taken, or how the field should be set. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Captain Cool"&lt;/strong&gt; brings this tactical war room to life! It acts as an autonomous virtual IPL Captain, leveraging &lt;strong&gt;multiple collaborative Gemini-powered agents&lt;/strong&gt; to debate the next tactical move in a live match, the way MSD, Rohit, or Gambhir would.&lt;/p&gt;

&lt;p&gt;It takes real-time variables—innings, overs, wickets, pitch type, venue, and dew factor—and outputs a calculated strategy backed by numbers, tested through internal debate, and narrated in poetic cricket language.&lt;/p&gt;




&lt;h2&gt;
  
  
  🏛️ Architecture &amp;amp; Multi-Agent Design
&lt;/h2&gt;

&lt;p&gt;A single prompt wearing four hats is not a true multi-agent system. "Captain Cool" runs a stateful, sequential multi-turn debate between &lt;strong&gt;four distinct, named Gemini agents&lt;/strong&gt; powered by &lt;code&gt;gemini-2.5-flash&lt;/code&gt; via the official &lt;code&gt;@google/genai&lt;/code&gt; SDK:&lt;/p&gt;

&lt;h3&gt;
  
  
  🏛️ The Sequential Reasoning Chain
&lt;/h3&gt;

&lt;p&gt;Instead of a single prompt trying to do everything, "Captain Cool" runs a structured, stateful debate loop across four collaborative stages:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;📥 User Input (Match State):&lt;/strong&gt; You enter parameters like wickets, score, overs remaining, venue, and pitch images.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;📊 Stats Shastri (The Analyst):&lt;/strong&gt; Processes the data, triggers the dynamic weather API to assess local Dew Factor, and evaluates historic matchup metrics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🧠 Thala Dhoni (The Strategist):&lt;/strong&gt; Takes Shastri's empirical report and proposes the initial tactical game plan (e.g., bowling Bumrah straight).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🔥 Gautam Gambhir (Devil's Advocate):&lt;/strong&gt; Scrutinizes the proposal for high-risk tactical blind spots (e.g., spin slipping on wet dew grass) and issues an intense critique.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🧠 Thala Dhoni (Rebuttal &amp;amp; Resolution):&lt;/strong&gt; Dhoni reviews the challenge, adapts or defends his strategy, and locks in the optimal final plan.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🎙️ Harsha Bhogle (Poetic Commentator):&lt;/strong&gt; Translates the final complex captaincy decision into highly engaging cricket storytelling and vocal commentary.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🛠️ The Hard Requirements (How We Checked Every Box)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Three or More Collaborative Agents
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;📊 Stats Shastri (The Analyst):&lt;/strong&gt; The numbers engine. Strictly clinical and quantitative.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;🧠 Thala Dhoni (The Strategist):&lt;/strong&gt; Calm, game-aware mastermind. Proposes simple, impactful strategies.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;🔥 Gautam Gambhir (The Devil's Advocate):&lt;/strong&gt; High-intensity critic. Aggressively challenges Dhoni’s plans to uncover blind spots.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;🎙️ Harsha Bhogle (The Commentator):&lt;/strong&gt; The final narrator, turning tactical jargon into beautiful cricket poetry.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Live Tool Use (Function Calling)
&lt;/h3&gt;

&lt;p&gt;We implemented three real-world grounding tools that run on our Next.js API server to provide empirical data to the agents:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;fetch_weather_and_dew_factor&lt;/code&gt;: Dynamically calls the &lt;strong&gt;Open-Meteo API&lt;/strong&gt; using coordinates of the target IPL stadium to fetch humidity, temperature, and predict dew factor in real-time.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;calculate_match_win_probability&lt;/code&gt;: A custom mathematical model assessing runs required, wickets remaining, balls remaining, and pitch difficulty.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;fetch_head_to_head_stats&lt;/code&gt;: Performs direct player-vs-player matching on a database of legendary IPL matchups.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Multi-Turn Reasoning Loop (The Internal Debate)
&lt;/h3&gt;

&lt;p&gt;When you submit a match state, the server launches the sequential debate. Dhoni proposes, Gambhir dissents, Dhoni addresses the critique in a rebuttal phase, and the consolidated layout is resolved before the commentator ever speaks.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Explainability for Casual Fans
&lt;/h3&gt;

&lt;p&gt;The final output is translated by &lt;strong&gt;Harsha Bhogle&lt;/strong&gt; into highly engaging commentary, explicitly detailing the "Why This, Not That" (e.g. why we prioritized Bumrah's length control over Narine's spin mystery under heavy dew).&lt;/p&gt;




&lt;h3&gt;
  
  
  🌟 5/5 Stretch Goals Achieved!
&lt;/h3&gt;

&lt;p&gt;We didn't just stop at the requirements. We hit all five optional stretch goals:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Real-time mode:&lt;/strong&gt; A built-in web scraper extracts live match states directly from Cricbuzz URLs using Gemini 2.5 JSON mode.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Voice in/out:&lt;/strong&gt; The "Listen to Harsha" button uses the browser's Web Speech API to broadcast the final commentary out loud.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Confidence Score &amp;amp; Counterfactuals:&lt;/strong&gt; Animated circular dials display exact win-probabilities, and Gambhir's critiques provide counterfactual modeling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory Across Overs:&lt;/strong&gt; The system maintains an internal memory log of previous overs, passing context back into the prompt to ensure a cohesive 20-over strategy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multimodal Pitch Image:&lt;/strong&gt; Users can upload a screenshot of the pitch, which is encoded and passed to Gemini Vision. Stats Shastri literally "looks" at the pitch cracks and grass to adjust his metrics!&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  💻 Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Core:&lt;/strong&gt; Next.js (App Router, Tailwind CSS, TypeScript).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;AI Engine:&lt;/strong&gt; Official &lt;code&gt;@google/genai&lt;/code&gt; TypeScript SDK.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Models:&lt;/strong&gt; &lt;code&gt;gemini-2.5-flash&lt;/code&gt; via Google AI Studio.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;UI/UX:&lt;/strong&gt; Glassmorphism dashboard with an interactive SVG Stadium Field mapping and dynamic circular probability gauges.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Voice:&lt;/strong&gt; Web Speech API for TTS synthesis of Harsha's commentary.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🎙️ Deep Dive: The Agent Prompts
&lt;/h2&gt;

&lt;h3&gt;
  
  
  📊 Stats Shastri Prompt
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;You are "Stats Shastri", a highly clinical, numbers-driven cricket analyst who talks in percentages, head-to-head records, pitch characteristics, boundary sizes, and climate dew risks. Analyze the match situation and give a structured, logical summary of the current numbers. Avoid metaphors.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  🧠 Thala Dhoni Prompt
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;You are "Thala Dhoni", a legendary IPL Captain known as "Captain Cool". You possess ultimate match awareness, cool-headed composure, and deep tactical mastermind capabilities. Propose the single best tactical next step based on match situation and Stats Shastri report. Explain your reasoning in calm, authoritative, captain's language.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  🔥 Gautam Gambhir Prompt
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;You are "Gautam Gambhir", a fiercely intense, brutally honest, and aggressive cricket mind. You serve as the Devil's Advocate. Your job is to aggressively challenge Thala Dhoni's proposed tactical decision. Point out what Dhoni missed! speak with edge, passion, and tactical grit.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  🎙️ Harsha Bhogle Prompt
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;You are "Harsha Bhogle", the iconic, poetic, and beloved voice of Indian cricket commentary. Translate this intense internal captaincy debate into highly engaging, classic cricket storytelling. Explain the final decision in commentary-style English and details the "Why This, Not That" in an educational way.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  🔗 AI Studio Prompt Link
&lt;/h3&gt;

&lt;p&gt;Check out our Harsha Bhogle agent prompt directly in Google AI Studio:&lt;br&gt;
&lt;strong&gt;&lt;a href="https://aistudio.google.com/app/prompts?state=%7B%22ids%22:%5B%221hm-o0Nangk1wi7AC1x4GYpRB8FeO2UQZ%22%5D,%22action%22:%22open%22,%22userId%22:%22102638886710749817192%22,%22resourceKeys%22:%7B%7D%7D&amp;amp;usp=sharing" rel="noopener noreferrer"&gt;View Harsha Bhogle Prompt on Google AI Studio&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  📸 Dashboard Walkthrough (The Wow Factor)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flyziui3rdu3jakcu5dwn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flyziui3rdu3jakcu5dwn.png" alt="Captain Cool Dashboard Mockup" width="800" height="1202"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Live Demo Scenario: CSK vs GT (IPL 2023 Final)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Scenario:&lt;/strong&gt; 10 runs needed off 2 balls, Ravindra Jadeja on strike, Mohit Sharma bowling, Ahmedabad.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Stadium Visualizer:&lt;/strong&gt; Renders short boundaries, pitch strip coloring, and live player strike arrangements.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Stats Shastri&lt;/strong&gt; shows that Jadeja strikes at 129% against Mohit Sharma but has been dismissed twice.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Thala Dhoni&lt;/strong&gt; wants to target the straight boundary.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Gautam Gambhir&lt;/strong&gt; aggressively argues that Mohit will bowl outside off-stump to avoid the leg-side swing, recommending a deep third-man cover.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Harsha Bhogle&lt;/strong&gt; synthesizes this into an epic commentary package!&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  🎥 Watch it in Action!
&lt;/h3&gt;

&lt;p&gt;Here is a recording of our browser session simulating the agent debate:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffgrfa9cxt77jvi9k8lwi.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffgrfa9cxt77jvi9k8lwi.webp" alt="Captain Cool Agent Debate Demo" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  🚀 How to Run Locally
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Clone the Repo:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/GitPhantom700/captian-cool.git
&lt;span class="nb"&gt;cd &lt;/span&gt;captian-cool
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Install dependencies:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Setup your environment:&lt;/strong&gt;&lt;br&gt;
Create a &lt;code&gt;.env.local&lt;/code&gt; file and add your Google Gemini API key:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GEMINI_API_KEY=your_gemini_api_key_here
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;&lt;em&gt;(Security Note: NEVER commit your actual API key to GitHub. The &lt;code&gt;.env.local&lt;/code&gt; file is hidden by default. The blog post should only show the placeholder text &lt;code&gt;your_gemini_api_key_here&lt;/code&gt;!)&lt;/em&gt;&lt;/p&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Launch:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Open &lt;code&gt;http://localhost:3000&lt;/code&gt; on your browser!&lt;/p&gt;


&lt;/li&gt;

&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;Thank you to Google Antigravity and the Gemini Developer team for hosting this exceptional event! Let us know your thoughts on Captain Cool in the comments!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>gemini</category>
      <category>hackathon</category>
      <category>multiagent</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>🏏 Captain Cool: The Multi-Agent IPL Match Strategist Built on Google Gemini</title>
      <dc:creator>GitPhantom700</dc:creator>
      <pubDate>Sun, 17 May 2026 12:22:12 +0000</pubDate>
      <link>https://dev.to/gitphantom700/captain-cool-the-multi-agent-ipl-match-strategist-built-on-google-gemini-2ofn</link>
      <guid>https://dev.to/gitphantom700/captain-cool-the-multi-agent-ipl-match-strategist-built-on-google-gemini-2ofn</guid>
      <description>&lt;h1&gt;
  
  
  🏏 "Captain Cool" — The Multi-Agent IPL Match Strategist Built on Google Gemini
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;This is a submission for the Google Gemini Multi-Agent Hackathon! Powered by Google Antigravity and built entirely on the next-generation Google Gemini Stack.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 The Vision
&lt;/h2&gt;

&lt;p&gt;In cricket-crazy nations, fans don't just watch the game—they play the role of "armchair captains," constantly arguing about who should bowl the 19th over, when the strategic timeout should be taken, or how the field should be set. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;"Captain Cool"&lt;/strong&gt; brings this tactical war room to life! It acts as an autonomous virtual IPL Captain, leveraging &lt;strong&gt;multiple collaborative Gemini-powered agents&lt;/strong&gt; to debate the next tactical move in a live match, the way MSD, Rohit, or Gambhir would.&lt;/p&gt;

&lt;p&gt;It takes real-time variables—innings, overs, wickets, pitch type, venue, and dew factor—and outputs a calculated strategy backed by numbers, tested through internal debate, and narrated in poetic cricket language.&lt;/p&gt;




&lt;h2&gt;
  
  
  🏛️ Architecture &amp;amp; Multi-Agent Design
&lt;/h2&gt;

&lt;p&gt;A single prompt wearing four hats is not a true multi-agent system. "Captain Cool" runs a stateful, sequential multi-turn debate between &lt;strong&gt;four distinct, named Gemini agents&lt;/strong&gt; powered by &lt;code&gt;gemini-2.5-flash&lt;/code&gt; via the official &lt;code&gt;@google/genai&lt;/code&gt; SDK:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2FeyJjb2RlIjoiZ3JhcGggVEJcbiAgICBzdWJncmFwaCBDbGllbnQgW0Zyb250ZW5kIFVJIExheWVyOiBO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dXRpb258IEtbNS4gSGFyc2hhIEJob2dsZSBDb21tZW50YXRvcl1cbiAgICBlbmRcblxuICAgIHN1YmdyYXBoIEV4dGVybmFsIFtHcm91bmRpbmcgQVBJcyAmIFN0b3JhZ2VdXG4gICAgICAgIExbKExvY2FsIE1hdGNodXAgREIpXVxuICAgICAgICBNW09wZW4tTWV0ZW8gQVBJOiBSZWFsdGltZSB3ZWF0aGVyIGNvb3Jkc11cbiAgICAgICAgTltDcmljYnV6eiBTY3JhcGVyIFNlcnZpY2VdXG4gICAgZW5kXG5cbiAgICBzdWJncmFwaCBBSSBbTExNIFJlYXNvbmluZyBMYXllcl1cbiAgICAgICAgT1tHb29nbGUgR2VtaW5pIEFQSTogZ2VtaW5pLTIuNS1mbGFzaF1cbiAgICBlbmRcblxuICAgIEQgLS0%2BfFBvc3QgU2NvcmVjYXJkIFVSTHwgRlxuICAgIEYgLS0%2BfFNjcmFwZXMgYW5kIHBhcnNlc3wgTlxuICAgIEEgLS0%2BfFN1Ym1pdCBNYXRjaCBQYXJhbWV0ZXJzfCBFXG4gICAgRSAtLT58MS4gRGF0YSBmZXRjaHwgTFxuICAgIEUgLS0%2BfDIuIExvY2FsIFdlYXRoZXIgZmV0Y2h8IE1cbiAgICBFIC0tPnwzLiBJbnZva2UgU2VxdWVudGlhbCBBZ2VudHN8IE9yY2hlc3RyYXRpb25cbiAgICBPcmNoZXN0cmF0aW9uIDwtLT58SlNPTiBQcm9tcHQgLyBTeXN0ZW0gSW5zdHJ1Y3Rpb25zfCBPIiwibWVybWFpZCI6eyJ0aGVtZSI6Im5ldXRyYWwifX0%3D" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2FeyJjb2RlIjoiZ3JhcGggVEJcbiAgICBzdWJncmFwaCBDbGllbnQgW0Zyb250ZW5kIFVJIExheWVyOiBOZXh0LmpzIFN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S4gSGFyc2hhIEJob2dsZSBDb21tZW50YXRvcl1cbiAgICBlbmRcblxuICAgIHN1YmdyYXBoIEV4dGVybmFsIFtHcm91bmRpbmcgQVBJcyAmIFN0b3JhZ2VdXG4gICAgICAgIExbKExvY2FsIE1hdGNodXAgREIpXVxuICAgICAgICBNW09wZW4tTWV0ZW8gQVBJOiBSZWFsdGltZSB3ZWF0aGVyIGNvb3Jkc11cbiAgICAgICAgTltDcmljYnV6eiBTY3JhcGVyIFNlcnZpY2VdXG4gICAgZW5kXG5cbiAgICBzdWJncmFwaCBBSSBbTExNIFJlYXNvbmluZyBMYXllcl1cbiAgICAgICAgT1tHb29nbGUgR2VtaW5pIEFQSTogZ2VtaW5pLTIuNS1mbGFzaF1cbiAgICBlbmRcblxuICAgIEQgLS0%2BfFBvc3QgU2NvcmVjYXJkIFVSTHwgRlxuICAgIEYgLS0%2BfFNjcmFwZXMgYW5kIHBhcnNlc3wgTlxuICAgIEEgLS0%2BfFN1Ym1pdCBNYXRjaCBQYXJhbWV0ZXJzfCBFXG4gICAgRSAtLT58MS4gRGF0YSBmZXRjaHwgTFxuICAgIEUgLS0%2BfDIuIExvY2FsIFdlYXRoZXIgZmV0Y2h8IE1cbiAgICBFIC0tPnwzLiBJbnZva2UgU2VxdWVudGlhbCBBZ2VudHN8IE9yY2hlc3RyYXRpb25cbiAgICBPcmNoZXN0cmF0aW9uIDwtLT58SlNPTiBQcm9tcHQgLyBTeXN0ZW0gSW5zdHJ1Y3Rpb25zfCBPIiwibWVybWFpZCI6eyJ0aGVtZSI6Im5ldXRyYWwifX0%3D" alt="Captain Cool Solution Architecture Diagram" width="1904" height="1562"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  🏛️ The Sequential Reasoning Chain
&lt;/h3&gt;

&lt;p&gt;Instead of a single prompt trying to do everything, "Captain Cool" runs a structured, stateful debate loop across four collaborative stages:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;📥 User Input (Match State):&lt;/strong&gt; You enter parameters like wickets, score, overs remaining, venue, and pitch images.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;📊 Stats Shastri (The Analyst):&lt;/strong&gt; Processes the data, triggers the dynamic weather API to assess local Dew Factor, and evaluates historic matchup metrics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🧠 Thala Dhoni (The Strategist):&lt;/strong&gt; Takes Shastri's empirical report and proposes the initial tactical game plan (e.g., bowling Bumrah straight).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🔥 Gautam Gambhir (Devil's Advocate):&lt;/strong&gt; Scrutinizes the proposal for high-risk tactical blind spots (e.g., spin slipping on wet dew grass) and issues an intense critique.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🧠 Thala Dhoni (Rebuttal &amp;amp; Resolution):&lt;/strong&gt; Dhoni reviews the challenge, adapts or defends his strategy, and locks in the optimal final plan.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🎙️ Harsha Bhogle (Poetic Commentator):&lt;/strong&gt; Translates the final complex captaincy decision into highly engaging cricket storytelling and vocal commentary.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🛠️ The Hard Requirements (How We Checked Every Box)
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Three or More Collaborative Agents
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;📊 Stats Shastri (The Analyst):&lt;/strong&gt; The numbers engine. Strictly clinical and quantitative.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;🧠 Thala Dhoni (The Strategist):&lt;/strong&gt; Calm, game-aware mastermind. Proposes simple, impactful strategies.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;🔥 Gautam Gambhir (The Devil's Advocate):&lt;/strong&gt; High-intensity critic. Aggressively challenges Dhoni’s plans to uncover blind spots.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;🎙️ Harsha Bhogle (The Commentator):&lt;/strong&gt; The final narrator, turning tactical jargon into beautiful cricket poetry.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Live Tool Use (Function Calling)
&lt;/h3&gt;

&lt;p&gt;We implemented three real-world grounding tools that run on our Next.js API server to provide empirical data to the agents:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;code&gt;fetch_weather_and_dew_factor&lt;/code&gt;: Dynamically calls the &lt;strong&gt;Open-Meteo API&lt;/strong&gt; using coordinates of the target IPL stadium to fetch humidity, temperature, and predict dew factor in real-time.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;calculate_match_win_probability&lt;/code&gt;: A custom mathematical model assessing runs required, wickets remaining, balls remaining, and pitch difficulty.&lt;/li&gt;
&lt;li&gt;  &lt;code&gt;fetch_head_to_head_stats&lt;/code&gt;: Performs direct player-vs-player matching on a database of legendary IPL matchups.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Multi-Turn Reasoning Loop (The Internal Debate)
&lt;/h3&gt;

&lt;p&gt;When you submit a match state, the server launches the sequential debate. Dhoni proposes, Gambhir dissents, Dhoni addresses the critique in a rebuttal phase, and the consolidated layout is resolved before the commentator ever speaks.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Explainability for Casual Fans
&lt;/h3&gt;

&lt;p&gt;The final output is translated by &lt;strong&gt;Harsha Bhogle&lt;/strong&gt; into highly engaging commentary, explicitly detailing the "Why This, Not That" (e.g. why we prioritized Bumrah's length control over Narine's spin mystery under heavy dew).&lt;/p&gt;




&lt;h3&gt;
  
  
  🌟 5/5 Stretch Goals Achieved!
&lt;/h3&gt;

&lt;p&gt;We didn't just stop at the requirements. We hit all five optional stretch goals:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Real-time mode:&lt;/strong&gt; A built-in web scraper extracts live match states directly from Cricbuzz URLs using Gemini 2.5 JSON mode.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Voice in/out:&lt;/strong&gt; The "Listen to Harsha" button uses the browser's Web Speech API to broadcast the final commentary out loud.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Confidence Score &amp;amp; Counterfactuals:&lt;/strong&gt; Animated circular dials display exact win-probabilities, and Gambhir's critiques provide counterfactual modeling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory Across Overs:&lt;/strong&gt; The system maintains an internal memory log of previous overs, passing context back into the prompt to ensure a cohesive 20-over strategy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multimodal Pitch Image:&lt;/strong&gt; Users can upload a screenshot of the pitch, which is encoded and passed to Gemini Vision. Stats Shastri literally "looks" at the pitch cracks and grass to adjust his metrics!&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  💻 Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Core:&lt;/strong&gt; Next.js (App Router, Tailwind CSS, TypeScript).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;AI Engine:&lt;/strong&gt; Official &lt;code&gt;@google/genai&lt;/code&gt; TypeScript SDK.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Models:&lt;/strong&gt; &lt;code&gt;gemini-2.5-flash&lt;/code&gt; via Google AI Studio.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;UI/UX:&lt;/strong&gt; Glassmorphism dashboard with an interactive SVG Stadium Field mapping and dynamic circular probability gauges.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Voice:&lt;/strong&gt; Web Speech API for TTS synthesis of Harsha's commentary.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🎙️ Deep Dive: The Agent Prompts
&lt;/h2&gt;

&lt;h3&gt;
  
  
  📊 Stats Shastri Prompt
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;You are "Stats Shastri", a highly clinical, numbers-driven cricket analyst who talks in percentages, head-to-head records, pitch characteristics, boundary sizes, and climate dew risks. Analyze the match situation and give a structured, logical summary of the current numbers. Avoid metaphors.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  🧠 Thala Dhoni Prompt
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;You are "Thala Dhoni", a legendary IPL Captain known as "Captain Cool". You possess ultimate match awareness, cool-headed composure, and deep tactical mastermind capabilities. Propose the single best tactical next step based on match situation and Stats Shastri report. Explain your reasoning in calm, authoritative, captain's language.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  🔥 Gautam Gambhir Prompt
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;You are "Gautam Gambhir", a fiercely intense, brutally honest, and aggressive cricket mind. You serve as the Devil's Advocate. Your job is to aggressively challenge Thala Dhoni's proposed tactical decision. Point out what Dhoni missed! speak with edge, passion, and tactical grit.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  🎙️ Harsha Bhogle Prompt
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;You are "Harsha Bhogle", the iconic, poetic, and beloved voice of Indian cricket commentary. Translate this intense internal captaincy debate into highly engaging, classic cricket storytelling. Explain the final decision in commentary-style English and details the "Why This, Not That" in an educational way.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  🔗 AI Studio Prompt Link
&lt;/h3&gt;

&lt;p&gt;Check out our Harsha Bhogle agent prompt directly in Google AI Studio:&lt;br&gt;
&lt;strong&gt;&lt;a href="https://aistudio.google.com/app/prompts?state=%7B%22ids%22:%5B%221hm-o0Nangk1wi7AC1x4GYpRB8FeO2UQZ%22%5D,%22action%22:%22open%22,%22userId%22:%22102638886710749817192%22,%22resourceKeys%22:%7B%7D%7D&amp;amp;usp=sharing" rel="noopener noreferrer"&gt;View Harsha Bhogle Prompt on Google AI Studio&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  📸 Dashboard Walkthrough (The Wow Factor)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flyziui3rdu3jakcu5dwn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flyziui3rdu3jakcu5dwn.png" alt="Captain Cool Dashboard Mockup" width="800" height="1202"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Live Demo Scenario: CSK vs GT (IPL 2023 Final)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Scenario:&lt;/strong&gt; 10 runs needed off 2 balls, Ravindra Jadeja on strike, Mohit Sharma bowling, Ahmedabad.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Stadium Visualizer:&lt;/strong&gt; Renders short boundaries, pitch strip coloring, and live player strike arrangements.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Stats Shastri&lt;/strong&gt; shows that Jadeja strikes at 129% against Mohit Sharma but has been dismissed twice.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Thala Dhoni&lt;/strong&gt; wants to target the straight boundary.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Gautam Gambhir&lt;/strong&gt; aggressively argues that Mohit will bowl outside off-stump to avoid the leg-side swing, recommending a deep third-man cover.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Harsha Bhogle&lt;/strong&gt; synthesizes this into an epic commentary package!&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  🎥 Watch it in Action!
&lt;/h3&gt;

&lt;p&gt;Here is a recording of our browser session simulating the agent debate:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffgrfa9cxt77jvi9k8lwi.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffgrfa9cxt77jvi9k8lwi.webp" alt="Captain Cool Agent Debate Demo" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  🚀 How to Run Locally
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Clone the Repo:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/GitPhantom700/captian-cool.git
&lt;span class="nb"&gt;cd &lt;/span&gt;captian-cool
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Install dependencies:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Setup your environment:&lt;/strong&gt;&lt;br&gt;
Create a &lt;code&gt;.env.local&lt;/code&gt; file and add your Google Gemini API key:&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GEMINI_API_KEY=your_gemini_api_key_here
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;&lt;em&gt;(Security Note: NEVER commit your actual API key to GitHub. The &lt;code&gt;.env.local&lt;/code&gt; file is hidden by default. The blog post should only show the placeholder text &lt;code&gt;your_gemini_api_key_here&lt;/code&gt;!)&lt;/em&gt;&lt;/p&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;&lt;strong&gt;Launch:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;Open &lt;code&gt;http://localhost:3000&lt;/code&gt; on your browser!&lt;/p&gt;


&lt;/li&gt;

&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;Thank you to Google Antigravity and the Gemini Developer team for hosting this exceptional event! Let us know your thoughts on Captain Cool in the comments!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>gemini</category>
      <category>hackathon</category>
      <category>multiagent</category>
      <category>gdgcloudpune</category>
    </item>
  </channel>
</rss>
