How to Build a DREAM11 Agent for IPL 2025


The Indian Premier League (IPL) isn’t just a tournament – it’s a high-stakes cricket carnival! Dream11 takes the thrill to another level, letting you build your ultimate fantasy team. But let’s be real one bad pick and your dream team could crash faster than a failed run chase! With unpredictable player form, ever-changing pitch conditions, and crucial team balance decisions, making the best Dream11 team for today’s match isn’t easy. Want to dodge the disappointment and boost your chances of becoming a Dream11 winner? AI-powered Dream11 agents can help you with the team selection and build the perfect fantasy cricket team for IPL 2025!

These intelligent assistants analyze vast cricket data, track real-time player performances, and study venue-specific pitch reports to help you craft the perfect squad. They optimize your Dream11 team selection by suggesting the best player combinations within your 100-credit budget. In this article, we’ll explore how AI-driven agents can revolutionize agent-based Dream11 team selection and give you a winning edge. Let’s dive in!

What is Dream11?

Dream11 is a fantasy cricket platform for cricket enthusiasts where users create virtual teams using real-life players. They earn points based on actual on-field performances, adding excitement to watching live matches. Here’s how it works:

  • Budget Management: Users get 100 credits to build a competitive team of 11 players.
  • Player Valuation: Each cricketer’s credit value is based on their form, consistency, and popularity.
  • Smart Team Selection: The key is to choose impactful players while staying within the credit limit.
  • Performance-Based Scoring: Players earn points for runs, wickets, catches, and strike rates.
  • Captain & Vice-Captain Bonus: Captains receive 2x points, while vice-captains earn 1.5x, making their selection crucial.
Dream11 fantasy cricket team IPL 2025

Managing all these factors manually is difficult, but our AI-powered agent makes it a cakewalk! It analyzes player stats, match conditions, and budget limits to help users build an optimized Dream11 team for IPL 2025. Let’s learn more about it.

What Can a Dream11 Agentic System Do?

Our Dream11 agentic system works through four specialized agents, each handling a crucial part of team building. Together, they deliver optimized selections for the perfect fantasy cricket dream team! Let’s understand the role of each agent in this system:

1. Today’s Teams Agent

The first agent analyzes the IPL matches scheduled for the day. Here’s what all it does:

  • Match & Team Analysis: Identifies IPL matches for the day and gathers past performance data of both teams.
  • Pitch Condition Assessment: Analyzes bounce, turn, and dryness to determine if conditions favor batsmen or bowlers.
  • Venue-Specific Insights: Evaluates historical win-loss ratios and scoring trends at the venue to refine predictions.

Also Read: IPL Team Win Prediction Project Using Machine Learning

2. User Team Selector agent

The second agent creates a personalized experience. Here’s how:

  • Personalized Team Selection: Asks users to choose their preferred match when multiple games are scheduled.
  • Focused Analysis: Prioritizes players from the selected teams to ensure relevant recommendations.
  • User-Friendly Interaction: Uses simple prompts with no technical knowledge required.
  • Efficient & Quick: Ensures fast responses, making the team selection process smooth and intuitive.

3. Players Agent

Our third agent performs comprehensive player analysis. It examines the complete IPL career statistics of all the selected players. This is what it does:

  • Comprehensive Player Analysis: Evaluates IPL career stats with a focus on IPL 2024 performance.
  • Role-Based Assessment: Analyzes batsmen by averages/strike rates, bowlers by economy/wickets, and all-rounders by overall impact.
  • Matchup Insights: Identifies players who perform well against specific opponents to maximize strategic advantages.
  • Talent Pool Creation: Shortlists 13 top players from each team, balancing form, history, and matchups for final selection.

Also Read: Building an IPL Score Predictor – End-To-End ML Project

4. Team Selector Agent

The final agent optimizes team selection by following Dream11’s rules and scoring system. Here’s how that works:

  • Rule-Based Selection: Ensures all position requirements are met while staying within the 100-credit budget (users must check credit values on the Dream11 app).
  • Data-Driven Optimization: Combines match analysis, user preferences, and player stats to build the strongest possible team.
  • Strategic Player Choices: Prioritizes high-impact players and carefully selects the captain and vice-captain to maximize points.
  • Post-Toss Execution: Running this agent after the toss ensures only confirmed players are selected, reducing the risk of benched players.

Also Read: Build a Winning Dream 11 Team Using Python and AI

Building the Dream11 AI Agent

Let’s break it down step by step! Now that we understand the key components, we’ll walk through how to build and run this AI-powered Dream11 team selection system. This section will explain how each agent processes data, makes decisions, and selects the best players. By following this guide, you’ll see how real-time stats, match analysis, and user inputs come together to create an optimized fantasy team.

Step 1: Importing the Libraries and API Keys

The first step in building our AI-powered Dream11 Team Selection Agent is to import necessary libraries and set up API keys for external tools. This ensures that the system can process data, interact with APIs, and perform searches related to IPL 2025.

import os
import re
import crewai
from crewai import Agent, Crew, Task, Process
from openai import OpenAI
from crewai_tools import SerperDevTool
import datetime
from crewai.tools import BaseTool
import warnings
warnings.filterwarnings("ignore")


with open("path_to_serper_api_key") as file:
   serper_api = file.read().strip()


with open("path_to_openai_api_key") as file:
   api_key = file.read().strip()


os.environ["SERPER_API_KEY"] = api_key
os.environ['OPENAI_API_KEY'] = serper_api


search = SerperDevTool(description="Search for the IPL 2025 teams and the records of their teams players that are playing IPL 2025 ",n_results=30)

Step 2: Creating the Today’s Teams Agent

The “Today’s Teams” Agent is responsible for identifying the teams playing on a given date, analyzing match conditions, and providing useful insights about the ground and past records. This agent plays a crucial role in helping users make informed decisions while selecting their Dream11 team.

The agent searches the given website to find the teams playing on a specific date. If the match is on a Sunday, it checks for two matches and provides details for both. If no matches are scheduled for that day, it simply states: “There is no match for Today.” This helps users stay updated on daily IPL fixtures.

The agent also provides details like team names, venue, and match start time. It analyzes pitch conditions to determine whether they favor batsmen or bowlers. Additionally, it checks past win-loss records of teams at that ground. This helps users understand how well teams have performed in previous matches at the same venue.

todays_teams = Agent(
   role="Todays Match Details Agent",
   goal="You have to search on this {url} and find the IPL teams that are facing on {date}",
   backstory="You are an expert in finding the cricket news across the web.",
   tools=[search],
   llm="gpt-4o-mini",
   verbose=True
)
get_todays_teams = Task(
   name= "Todays Match Details",
   description="""You have to find the teams that are going to play on {date} from the url: {url}.
   If there is sunday on date then 2 matches on a same day than give the details of both matches.
   If there is no match on date then just say: "There is no match for date".""",
  
   expected_output="""Give the names of the teams, Where they are playing and at what time(in PM) the match will start.
   Also give the information about the pitch condition and the past records like numbers of losses and wins of the. Teams on that ground.
   If there is sunday on date then 2 matches on a same day than give the details of both matches.
   If their isn't any match on date then say: "There is no match for "" .""",
   agent=todays_teams)

This is what the response of this agent looks like:

Dream11 AI Agent response

Step 3: Building the User Team Selector Agent

The User Team Selector Agent helps users choose the match they want to create a Dream11 team for. If multiple matches are scheduled on the same day, the agent asks the user to select their preferred teams. This ensures the Dream11 team is created for the right match.

Once the user selects the teams, the agent saves their names in a specific format: “team_1 vs team_2.” This information is stored for further processing. By confirming the teams beforehand, the system ensures the recommendations are relevant and aligned with the user’s choice.

user_team_selector = Agent(
   role="User Team Selector",
   goal="Ask the user to about the teams for which he/she wants to make dream11 team.",
   backstory="An helpful assistant the ask user abut the teams names for which he wants to make team",
   llm="gpt-4o-mini",
   max_execution_time=1,
   verbose=True,
)
select_teams = Task(
   name="Team Selector for dream11",
   description="Ask the user about the teams he wants to choose for making dream11 team",
   expected_output=" Returns the name of teams in this specific folder: team_1 vs team_2",
   human_input=True,
   agent=user_team_selector,
   context=[get_todays_teams]
)

Step 4: Creating the Players Agent

The Players Agent identifies and analyzes the performance of players from the selected teams and fetches the playing 11 for each team for that match. The agent collects detailed statistics, including IPL career records, IPL 2024 performance, and recent forms over the last year. This ensures users get data-driven insights while selecting their Dream11 team.

For batsmen, it provides stats like matches played, runs scored, strike rate, and career highlights. For bowlers, it includes wickets taken, economy rate, and best bowling figures. All-rounders get both batting and bowling stats. With this data, users can pick the most in-form players for an optimized team.

players = Agent(
   role="Player Analyst",
   goal="Give the name of the players that are playing teams selected by user in IPL 2025.",
   backstory="Expert in searching on web  and give the current team players with stats.",
   llm="gpt-4o-mini",
   tools=[search_1],
   verbose=True
)
players_task=Task(
   name="player selector",
   description="Search this website {team_players} to get the current IPL players for the teams selected by user_team_selector agent and give the names of the players that are playing in 2025 for the teams selected by user.",
   expected_output="""Names of the players (playing 11 players for that match) selected by each team with their IPL stats starting from their IPL carrier up to  IPL 2024 record and their recent stats with in last 1 year:
   name of team 1:
       For Batsmen: Stats like:
       Matches, Runs, Average, Strike-Rate,50's, 100's, HighScore and Career Highlights.
       For Bowlers: Stats like:
       Matches Wickets, Economy, Average, Best Bowling and Career Highlights
       For All Rounders: Stats Like:
       Batting Stats: Matches, Runs, Average, Strike-Rate,50's, 100's, HighScore and Career Highlights.
       Bowling Stats: Matches Wickets, Economy, Average, Best Bowling and Career Highlights
   name of team 2:
       For Batsmen: Stats like:
       Matches, Runs, Average, Strike-Rate,50's, 100's, HighScore and Career Highlights.
       For Bowlers: Stats like:
       Matches Wickets, Economy, Average, Best Bowling and Career Highlights
       For All Rounders: Stats Like:
       Batting Stats: Matches, Runs, Average, Strike-Rate,50's, 100's, HighScore and Career Highlights.
       Bowling Stats: Matches Wickets, Economy, Average, Best Bowling and Career Highlights
   """,
   agent=players,
   tools=[search_1],
   context=[select_teams])

Step 5: Building the Team Selector Agent

The Team Selector Agent ensures the optimal selection of a Dream11 team while also giving the user flexibility to make changes. It selects 11 players plus 2 additional backups based on player stats, match conditions, and Dream11 rules, ensuring that the final lineup maximizes T20 fantasy points. The agent follows strict team composition guidelines, including:

  • 1-4 Wicket-keepers
  • 3-6 Batsmen
  • 1-4 All-rounders
  • 3-6 Bowlers
  • Maximum 7 players from one team
  • Total team credit within 100 points

The selection process considers batting, bowling, and fielding performances, including strike rates, economy rates, and bonus criteria like half-centuries, five-wicket hauls, and direct-hit run-outs. The agent also ensures that the captain (2x points) and vice-captain (1.5x points) selection is based on a player’s potential to score maximum fantasy points.

A key feature of this agent is that it allows user intervention. If the user wants to add a preferred player, the system prompts them to choose a replacement. This ensures the final team aligns with the user’s preferences while still adhering to Dream11 rules. Once finalized, the agent provides a detailed breakdown of the team, including selection justifications based on form, conditions, and player performance history.

team_selector = Agent(
    role="Dream11 Team Selector",
    goal="Create the optimal Dream11 team based on match conditions, player stats, and team composition rules",
    backstory="You are a Dream11 expert who knows how to balance team selection, captaincy choices, and credit allocation to maximize points potential.",
    # tools=[search_tool],
    llm="gpt-4o-mini",
    verbose=True
)

select_players = Task(
    name="Select Dream11 Players",
    description="""Select the best 11 players for a Dream11 team based on the match analysis and player statistics. Make sure you don't exceed team with more than 100 points. So choose the players accordingly:
    Follow Dream11 rules:
    - Total of 11 players (including Captain and Vice-Captain)
    - 1-4 Wicket-keepers
    - 3-6 Batsmen
    - 1-4 All-rounders
    - 3-6 Bowlers
    - Maximum 7 players from any one team
    
Select the players so that they can help in maximizing the T20 Fantasy Cricket Points System

Batting Points
Run                                       +1
Boundary Bonus                            +4
Six Bonus                                 +6
25 Run Bonus                              +4
Half-Century Bonus                        +8
75 Run Bonus                             +12
Century Bonus                            +16
Dismissal for a duck                     -2
(Batter, Wicket-Keeper, & All-Rounder)   

Important points
Any player scoring a century will only get points for the century. No points such as 30 run Bonus or Half-century Bonus will be awarded here. Additionally, no points are awarded for centuries in T10 matches.
If any runs are scored on an overthrow, points for those runs will be credited to the batter on strike for that ball. However, if the overthrow goes for a boundary, the batter will not receive extra Boundary Bonus points.

Bowling Points
Dot Ball                                +1
Wicket (Excluding Run Out)              +25
Bonus (LBW/Bowled)                      +8
3 Wicket Bonus                          +4
4 Wicket Bonus                          +8
5 Wicket Bonus                         +12
Maiden Over                            +12


Fielding Points
Catch                                   +8
3 Catch Bonus                           +4
Stumping                                +12
Run out (Direct hit)                    +12
Run out (Not a direct hit)              +6
Important points
A direct hit is inflicted by the fielder, who is the only one to touch the ball after the batter faces the delivery. In all other cases, points will be awarded only to the last 2 fielders who touch the ball.
Players taking more than 3 catches will also get 4 points as 3 Catch Bonus. For example, if a player takes 6 catches, they will not get 8 points.

Other Points
Captain                                  2X
Vice Captain                             1.5x
In announced lineups                     +4

Economy Rate Points (Min 2 Overs To Be Bowled)
Below 5 runs per over                    +6
Between 5-5.99 runs per over             +4
Between 6-7 runs per over                +2
Between 10-11 runs per over              -2
Between 11.01-12 runs per over           -4
Above 12 runs per over                   -6


Strike Rate (Except Bowler) Points (Min 10 Balls To Be Played)
Above 170 runs per 100 bowls             +6
Between 150.01-170 runs per 100 balls    +4
Between 130-150 runs per 100 balls       +2
Between 60-70 runs per 100 balls         -2
Between 50-59.99 runs per 100 balls      -4
Below 50 runs per 100 balls              -6
Important points
Negative points for low batting Strike Rates are only applicable for individual Strike Rates of 70 runs per 100 balls or below.

Playing Substitute
Concussion, X-Factor, or Impact Player   +4
   
Use the match information  and the match analysis from the previous (players_task)task to select players.
For each selected player, provide rationale based on their statistics, current form, pitch conditions, and matchup specifics.
    """,
    expected_output="""A complete Dream11 team with:
    - List of all 11 players with their roles (WK/BAT/AR/BOWL) + 2 additional players total 13 players
    - Captain and Vice-Captain selections with reasoning
    - Team breakdown (how many players from each team)
    - Rationale for key selections based on match conditions and player statistics
    If user want to add it's own choice player from both teams change that to the player he want to remove
    """,
    agent=team_selector,
    context=[players_task],
    human_input=True
)
team_crew = Crew(
   agents=[user_team_selector,players,team_selector],
   tasks=[select_teams,players_task,select_players],
   process=Process.sequential,
   verbose=True
)

Step 6: Finalizing the Dream11 IPL Team

After carefully analyzing player statistics, match conditions, and Dream11 rules, the agentic system selects the final Dream11 team, maximizing fantasy points while maintaining a balanced composition. This team ensures a strong mix of batsmen, bowlers, all-rounders, and wicket-keepers, optimizing both scoring potential and strategic depth. Below is the detailed breakdown of the selected players, captaincy choices, and justification for each selection:

from IPython.display import Markdown, display
team_result = team_result.raw
display(Markdown(team_result))
Dream11 AI Agent for your IPL 2025 team selection
cricket captain and vice-captain selections
Player selection

How Can We Improvise Our Team Selection System?

Making the Dream11 Team Selection System better means using real-time data, automation, and smart analysis. While the current method picks a strong team, there are ways to make it even more accurate and effective.

Here are some ways to improve it:

  1. Real-Time Player Credit Details: For precise credit values, refer to the Dream11 app as they may change frequently based on player performance and team selection.
  2. Implement a RAG-Based System: Integrate a Retrieval-Augmented Generation (RAG) approach with a database of IPL player stats, past performances, and team records to enhance decision-making. This allows the agent to fetch real-time insights and make data-backed recommendations.
  3. Run the System After the Toss: Execute the team selection agent only after the toss, as the playing 11 is confirmed at that time. This ensures that only confirmed players are considered, avoiding last-minute changes and maximizing points.
  4. User Customization & Overrides: Allow users to swap players based on personal preferences while ensuring team balance and credit limits are maintained.

Also Read: Data Science Project: Creating an IPL Win Prediction App

Conclusion

The Dream11 Agent for IPL 2025 transforms fantasy cricket through its four-agent AI system. By analyzing match conditions, player statistics, and team dynamics while respecting budget constraints, it delivers optimized selections that balance user preferences.

As cricket continues to evolve, this agent allows users to make informed decisions without sacrificing the personal touch that makes fantasy sports engaging. Future improvements like real-time updates and post-toss optimization will further enhance the agent’s accuracy, giving users a competitive edge while making fantasy cricket more engaging and rewarding.

Frequently Asked Questions

Q1. How does AI select players for the Dream11 team?

A. The Dream11 agentic system analyzes player stats, recent performance, pitch conditions, and matchups to create an optimized team.

Q2. Can I customize the Dream11 team based on my preferences?

A. Yes, you can swap players, change captain/vice-captain, or adjust selections before finalizing your team.

Q3. When should I run this system for the best results?

A. It’s best to run it after the toss to ensure all selected players are in the playing XI.

Q4. What precautions should I take before finalizing my Dream11 team?

A. Check weather conditions, team news, and last-minute updates to avoid selecting non-playing players.

Q5. How important is the captain and vice-captain selection in Dream11 cricket?

A. Very important! The captain gets 2x points, and the vice-captain gets 1.5x points, so picking consistent performers is crucial.

Q6. Is past performance the best way to pick players for a Dream11 team?

A. Past performance matters, but consider current form, pitch conditions, and opposition strength for better accuracy.

Hi, I’m Vipin. I’m passionate about data science and machine learning. I have experience in analyzing data, building models, and solving real-world problems. I aim to use data to create practical solutions and keep learning in the fields of Data Science, Machine Learning, and NLP. 

Login to continue reading and enjoy expert-curated content.

We will be happy to hear your thoughts

Leave a reply

Som2ny Network
Logo
Compare items
  • Total (0)
Compare
0