<?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: Hemant Choudhary</title>
    <description>The latest articles on DEV Community by Hemant Choudhary (@hemant_choudhary_72859653).</description>
    <link>https://dev.to/hemant_choudhary_72859653</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%2F3936249%2Febc0611f-cc0a-46ec-98cc-c10b497dffe8.jpg</url>
      <title>DEV Community: Hemant Choudhary</title>
      <link>https://dev.to/hemant_choudhary_72859653</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hemant_choudhary_72859653"/>
    <language>en</language>
    <item>
      <title>Captain Cool AI — Building a Multi-Agent IPL Tactical Engine with FastAPI, Next.js &amp; Gemini AI 🚀🏏</title>
      <dc:creator>Hemant Choudhary</dc:creator>
      <pubDate>Sun, 17 May 2026 12:40:56 +0000</pubDate>
      <link>https://dev.to/hemant_choudhary_72859653/captain-cool-ai-building-a-multi-agent-ipl-tactical-engine-with-fastapi-nextjs-gemini-ai-1i06</link>
      <guid>https://dev.to/hemant_choudhary_72859653/captain-cool-ai-building-a-multi-agent-ipl-tactical-engine-with-fastapi-nextjs-gemini-ai-1i06</guid>
      <description>&lt;p&gt;Introduction&lt;/p&gt;

&lt;p&gt;What if an AI could think like an IPL captain during a high-pressure chase?&lt;/p&gt;

&lt;p&gt;That idea led me to build Captain Cool AI — a multi-agent cricket strategy engine inspired by the calm tactical mindset of legendary IPL captains.&lt;/p&gt;

&lt;p&gt;The system analyzes match situations, debates strategies internally using multiple AI agents, and finally generates tactical recommendations in real-time.&lt;/p&gt;

&lt;p&gt;This project combines:&lt;/p&gt;

&lt;p&gt;FastAPI backend&lt;br&gt;
Next.js frontend&lt;br&gt;
Gemini AI&lt;br&gt;
Multi-agent architecture&lt;br&gt;
Cricket analytics&lt;br&gt;
Tactical reasoning&lt;br&gt;
The Idea 💡&lt;/p&gt;

&lt;p&gt;During a T20 chase, captains constantly make decisions like:&lt;/p&gt;

&lt;p&gt;Should we attack or rotate strike?&lt;br&gt;
Which bowler should be targeted?&lt;br&gt;
How does dew affect spin?&lt;br&gt;
Should we preserve wickets?&lt;/p&gt;

&lt;p&gt;Instead of using a single AI response, I designed a multi-agent workflow where different agents think independently before making a final decision.&lt;/p&gt;

&lt;p&gt;Multi-Agent Architecture 🧠&lt;/p&gt;

&lt;p&gt;The system contains 5 specialized AI agents:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Stats Analyst&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Analyzes:&lt;/p&gt;

&lt;p&gt;Required run rate&lt;br&gt;
Batter matchups&lt;br&gt;
Pitch behavior&lt;br&gt;
Historical trends&lt;br&gt;
Dew factor&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Strategist&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Creates the tactical plan:&lt;/p&gt;

&lt;p&gt;Batting intent&lt;br&gt;
Over-by-over approach&lt;br&gt;
Bowler targeting strategy&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Devil’s Advocate&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Challenges the proposed strategy:&lt;/p&gt;

&lt;p&gt;Risks&lt;br&gt;
Weaknesses&lt;br&gt;
Failure possibilities&lt;br&gt;
Alternate viewpoints&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Decision Maker (Captain Cool)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Acts like the final captain:&lt;/p&gt;

&lt;p&gt;Evaluates all viewpoints&lt;br&gt;
Makes final tactical call&lt;br&gt;
Assigns confidence score&lt;br&gt;
Suggests backup plan&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Match Commentator&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Explains the decision in a commentator-style narrative.&lt;/p&gt;

&lt;p&gt;Tech Stack ⚙️&lt;br&gt;
Frontend&lt;br&gt;
Next.js&lt;br&gt;
React&lt;br&gt;
Tailwind CSS&lt;br&gt;
Axios&lt;br&gt;
Backend&lt;br&gt;
FastAPI&lt;br&gt;
Python&lt;br&gt;
Pydantic&lt;br&gt;
AI&lt;br&gt;
Gemini AI API&lt;br&gt;
Backend Architecture 🔥&lt;/p&gt;

&lt;p&gt;The FastAPI backend exposes 3 main routes:&lt;/p&gt;

&lt;p&gt;POST /analyze&lt;br&gt;
POST /debate&lt;br&gt;
POST /decision&lt;br&gt;
/analyze&lt;br&gt;
Generates statistical analysis&lt;br&gt;
Produces strategic proposal&lt;br&gt;
/debate&lt;br&gt;
Devil’s Advocate critiques strategy&lt;br&gt;
/decision&lt;br&gt;
Final tactical decision&lt;br&gt;
Confidence score&lt;br&gt;
Backup strategy&lt;br&gt;
Commentary generation&lt;br&gt;
Cricket Intelligence Layer 🏏&lt;/p&gt;

&lt;p&gt;I created custom cricket insight tools such as:&lt;/p&gt;

&lt;p&gt;lookup_venue_average_score()&lt;br&gt;
get_batter_vs_bowler_matchup()&lt;br&gt;
analyze_phase_economy()&lt;/p&gt;

&lt;p&gt;These simulate:&lt;/p&gt;

&lt;p&gt;Venue behavior&lt;br&gt;
Batter matchups&lt;br&gt;
Dew impact&lt;br&gt;
Pitch conditions&lt;br&gt;
Frontend UI 🎨&lt;/p&gt;

&lt;p&gt;The UI was designed to feel like:&lt;/p&gt;

&lt;p&gt;An IPL tactical dashboard&lt;br&gt;
A captain’s strategy room&lt;br&gt;
Real-time match intelligence panel&lt;/p&gt;

&lt;p&gt;Features include:&lt;/p&gt;

&lt;p&gt;Match context input&lt;br&gt;
Tactical strategy generation&lt;br&gt;
Multi-agent output display&lt;br&gt;
Confidence indicators&lt;br&gt;
Commentary section&lt;br&gt;
Biggest Challenges 😅&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Python Import Errors&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Initially faced:&lt;/p&gt;

&lt;p&gt;ModuleNotFoundError&lt;/p&gt;

&lt;p&gt;Solved using:&lt;/p&gt;

&lt;p&gt;Proper project structure&lt;br&gt;
&lt;strong&gt;init&lt;/strong&gt;.py&lt;br&gt;
Correct uvicorn execution path&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;API Connection Issues&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Frontend was unable to connect to backend because of:&lt;/p&gt;

&lt;p&gt;Wrong API URLs&lt;br&gt;
CORS configuration&lt;br&gt;
Incorrect localhost routing&lt;/p&gt;

&lt;p&gt;Solved by:&lt;/p&gt;

&lt;p&gt;CORSMiddleware&lt;/p&gt;

&lt;p&gt;and proper API base configuration.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Gemini API Quota Limits&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The Gemini free tier rate limits caused:&lt;/p&gt;

&lt;p&gt;429 RESOURCE_EXHAUSTED&lt;/p&gt;

&lt;p&gt;To handle this:&lt;/p&gt;

&lt;p&gt;Added fallback strategies&lt;br&gt;
Optimized prompts&lt;br&gt;
Used lighter models for faster responses&lt;br&gt;
What Makes This Project Unique? 🚀&lt;/p&gt;

&lt;p&gt;Unlike basic AI chat apps, this system:&lt;/p&gt;

&lt;p&gt;Simulates collaborative AI reasoning&lt;br&gt;
Uses debate-driven decision making&lt;br&gt;
Mimics real IPL tactical analysis&lt;br&gt;
Produces explainable strategies&lt;/p&gt;

&lt;p&gt;It’s closer to a real AI coaching engine than a chatbot.&lt;/p&gt;

&lt;p&gt;Future Improvements 🔮&lt;/p&gt;

&lt;p&gt;Planned upgrades:&lt;/p&gt;

&lt;p&gt;Real-time IPL API integration&lt;br&gt;
Ball-by-ball live prediction&lt;br&gt;
Win probability engine&lt;br&gt;
Voice commentary&lt;br&gt;
Captain personality modes&lt;br&gt;
Agent memory system&lt;br&gt;
Final Thoughts ❤️&lt;/p&gt;

&lt;p&gt;Building this project taught me:&lt;/p&gt;

&lt;p&gt;Multi-agent system design&lt;br&gt;
Backend/frontend integration&lt;br&gt;
AI orchestration&lt;br&gt;
Prompt engineering&lt;br&gt;
FastAPI architecture&lt;br&gt;
Real-world debugging under pressure 😄&lt;/p&gt;

&lt;p&gt;This was one of the most exciting AI projects I’ve built so far.&lt;/p&gt;

&lt;p&gt;GitHub Repository&lt;br&gt;
&lt;a href="https://github.com/HemantXCode/captain-cool-ai" rel="noopener noreferrer"&gt;https://github.com/HemantXCode/captain-cool-ai&lt;/a&gt;&lt;br&gt;
Conclusion&lt;/p&gt;

&lt;p&gt;AI is no longer just about generating text.&lt;/p&gt;

&lt;p&gt;The future is collaborative AI systems where multiple agents reason together to solve complex problems.&lt;/p&gt;

&lt;p&gt;And cricket strategy turned out to be a perfect playground for experimenting with that idea.&lt;/p&gt;

&lt;p&gt;🏏🔥 @gdgcloudpune , &lt;a class="mentioned-user" href="https://dev.to/antrixsh_gupta"&gt;@antrixsh_gupta&lt;/a&gt; , &lt;a class="mentioned-user" href="https://dev.to/pratik_kale"&gt;@pratik_kale&lt;/a&gt; #gdgcloudpune&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>gemini</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
