Inspiration

I think if we watch football then at least one time you will find yourself in fantasy football. I've always enjoyed fantasy football but I always found myself making decisions based on gut feeling rather than actual data. Which players are genuinely in form? Who should I transfer out? Is my goalkeeper even worth starting? These are questions that take real time to research and most fantasy tools just give you raw stats and leave you to figure it out yourself. The 2026 World Cup is the biggest in history with 48 teams and over 100 matches. That's a massive amount of data and a lot of decisions for fantasy managers to make. I wanted to build something that didn't just surface information but actually acted on it for you.

What it does

Pitchside is an AI fantasy football agent built for the 2026 World Cup. Instead of just answering questions, it actually manages your fantasy team for you. You can ask it to recommend an optimal lineup and watch the pitch view update in real time with the agent's picks. You can ask it to suggest a transfer and it will identify your weakest player and find the best available replacement with a points gain estimate. It can compare two players head to head, analyze which players are currently in form, predict match outcomes using a custom probability model, and track standings. When the 2026 World Cup kicks off on June 11, the live standings and top scorers will automatically populate from the API with no code changes needed.

How we built it

The data foundation starts with MongoDB Atlas storing 60 players, 64 matches, and over 3,200 player statistics from the 2022 World Cup, pulled from the API-Football API. A custom scoring engine calculates fantasy points per player per match based on goals, assists, clean sheets, yellow cards, red cards, and minutes played. The agent is built with Google's ADK framework using Gemini 2.5 Flash on Vertex AI Agent Platform. I designed 15 specialized tools the agent can call, each focused on doing one thing well. That specificity is what makes the agent reliable at chaining multiple tool calls in a single response. The backend is FastAPI deployed on Railway. The frontend is Next.js deployed on Vercel, featuring an interactive pitch view that updates automatically when the agent saves a lineup to MongoDB. The MongoDB MCP server is configured as the partner integration connecting the agent to the database.

Challenges we ran into

First challenge I had was actually from the 2026 World Cup which my original idea was heavily involve with the 2026 data. The free tier of the API blocked access to 2026 player statistics since the tournament hadn't started yet, so I had to architect the system around 2022 data while keeping it live-ready for 2026. But the biggest challenge was a schema compatibility issue between the mongodb-mcp-server version and the google-adk version. The MongoDB MCP server was returning JSON schemas with references that the Gemini API couldn't parse. I resolved this by building custom Python FunctionTool wrappers around MongoDB, which actually gave me more precise control over queries and made the agent more reliable overall.

Accomplishments that we're proud of

The real-time pitch update is the feature I'm most proud of. When the agent recommends a lineup, it saves it to MongoDB and the frontend automatically reflects that change without any page refresh. Seeing the player cards populate on the pitch after a single natural language prompt is the moment that makes it clear this is an agent, not a chatbot. I'm also proud of the prediction engine. It uses actual 2022 match results to calculate attack and defense strength for each team and generates win probabilities with an expected score. France vs Argentina was predicted correctly as the likely final matchup, which validated the model against real outcomes.

What we learned

The biggest lesson was in tool design. Early versions of the agent had tools that were too broad, which caused the model to call them incorrectly or skip them entirely. Once each tool had a focused purpose, clear typed parameters, and a detailed docstring explaining exactly when to use it, the agent started chaining tools naturally without any explicit instruction. I also learned how much the user experience of an AI application depends on managing latency expectations. Vertex AI responses can take 30 to 60 seconds and keeping the user engaged during that wait with clear loading states made a significant difference in how the product felt.

What's next for Pitchside

The most exciting next step is June 11 when the 2026 World Cup starts. The architecture is already live-ready and the live standings, top scorers, and match statistics will flow in automatically. Once match data is available, the scoring engine will calculate real fantasy points for the 2026 tournament. Beyond that, I want to add proper multi-user authentication so multiple people can manage their own teams and compete against each other on a live leaderboard. I also want to add a league mode where friends can join a private group and track each other's scores across the tournament. The foundation is already built in the scores collection in MongoDB, it just needs the frontend layer on top.

Built With

Share this project:

Updates