<?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: Angel Macwan</title>
    <description>The latest articles on DEV Community by Angel Macwan (@angel_macwan_cfb0a96ed25c).</description>
    <link>https://dev.to/angel_macwan_cfb0a96ed25c</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%2F1719390%2F7224533a-0763-4532-9ed9-19534b30fb75.png</url>
      <title>DEV Community: Angel Macwan</title>
      <link>https://dev.to/angel_macwan_cfb0a96ed25c</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/angel_macwan_cfb0a96ed25c"/>
    <language>en</language>
    <item>
      <title>Captain Cool: A Multi-Agent AI That Thinks Like an IPL Captain</title>
      <dc:creator>Angel Macwan</dc:creator>
      <pubDate>Sun, 17 May 2026 12:56:46 +0000</pubDate>
      <link>https://dev.to/angel_macwan_cfb0a96ed25c/captain-cool-a-multi-agent-ai-that-thinks-like-an-ipl-captain-1o3f</link>
      <guid>https://dev.to/angel_macwan_cfb0a96ed25c/captain-cool-a-multi-agent-ai-that-thinks-like-an-ipl-captain-1o3f</guid>
      <description>&lt;h1&gt;
  
  
  Captain Cool: A Multi-Agent AI That Thinks Like an IPL Captain
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;What happens when you give six AI agents a live cricket match and ask them to argue about it?&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Cricket is decided in moments. A bowling change at the wrong over, a misjudged pitch, a batsman promoted too early — the margins are razor thin and the decisions are made in seconds. Yet even the sharpest captains have one brain working against twenty variables at once.&lt;/p&gt;

&lt;p&gt;Captain Cool is a multi-agent AI system built to change that. Feed it a live IPL match state and it deliberates — with real dissent, real data, and real cricket language — producing a confident tactical recommendation before the next ball is bowled.&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%2F33fhm0m7ow9n9n0aerqd.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%2F33fhm0m7ow9n9n0aerqd.png" alt=" " width="800" height="596"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It does this via two distinct agentic architectures:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;The Tactical War Room&lt;/strong&gt;: A structured &lt;strong&gt;LangGraph&lt;/strong&gt; pipeline of specialist agents.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;OASIS Social Simulation&lt;/strong&gt;: An emergent social simulation where dynamically synthesized personas debate across multiple rounds.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The Technology Stack
&lt;/h2&gt;

&lt;p&gt;To achieve real-time, grounded reasoning, we built on a pure &lt;strong&gt;Google Gemini&lt;/strong&gt; stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Gemini 2.5 Flash&lt;/strong&gt; — The backbone for all agents, chosen for its low latency and high reasoning capability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Search Grounding&lt;/strong&gt; — Live web search injected into agent context to fetch real-time player form and match-ups.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LangGraph&lt;/strong&gt; — Orchestrates the agents as an explicit state machine with typed state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FastAPI + SSE&lt;/strong&gt; — Streams agent output character-by-character to the frontend for a "live debate" experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Next.js&lt;/strong&gt; — A responsive dashboard for match input and visualization.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Mode 1: The Tactical War Room (LangGraph)
&lt;/h2&gt;

&lt;p&gt;The War Room is modeled as a directed graph where state flows through specialist nodes. Unlike a simple chain, each node has a specific role, system instruction, and tool access.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Architecture
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;graph TD
    Start((Start)) --&amp;gt; StatsGuru[Stats Guru]
    StatsGuru --&amp;gt; PitchSpec[Pitch Specialist]
    PitchSpec --&amp;gt; LeadStrat[Lead Strategist]
    LeadStrat --&amp;gt; DevilsAdvocate[Devil's Advocate]
    DevilsAdvocate --&amp;gt; Refiner[Lead Strategist - Refine]
    Refiner --&amp;gt; Commentator[Match Commentator]
    Commentator --&amp;gt; Synthesizer[Report Synthesizer]
    Synthesizer --&amp;gt; End((End))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The "War Room" State
&lt;/h3&gt;

&lt;p&gt;We use a &lt;code&gt;TypedDict&lt;/code&gt; to manage the evolving match context. Every agent can read the previous reasoning and append its own analysis.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;WarRoomState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;TypedDict&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;match_state&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;dict&lt;/span&gt;
    &lt;span class="n"&gt;stats_analysis&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;pitch_report&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;strategy_proposal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;devils_challenge&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;strategy_revised&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;commentary&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;debate_log&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;List&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;final_decision&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;
    &lt;span class="n"&gt;confidence_score&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Specialized Prompts
&lt;/h3&gt;

&lt;p&gt;Each agent is driven by a high-fidelity system prompt. For example, the &lt;strong&gt;Devil's Advocate&lt;/strong&gt; is explicitly instructed to be relentless:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;System Prompt:&lt;/strong&gt; &lt;em&gt;"You are the 'Devil's Advocate'. Your sole purpose is to find the flaw in the Lead Strategist's plan. You MUST challenge the proposal. Even if it seems sound, find the risk. Angles: 'What if the dew worsens faster?', 'Are we burning our best death bowler two overs too early?'"&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And the &lt;strong&gt;Stats Guru&lt;/strong&gt; handles the data grounding:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;System Prompt:&lt;/strong&gt; &lt;em&gt;"You deliver cold, hard cricket analytics. If the striker name is provided, ALWAYS search Google for their recent IPL stats and match-ups. Cite every number you use (e.g., 'SR 145 vs leg-spin in last 5 seasons')."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Physics-Based Win Probability Tool
&lt;/h3&gt;

&lt;p&gt;Before the LLM reasoning begins, we invoke a custom tool to ground the agents in mathematical reality. This prevents "hallucinated optimism."&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;calculate_win_probability&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;innings&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;over&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;score&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;wickets&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;target&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dew&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Physics-informed calculation
&lt;/span&gt;    &lt;span class="n"&gt;projected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;current_score&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;current_rr&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;overs_remaining&lt;/span&gt;
    &lt;span class="n"&gt;diff&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;projected&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;par_score&lt;/span&gt;
    &lt;span class="n"&gt;base_prob&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;diff&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;wicket_penalty&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;wickets_remaining&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;2.5&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;95&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;base_prob&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;wicket_penalty&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fin8l0bojixy48zd0dk8z.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%2Fin8l0bojixy48zd0dk8z.png" alt=" " width="800" height="570"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Mode 2: OASIS Social Simulation
&lt;/h2&gt;

&lt;p&gt;While the War Room is hierarchical, the &lt;strong&gt;OASIS mode&lt;/strong&gt; is emergent. It simulates the social dynamics of a coaching staff.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stage 1: Dynamic Persona Synthesis
&lt;/h3&gt;

&lt;p&gt;Instead of static roles, we use Gemini to synthesize 3 personas grounded in the &lt;em&gt;specific&lt;/em&gt; match context. Chasing a high score in Bangalore? It might generate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Coach Baz&lt;/strong&gt;: Aggressive, high-risk, "Bazball" philosophy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Dravid&lt;/strong&gt;: Analytical, conservative, focuses on historical averages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Old-School Rao&lt;/strong&gt;: Spin-wary, respects the "V" and conditions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Stage 2: The Multi-Round Debate
&lt;/h3&gt;

&lt;p&gt;The simulation runs for 3 rounds. In each turn, the persona reads the &lt;em&gt;entire&lt;/em&gt; transcript of the debate so far. This allows for &lt;strong&gt;opinion evolution&lt;/strong&gt;: Data Dravid might concede a point to Coach Baz if the search results show a specific match-up advantage.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Round 1: Initial recommendations.
Round 2: Personas challenge each other's reasoning.
Round 3: Final attempts at consensus or principled dissent.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Ftutk8jgiy2i4jb218dqx.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%2Ftutk8jgiy2i4jb218dqx.png" alt=" " width="800" height="511"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Walkthrough: The Death Over Dilemma
&lt;/h2&gt;

&lt;p&gt;Let's look at a real scenario: &lt;strong&gt;GT vs RR, 17th Over, chasing 190. Rashid Khan on strike.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Stats Guru&lt;/strong&gt; calls Google Search. Finds Rashid's SR against pace in the last 2 years is 190, but drops to 110 against high-quality leg-spin.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Pitch Specialist&lt;/strong&gt; notes the dew factor is 8/10. The ball is like a bar of soap.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Lead Strategist&lt;/strong&gt; proposes bringing on the lead pacer (Bumrah) to "blow him away" with yorkers.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Devil's Advocate&lt;/strong&gt; intervenes: &lt;em&gt;"Wait! If we burn Bumrah now, who bowls the 20th? Rashid loves pace on the ball. If the pacer misses the yorker by an inch, it's over the ropes. Use the leggie — Rashid's ego will make him hit against the spin into the wind."&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Refiner&lt;/strong&gt; pivots: The Lead Strategist agrees with the risk of "pace on" and decides to hold the pacer back, opting for the spinner with a deep mid-wicket trap.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt; A decision that factors in player psychology, environmental constraints (dew), and resource management (overs remaining).&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%2Fjaqi016te1o0zeatf4lr.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%2Fjaqi016te1o0zeatf4lr.png" alt=" " width="800" height="323"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Innovation: Why Multi-Agent?
&lt;/h2&gt;

&lt;p&gt;Most cricket AI gives you a number. Captain Cool gives you an &lt;strong&gt;argument&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;By decomposing the problem into specialist roles (Pitch vs. Stats vs. Strategy) and then pressure-testing it with a Devil's Advocate, we mimic the real-world high-pressure deliberation of a dugout. The use of &lt;strong&gt;Google Search Grounding&lt;/strong&gt; ensures the agents are talking about &lt;em&gt;this&lt;/em&gt; version of the player, not their career average from 2018.&lt;/p&gt;




&lt;h2&gt;
  
  
  Explore the Project
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Prompt Gallery:&lt;/strong&gt; &lt;a href="https://aistudio.google.com/app/prompts" rel="noopener noreferrer"&gt;View our Agent Prompts in AI Studio&lt;/a&gt; &lt;em&gt;(Simulated Link - Prompts are in the repo)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Architecture Source:&lt;/strong&gt; Check out &lt;code&gt;war_room.py&lt;/code&gt; and &lt;code&gt;simulation_loop.py&lt;/code&gt; for the LangGraph and OASIS implementations.&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%2F4fy9zqy3fesp25dxu86i.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%2F4fy9zqy3fesp25dxu86i.png" alt=" " width="800" height="300"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Built at Build with AI Hackathon, May 2026. Powered by Gemini 2.5 Flash, LangGraph, and a genuine love for IPL cricket.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>gdgcloudpune</category>
      <category>apl2026</category>
    </item>
  </channel>
</rss>
