Predicting soccer matches involves analyzing vast amounts of data – historical results, team form, upcoming schedules, and more. Manually gathering and synthesizing this is time-consuming. What if you could have an AI assistant do it instantly? In this post, we’ll show you how we used FlowHunt.io to build a sophisticated chatbot that leverages the Sportradar API for real-time data and AI analysis to deliver insightful soccer predictions. We’ll focus on a key technique for managing complexity: using the Run Flow component to create modular, reusable custom tools.
An Intelligent Prediction Assistant
Our objective was clear: create a chatbot that takes a user query (like team names), fetches diverse data points from Sportradar, analyzes them using AI, and presents a structured prediction:

Managing Complexity
As you can see from the flow diagram below, integrating multiple data points (upcoming match details, historical head-to-head, team stats) and processing them for AI analysis can lead to a very large and potentially unwieldy workflow if built monolithically.

Building and maintaining such a large single flow can be challenging. How did we manage this? By breaking it down.
Modular Design with Custom Tools via ‘Run Flow’
Instead of one giant flow, we adopted a modular approach using a powerful FlowHunt feature: the Run Flow component. This component allows one flow (the “parent”) to execute another flow (the “child” or “sub-flow”) and receive its results.
We created several smaller, dedicated flows, each acting as a custom tool responsible for a single task:
- “Get Upcoming Match Details” Tool (Sub-Flow):
- Input: Takes parameters like team IDs or a match ID.
- Action: Contains an HTTP Request node configured to call the specific Sportradar API endpoint for fetching future match schedules and details.
- Output: Returns structured data about the specific upcoming match (date, time, venue, competition, etc.).
[Image: Conceptual screenshot or simplified diagram of a small flow with Input -> HTTP Request (Sportradar Schedule) -> Output]
- “Get Historical Head-to-Head” Tool (Sub-Flow):
- Input: Takes parameters like the IDs of the two competing teams.
- Action: Contains an HTTP Request node configured to call the Sportradar API endpoint for retrieving past match results between those specific teams.
- Output: Returns a structured list of historical matches, including dates, scores, and winners.
[Image: Conceptual screenshot or simplified diagram of a small flow with Input -> HTTP Request (Sportradar History) -> Output]
- (Optional) Other Tools: Similar sub-flows could be created for fetching current team form, league standings, player stats, etc., each calling the relevant Sportradar endpoints.
Step 1: Building the Custom Tool Sub-Flows
Each sub-flow is built independently, focusing solely on its specific data-fetching task. This makes them easier to create, test, and maintain.
Step 2: Orchestrating with the Main Flow
Our main chatbot flow now becomes much cleaner. It acts as an orchestrator:
- Chat Input: Captures the user’s initial query (e.g., team names).
- AI Agent: The core AI Agent (e.g., Tool Calling Agent) node receives the outputs from both Run Flow components.
- Run Flow (Get Upcoming Match): Creating custom tools based on the different sportradar API endpoints
- Chat Output: Displays the final analysis from the AI Agent.

Step 3: Prompting the AI to Use Tool Outputs
The AI Agent in the main flow is prompted differently now. Instead of receiving raw API data, it receives the structured outputs from our custom tools. The prompt instructs it to synthesize information from these specific tool outputs:
You are a helpful assistant that uses the tools at its disposal to answer questions you answer questions about YOURCOMPANY.xyz but also about soccer games and giving predictions based on the info you receive from the tools at your disposal, YOU ARE AN ASSISTANT ON A BETTING WEBSITE SO MAKE SURE TO ANSWER ONLY RELEVANT QUESTIONS ABOUT YOURCOMPANY.xyz , OR BETTING, SPORTS, AND CASINOS IN GENERAL.
TOOLS:
---
when a user asks for any information that requires you to use tools and to have competitor_id or competition id or even season id give the name of the team IN ENGLISH AND TRANSLATE TO ENGLISH IF ITS NOT to seasons_tool and it will give you the teams all the mentioned ids.
---
If the user asked about todays games or questions about todays games theres no need to ask any additional questions. ALWAYS AND ALWAYS use the todays_matches tool and give the user EVERY SINGLE match that hasn't happened yet ALONG WITH TEAM NAMES AND COMPETITOR ID. BUT dont forget that no matter when using this tool give matches that haven't happened yet never give match results for games that are already concluded.
---
if the user wanted predictions for an upcoming match use the predictions_tool and give it the only their competitor id for both teams THIS IS THE SAME id YOU OBTAINED FROM THE seasons_tool (format: competitor_id_1=ABC and competitor_id_2=XYZ) give the user detailed prediction rating based on the info you recieved and also output the sr:sport_event id .
if the user asked more questions about this specific game you should give the match_info tool the sr:sport_event id in order to extract information about that match.
give a detailed prediction based on the data you have and an estimated precentage on who will mostlikely win and who the user should bet on.
IF YOU ALREADY DONT HAVE THE COMPETITOR ID IN YOUR HISTORY YOU CAN ASK THE USER FOR THE TEAM NAMES.
---
USE DOCUMENT RETRIEVER TO ANSWER GENERAL QUERIES IF THERE ARE NO ANSWERS IN DOCUMENT RETRIEVER YOU CAN ALSO USE GOOGLE SEARCH TOOL AND URL RETRIEVER TO ANSWER USER QUERIES WHEN YOU DONT KNOW WHAT TO ANSWER.
---
you can use team_info tool to gather information about a team but you should send the tool the team's competitor id.
---
if you want standings of a current league or who is going to go to the next round or specific information on a team in this season of the current league you can use the standings_tool by obtaining the season id from the seasons_tool by giving this tool the name of the league or team and giving it to the standings_tool
BUT KEEP IN MIND THAT IF THERE ARE 2 TEAMS and we are talking about stats and yellow cards in a specific game YOU STELL HAVE TO USE THE predictions_tool
---
if the user asked about detailed info like corner amount or red cards or etc. you can obtain season id and competitor id from seasons tool and give it to detail_stats tool to get all that information.
If the user asked questions that you couldnt find within your tools you can search google for answers.
WHEN GIVING REPORT OF OUTPUT OF A TOOL, ALWAYS MAKE SURE TO INCLUIDE EVERY SINGLE DETAIL OF THE TOOL OUTPUT FOR THE USER REGARDLESS OF USER'S INPUT
INCLUDE THE FOLLOWING DATA IF ACCESSIBLE:
YELLOW CARD
corner_kicks
offsides
OWN GOALS
substituted_out
substituted_in
shots_on_target
shots_off_target
shots_blocked
red_cards
own_goals
goals_scored
The Result: Complexity Managed
By using Run Flow to create modular custom tools, we transformed a potentially massive and hard-to-debug workflow into a manageable system. The main flow clearly orchestrates the data gathering, and the AI agent focuses purely on analysis using the clean, structured data provided by the dedicated sub-flows. This approach delivered the desired detailed prediction output while keeping the development process organized.
Conclusion: Build Smarter, Not Harder
This Sportradar prediction chatbot showcases how FlowHunt enables the creation of sophisticated AI applications interacting with external data sources. More importantly, it highlights how features like the Run Flow component are crucial for managing complexity through modular design. By breaking down large tasks into smaller, reusable “custom tool” flows, you can build powerful, maintainable, and scalable AI solutions more effectively.
Ready to tackle complex workflows? Explore FlowHunt.io and leverage modularity to build your next AI-powered application!
Get started with your first flow
Flowhunt has a team of AI flow engineers ready to help you with AI Automation.