Skip to content

Prajwal471/Captain_cool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏏 Captain Cool - Multi-Agent IPL Strategist 🏏

Welcome to Captain Cool, a robust, multi-agent AI orchestration pipeline designed to simulate the elite decision-making process of legendary IPL T20 cricket captains. Powered by the Gemini 2.5 Flash model and the official Google GenAI SDK, this tool acts as a comprehensive match strategist for the IPL 2026 season.

Overview

Captain Cool utilizes a three-agent architecture to evaluate real-time IPL match situations, fetch relevant statistics, propose tactical moves, aggressively challenge them, and make a finalized "Captain Cool" decision.

The Agents

  1. Stats Analyst 📊: Consumes the match state and leverages tool calling (fetch_live_match_data, fetch_historical_stats) to fetch precise numbers, matchups, pitch conditions, and historical data.
  2. Strategist (Initial Proposal) 🧠: Acting as "Captain Cool," this agent reviews the Analyst's report and the current match state to formulate a single, actionable tactical plan using authentic cricket terminology.
  3. Devil's Advocate 👿: A highly critical assistant coach who aggressively challenges the Strategist's proposal. This agent looks for counter-matchups, momentum risks, and flaws in the plan.
  4. Strategist (Final Decision) 🏆: The Captain's final word. After absorbing the Devil's Advocate's critique, the Strategist either pivots or sticks to the original plan, explaining the cricket logic behind the decision.

Features

  • Interactive CLI: A beautiful command-line interface powered by rich, prompting users for real-time match details (Innings, Required Run Rate, Pitch Conditions, Bowlers Remaining, etc.).
  • Tool Calling: The Stats Analyst automatically calls mock Python functions to fetch live data and historical player statistics.
  • Resiliency: Incorporates the tenacity library for exponential backoff retries, ensuring stability against API rate limits.
  • Authentic Tone: The prompt engineering ensures agents speak in true cricket jargon without generic AI terminology.

Setup & Installation

  1. Clone the Repository: Ensure you have the captain_cool directory.
  2. Install Dependencies:
    pip install -r requirements.txt
    (Requires google-genai, rich, tenacity, python-dotenv)
  3. Environment Variables: Create a .env file in the root directory and add your Gemini API Key:
    GEMINI_API_KEY=your_api_key_here

Usage

Run the main script to start the interactive CLI:

python main.py

You will be prompted to enter match details (or press Enter to use defaults). The pipeline will then kick off, and you'll see the multi-turn debate unfold in your terminal with colored panels.

To run a programmatic test without user input:

python test_run.py

Project Structure

  • main.py: The entry point for the interactive CLI application.
  • orchestrator.py: Contains the multi-agent pipeline logic, handling the turn-by-turn conversation and API calls.
  • agents.py: Holds the system prompts defining the persona of each agent.
  • tools.py: Contains the tool functions (fetch_historical_stats, fetch_live_match_data) used by the Stats Analyst.
  • test_run.py: A script for running programmatic tests of the pipeline.

Technologies Used

  • Google GenAI SDK (google-genai)
  • Gemini 2.5 Flash
  • Python 3.10+
  • Rich (for terminal UI)
  • Tenacity (for robust API retries)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages