This post is the third installment in our series exploring the Oracle AI foosball demo, which was recently showcased at Oracle CloudWorld (OCW). The demo offered attendees an interactive experience, allowing them to play foosball on our Tornado table while real-time AI-generated analytics provided insights into their gameplay. For part one of this series, see Creating an AI foosball experience: Integrating OCI technologies.
The foosball demo required a robust and efficient solution to seamlessly integrate multiple components from the Oracle Cloud Infrastructure (OCI) stack. The objective was to ensure that every element of the architecture worked in a synchronized and sequential manner, with each step triggering the next in a smooth, automated process. We selected Python for this task for its popularity among developers and its familiarity across the industry. Python’s ease of implementation allowed us to quickly create a functional version of the integrator within the tight timeframe we had to meet.
Characteristics and considerations from the Python integration
We began by implementing the Python integration through an extract, transform, load (ETL) pipeline to automate the entire process. Each component of the solution was connected, starting with the database, where a Python script, as shown in Figure 1, was used to extract match data and statistics, such as goals scored, possession percentage, team names, and match duration, after each game.
The data was then passed to the next component, the OCI Generative AI service, using the Llama 3.1 405b large language model (LLM), to generate an exciting sportscast style summary script of the match, as shown in Figure 2. The last step in this process was to then send that AI-generated script to Synthesia through an API to generate an AI Avatar delivering the script as our Foosball League’s commentator. Prompt engineering was essential in creating a successful avatar video by addressing two key factors: avoiding sensitive words such as “attack,” “shoot,” or “counterstrike,” to prevent triggering autogovernance filters that would potentially delay the video delivery, and helping ensure the script’s tone and length were brief, and impactful.
We also developed a robust troubleshooting mechanism, designing the Python architecture to enable independent testing of errors without disrupting other components, as shown in Figure 3. This design allowed us to send specific event data back to the database and store the processed videos in OCI Object Storage, helping ensure that the downstream analytics team could easily access and display the videos as needed in their player facing graphical interface built in Oracle Analytics Cloud (OAC).
Python specifics
Our Python architecture used the following components:
- Database connector: Utilizes the oracledb module to establish a connection with the Autonomous Database 23ai and retrieve information through an OracleDBInterface object.
- Generative AI (GenAI) connector: Uses the OCI module to interface with the OCI Generative AI service through the Python software developer kit (SDK) and OCI Service Gateway. This setup allows it to send requests to Llama 3 using the data provided by the database connector.
- Avatar connector: Uses standard HTTP requests to interact with the Synthesia API. The GenAI connector supplies the script, generates the video, and uploads the final MP4 to the OCI Object Storage. This process enables Oracle Analytics Cloud to display the video in a automated manner.
- Component communication: Each Python script—the database, GenAI, and Avatar connectors—is deployed independently and communicates with the others through a REST interface using Flask.
- Controller script: The final and most critical component, the controller, connects all the parts, monitors each for errors, and helps ensure the successful production of the videos.
Python was effective in streamlining data integration and automation for the Oracle AI foosball demo. Using Python’s versatility and robust connectivity features, we created a seamless workflow that integrated multiple OCI components, enabling real-time game analytics and AI-generated commentary. This solution not only showcased the power of automation but also underscored Python’s role in efficiently managing complex, multi-step processes in cloud-based environments.
Continue reading about the Oracle AI Foosball Frenzy demo in the part 4.
- Part 1: Introductory blog (this blog)
- Part 2: Core engine and data processing layer
- Part 3: Achieving automation using Python
- Part 4: Translating operational data into analytical insights
- Part 5: Visualizing the data for players
Get more information about Oracle’s:

