<?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: Sarthak Patil</title>
    <description>The latest articles on DEV Community by Sarthak Patil (@sarthak-patil).</description>
    <link>https://dev.to/sarthak-patil</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%2F3936031%2F6113d4fb-1758-42d4-b3d5-7b54d187ad72.png</url>
      <title>DEV Community: Sarthak Patil</title>
      <link>https://dev.to/sarthak-patil</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sarthak-patil"/>
    <language>en</language>
    <item>
      <title>Building "Captain Cool"</title>
      <dc:creator>Sarthak Patil</dc:creator>
      <pubDate>Sun, 17 May 2026 12:18:19 +0000</pubDate>
      <link>https://dev.to/sarthak-patil/building-captain-cool-4bni</link>
      <guid>https://dev.to/sarthak-patil/building-captain-cool-4bni</guid>
      <description>&lt;p&gt;Building "Captain Cool": A Multi-Agent IPL Strategist Powered by Google Gemini in 3 Hours&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Cricket is a captain's game. But what if the captain was an autonomous, multi-agent AI "Brain Room" analyzing live weather, pitch soil, and historical matchups in real-time?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This weekend, I participated in the &lt;strong&gt;Agentic Premier League (APL) Hackathon&lt;/strong&gt; organized by the incredible team at &lt;strong&gt;#gdgcloudpune&lt;/strong&gt;. The challenge? Build an agentic AI system that acts as a virtual IPL captain—making tactical decisions under pressure exactly like Dhoni, Rohit, or Hardik. And the golden rule: It had to be built entirely on the &lt;strong&gt;Google Gemini ecosystem&lt;/strong&gt; within a grueling 3-hour window.&lt;/p&gt;

&lt;p&gt;Here is a deep dive into how I built &lt;strong&gt;Captain Cool&lt;/strong&gt; 🏆.&lt;/p&gt;




&lt;h2&gt;
  
  
  🌟 The Problem: Moving Beyond the "Chatbot"
&lt;/h2&gt;

&lt;p&gt;When building an AI for sports strategy, a generic LLM wrapper won't cut it. If you ask a standard chatbot, "Who should bowl the next over?", it will give you generic advice.&lt;/p&gt;

&lt;p&gt;Real cricket requires context: &lt;em&gt;Is dew setting in? Is the wind blowing toward the short boundary? Is it a red soil or black soil pitch?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Captain Cool&lt;/strong&gt; solves this by moving away from a single prompt and utilizing an &lt;strong&gt;adversarial multi-agent architecture&lt;/strong&gt;. You input the current match state, and the system replies with:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;🎯 &lt;strong&gt;The Next Decision&lt;/strong&gt; (e.g., bowling changes, field setups, Impact Player usage).&lt;/li&gt;
&lt;li&gt;🧠 &lt;strong&gt;The Reasoning&lt;/strong&gt; (explained in authentic commentator language).&lt;/li&gt;
&lt;li&gt;⚔️ &lt;strong&gt;The Internal Debate&lt;/strong&gt; (a raw, unedited back-and-forth between specialized agents).&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🏗️ Architecture: Inside the "Brain Room"
&lt;/h2&gt;

&lt;p&gt;To achieve this, I used &lt;strong&gt;Google's Agent Development Kit (ADK)&lt;/strong&gt; and the &lt;code&gt;@google/genai&lt;/code&gt; SDK to create three distinct, named agents powered by &lt;code&gt;gemini-2.5-pro&lt;/code&gt;. They don't just generate text; they debate.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Agent Lineup
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;🔬 &lt;strong&gt;The Head Analyst:&lt;/strong&gt; The data purist. Grounds proposals strictly in match history, player matchups, boundary dimensions, and venue run-rates. Proposes the initial tactical move based on max-probability outcomes.&lt;/li&gt;
&lt;li&gt;😈 &lt;strong&gt;The Devil's Advocate:&lt;/strong&gt; The risk-taker. Contrarian mindset focused on exploiting dew factors, pitch behavior, and psychological pressure. Aggressively challenges the Analyst’s every move.&lt;/li&gt;
&lt;li&gt;👑 &lt;strong&gt;The Virtual Captain:&lt;/strong&gt; The pragmatic leader. Synthesizes the debate, weighs resources (like remaining overs), evaluates the game phase, and delivers the final, definitive decision.&lt;/li&gt;
&lt;/ul&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%2F9lpamlh65x2597k8jvxe.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%2F9lpamlh65x2597k8jvxe.png" alt=" " width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  The Debate Flow
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Match State Input&lt;/strong&gt; 2. &lt;strong&gt;Analyst&lt;/strong&gt; proposes a move.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Devil's Advocate&lt;/strong&gt; challenges and counters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Virtual Captain&lt;/strong&gt; evaluates the conflict and makes the final call.&lt;/li&gt;
&lt;li&gt;The UI renders the fan-friendly commentary output alongside the raw debate log.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🌪️ Innovation: Real-Time Agentic Tooling
&lt;/h2&gt;

&lt;p&gt;An AI is only as good as its data. To elevate Captain Cool, I equipped the agents with real-time API tools using &lt;strong&gt;Gemini Native Function Calling&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Micro-Climate &amp;amp; Dew Prediction Engine:&lt;/strong&gt; The &lt;em&gt;Devil's Advocate&lt;/em&gt; uses a Weather API to fetch live dew points, humidity, and wind speed. If humidity crosses 75% at a coastal venue like Chepauk, the agent dynamically calculates a "grip loss percentage" and forces the Captain to hold back spin bowlers due to a wet ball.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Geospatial Stadium &amp;amp; Pitch Analytics:&lt;/strong&gt; The &lt;em&gt;Head Analyst&lt;/em&gt; uses a venue database to map boundary dimensions and pitch soil profiles. If the wind is blowing towards a short 60m boundary at Chinnaswamy, the agent explicitly restricts bowling into the wind and suggests specific field placements (like a deep point) to protect the vulnerability.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These tools guarantee the debate is mathematically grounded in the actual physics of the current match.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔒 The Stack: Dual-Layer Auth &amp;amp; Modern Web
&lt;/h2&gt;

&lt;p&gt;The platform isn't just a backend script; it’s a fully realized web application with a sleek, monochromatic glassmorphism UI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authentication:&lt;/strong&gt; I implemented a &lt;strong&gt;Dual-Layer Auth Gateway&lt;/strong&gt; converging Web3 and Web2:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🦊 &lt;strong&gt;Web3:&lt;/strong&gt; MetaMask (&lt;code&gt;window.ethereum&lt;/code&gt;) handshake for decentralized identity.&lt;/li&gt;
&lt;li&gt;🔥 &lt;strong&gt;Web2:&lt;/strong&gt; Firebase Auth for classic Email/Password access.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Users configure their own Gemini API key via a secure settings dashboard, ensuring keys are safely held in the application state and never logged to the client console.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech Stack Breakdown:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Frontend:&lt;/strong&gt; React 19, Vite 8, Tailwind CSS 4, Framer Motion&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backend:&lt;/strong&gt; Hono.js on Bun (for blistering fast API routes)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI Orchestration:&lt;/strong&gt; Google Gemini 2.5 Pro, Agent Development Kit (ADK)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IDE:&lt;/strong&gt; Google Antigravity (Vibe-coded the entire session here!)&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🎮 A Live Scenario Walkthrough
&lt;/h2&gt;

&lt;p&gt;What does this look like in action? Let's say you input this state into the Brain Room:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Innings 2, Over 15.2, 42 runs needed off 28 balls. Big hitter on strike. Left-arm spinner has 1 over left. Dew is actively setting in. Venue: Wankhede.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;The Debate Visualizer outputs:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🔬 &lt;strong&gt;The Head Analyst:&lt;/strong&gt; &lt;em&gt;"Brings on the left-arm orthodox spinner. Matchup data shows the batsman struggles with away spin."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;😈 &lt;strong&gt;The Devil's Advocate:&lt;/strong&gt; &lt;em&gt;"Object. The ball is soaking wet due to heavy dew. The spinner will slip, lose control of length, and release pressure. Bring on the express pacer for cross-seam deliveries instead."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;👑 &lt;strong&gt;The Virtual Captain:&lt;/strong&gt; &lt;em&gt;"Debate closed. We save the spinner for the long-boundary side later. The pacer bowls over the wicket, targeting hard lengths into the pitch."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  🏅 Final Thoughts &amp;amp; Shoutouts
&lt;/h2&gt;

&lt;p&gt;Building a multi-agent orchestrated system in just 3 hours was an absolute adrenaline rush. It proved to me that the future of AI development isn't just about crafting the perfect prompt; it's about building ecosystems where specialized AI models can reason, argue, and utilize tools autonomously.&lt;/p&gt;

&lt;p&gt;A massive shoutout to ** @gdgcloudpune *&lt;em&gt;, especially *&lt;/em&gt;&lt;a class="mentioned-user" href="https://dev.to/antrixsh_gupta"&gt;@antrixsh_gupta&lt;/a&gt; *&lt;em&gt;, *&lt;/em&gt;&lt;a class="mentioned-user" href="https://dev.to/pratik_kale"&gt;@pratik_kale&lt;/a&gt; **, and the entire organizing team. The problem statement was brilliant, the vibe was electric, and events like this push the developer community to level up in incredible ways.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Cricket is a captain's game. Now AI captains it too.&lt;/em&gt; 🏆&lt;/p&gt;

&lt;p&gt;👇 &lt;strong&gt;Check out the code and try it yourself:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://www.google.com/search?q=https://github.com/Precise-Goals/capcool" rel="noopener noreferrer"&gt;Precise-Goals/capcool&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tech:&lt;/strong&gt; Google Gemini, React, Bun, Next.js, Firebase, Web3&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let me know in the comments what you think of multi-agent architectures or how you would have set the field for the final over! 🏏🔥&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>agentaichallenge</category>
      <category>automation</category>
    </item>
  </channel>
</rss>
