RaceLens: An Autonomous AI Race Strategist & Visualization Suite
Inspiration
In the high-stakes world of endurance racing, teams are inundated with thousands of data points every minute. This raw data is dense and difficult to interpret under pressure. While competing in IMSA Michelin Pilot Challenge, we saw a critical gap between the raw telemetry streaming from the track and the actionable intelligence needed by two key personas:
- The Race Strategist on the pit wall needs to make split-second decisions. They need to know why a competitor is suddenly faster, not just stare at a wall of numbers. What if they could just ask the data a direct question during a caution period?
- The Marketing Manager needs to engage fans. Lap times are boring, but the story of a driver overcoming a poor start, or a perfectly executed pit stop that gains three positions, is incredibly compelling.
Our inspiration was to build a complete, end-to-end system that bridges this gap—an autonomous AI engine to analyze the data, and a world-class visualization suite that allows users to both see and converse with their data.
What it does
RaceLens is a unified, two-part system that transforms raw motorsport data into a decisive competitive advantage. It functions as a complete, automated intelligence pipeline:
Phase 1: The Autonomous AI Engine (Project Apex)
A user simply uploads raw race data to our portal. This single action triggers a sophisticated, autonomous multi-agent workflow built on Google's ADK:
- Autonomous Investigation: A team of AI agents collaborates to analyze the data. If an anomaly is found—like a massive performance gap between teammates—the InsightHunter agent autonomously calls our CoreAnalyzer toolbox for a detailed drill-down report.
- Narrative Synthesis: Our Arbiter agent acts as the Chief Strategist. It synthesizes reports from the InsightHunter and the Historian into a single, coherent "master narrative" for the race.
- Structured Output Generation: This master narrative is used to generate a suite of structured JSON files: Comprehensive Analysis, Strategic Insights, and Social Media Content.
Phase 2: The Interactive Visualization Suite (RaceLens Dashboard)
The JSON files generated by our AI engine become the fuel for the RaceLens Dashboard. This is where the data becomes explorable and actionable. The dashboard allows users to:
- Gain a High-Level Overview: Immediately see key race stats, performance leaders, and a preview of the AI-generated insights.
- Perform Deep Dives: Seamlessly navigate between dedicated dashboards for Pace, Strategy, and Driver performance.
- Analyze Individual Cars: Click any car to launch a detailed analysis view with stint-by-stint performance charts and predictive tire degradation models.
- Converse with Your Data: Go beyond charts with the new AI Race Assistant. Ask complex, natural language questions about your uploaded data and get instant, context-aware answers from leading models like Claude and GPT-4.
The result is a seamless workflow from raw data to a beautiful, interactive dashboard, delivering a complete intelligence package that turns numbers into decisive strategy and compelling stories.
How we built it
The system is architected as two distinct but tightly integrated components, representing the "brain" and the "face" of our project.
Part 1: The Autonomous AI Engine (Project Apex)
The backend is an orchestrated multi-agent system built on Google Cloud using the Agent Development Kit (ADK). Key technologies include Cloud Run for scalable agent hosting, Vertex AI's Gemini API for reasoning and synthesis, and BigQuery for long-term data memory.
Part 2: The Interactive Visualization Suite (RaceLens Dashboard)
The frontend is a modern, performant web application built to be the ultimate user interface for our AI's output.
- Core Framework: React with TypeScript and Vite for a fast, type-safe, and responsive user experience.
- State Management: A central React Context (
DataContext) acts as the application's nervous system, managing the state for all data files and gracefully handling optional data. - Data Visualization: Recharts is used to create beautiful, interactive, and composable charts.
- Conversational AI Interface: We integrated an AI Race Assistant using OpenRouter to provide access to leading models like Claude and GPT-4. A custom React hook manages the conversation state, and most importantly, the entire data context (race, insights, and social files) is programmatically injected into the initial system prompt, making the assistant instantly an expert on that specific race.
- Styling: Tailwind CSS with a custom, themeable design system allows for a polished UI with robust light and dark modes.
Challenges we ran into
- From Pipeline to True Orchestration: Our initial AI backend was a simple reactive chain. Refactoring it to be controlled by a central ADK graph was a major challenge, but it made the system more robust, efficient, and truly "orchestrated."
- Bridging AI Output to a Dynamic UI: The AI generates three separate files, two of which are optional. We had to design a resilient frontend that wouldn't break if a file was missing. Our
DataContextwas crucial for this. - From Generation to Conversation: Evolving our AI interaction from a one-shot generation task (in the backend) to a multi-turn, stateful conversation in the frontend was a new challenge. This required robust state management for the conversation history and careful prompt engineering to create a system prompt that primes the AI to be a focused expert, consistently referring back to the provided data and avoiding hallucination.
Accomplishments that we're proud of
- The Complete, End-to-End Autonomous Workflow: Our greatest accomplishment is the seamless integration of both phases. We've built a system that takes raw data and, with zero manual intervention, produces a rich, interactive, and deeply analytical web experience.
- The Arbiter Agent & The DataContext: Brain & Nervous System: We are incredibly proud of this pairing. The Arbiter agent acts as the "brain," synthesizing a master narrative. The DataContext on the frontend acts as the "nervous system," taking that narrative and making every piece of it explorable.
- The Conversational Data Explorer: Our proudest new accomplishment is the AI Race Assistant. It represents the ultimate human-AI interface for data analysis. We've closed the final gap between a user's question and the data's answer. By injecting the full data context into a powerful LLM, we've transformed a visualization dashboard into a true analytical partner, allowing even non-technical users to perform complex data exploration through simple conversation.
What we learned
- Orchestration is About Control, Not Just Triggers: A central orchestrator (like ADK) provides explicit control over workflow and state, which is far more powerful than a simple reactive chain.
- The UI is the Conversational Bridge to AI: We knew the UI was a human layer, but the chatbot taught us it could be a conversational bridge. The most intuitive interface isn't always a chart; sometimes, it's a text box. Allowing users to directly query the AI model turns them from passive observers into active participants in the analysis, dramatically increasing engagement and the speed of discovery.
- Prompt Engineering is System Design: Designing prompts for autonomous agents and conversational assistants is a form of system design. We learned to ask the LLM to create a "plan" (a structured JSON object) for our backend agents and to provide a comprehensive "world context" for our frontend assistant.
What's next for RaceLens
We are just scratching the surface. Our next steps are focused on increasing real-time interaction and predictive capabilities:
- Unified Data Model and Multi-Series Support: Develop a universal data model and a new Adapter agent to ingest and transform data from any race series (Formula 1 F1, WEC World Endurance Championship, GT3 Sportscar racing, DTM, etc), making RaceLens a truly versatile motorsports intelligence platform.
- Real-Time Ingestion & In-Race Alerts: Transition from file uploads to a live WebSocket stream to provide real-time alerts within the dashboard.
- Predictive Strategy Tools: Leverage historical data in BigQuery to train a Vertex AI AutoML model that the Arbiter can query for probabilistic outcomes.
- Proactive & Agentic Chatbot: Evolve the AI Race Assistant from a reactive Q&A tool into a proactive partner. The assistant could autonomously suggest areas for investigation ("I've noticed car #7's tire degradation is 20% higher than average. Would you like a detailed breakdown?") and eventually serve as the interface to trigger new, deeper analyses from our backend agent swarm.
Built With
- adk
- ai
- bolt
- gemini
- javascript
- vite
Log in or sign up for Devpost to join the conversation.