F1 StratLab · Multi-agent strategy · open source · v2.5.1

Race strategy,
decided by six agents.

F1 StratLab is an open-source multi-agent AI system for real-time Formula 1 race strategy. It orchestrates seven ML models and a LangGraph multi-agent system to produce strategy recommendations — from lap time prediction to tire degradation, radio NLP, and RAG over FIA regulations.

7 ML models·6 LangGraph sub-agents·71 Grand Prix · 2023–25·Open Source
F1 StratLab architecture: telemetry and radio inputs feed six specialist agents and one orchestrator that outputs a strategy decision.INPUTSSPECIALIST AGENTS · LANGGRAPHDECISIONTelemetry14 MB/s · 1.2M ptsTire model8 compounds · wearTeam radioWhisper · NLPRace controlFlags · pit · SCWeatherTrack · rain probFIA rulesRAG · regulationsPace→ Lap time predictionPYDANTICconf 0.92Tire degradation→ Stint length limitPYDANTICconf 0.92Race strategy→ Optimal pit windowPYDANTICconf 0.83Pit call→ Box / stay recommendationPYDANTICconf 0.86Radio intent→ Driver state · requestPYDANTICconf 0.80Rules lookup→ Regulation check · RAGPYDANTICconf 0.80ORCHESTRATORSUPERVISOR AGENTRECOMMENDATIONPIT_NOW · MEDUndercut window · laps 34–36CONFIDENCE0.87p(win) +3.2% vs stay-out
system_architecture · f1 stratlab
6 agents·7 ML models·< 1 s end-to-end
Architecture

From raw lap to race-ready call.

A LangGraph ReAct multi-agent system replaces the legacy Experta rule engine. Six specialised sub-agents coordinate under a Strategy Orchestrator.

01 · INGEST
Live race state
  • FastF1 · OpenF1
  • Lap telemetry
  • Team radios
  • FIA race control
02 · INFER
Six sub-agents
  • Pace
  • Tire
  • Race Situation
  • Pit Strategy
  • Radio
  • RAG
03 · ORCHESTRATE
Strategy Orchestrator
  • MoE dynamic routing
  • Monte Carlo simulation
  • Pydantic v2 output
  • LLM synthesis
04 · RECOMMEND
Race-ready actions
  • perform_undercut
  • extend_stint
  • prepare_pit
  • defensive_pit
  • push_strategy
CoreThe Strategy Orchestrator performs MoE-style dynamic routing, a Monte Carlo that scores each candidate in projected track position, and LLM synthesis with Pydantic v2 structured output.Read the thesis paper →
Sub-agents

Six specialists. One table.

Each sub-agent reasons in its own head, outputs structured Pydantic predictions, and hands them to the orchestrator.

Sub-agent · live

Pace Agent

Next lap
1:27.482
conf 0.87
Lap time — last 20
Feature importance
Tire age0.28
Fuel load0.22
Track evo0.18
Compound0.15
Traffic0.10
Weather0.07
Reasoning trace
1Stint start · lap 38
2Compound age 10 laps · deg 0.08 s/lap
3Clean air since lap 44
4→ predicted pace 87.48s ± 0.04
Telemetry

What happened. What's next.

Pace · lap timelap 48/66
actual predicted P10/P90
90.289.388.387.486.41102030405060LAPPITPITNOW
Compound
Hard
Lap
48 / 66
Delta
+0.284s
Model conf.
0.87
Track model

The field, in real time.

The orchestrator sees every car's sector pace, gap delta, and compound — and recomputes every lap.

Melbourne · Albert Park
Lap 32 / 58
live replay
S/F0102030405060708091011121314VHLLECSNR
Timing tower
Focus · LEC
Last lap
1:27.482
Best
1:26.991
Compound
MED
Tire age
14 laps
00 / 100
The decision loopDECIDE
STEP 04 · OF 04

One recommendation.

The orchestrator weighs the six opinions against FIA rules and simulation, and returns the call.

Scroll
Model portfolio

Seven models.
One decision.

Each sub-agent wraps one or more models as @tool-decorated LangChain tools. Hover a row — read the spec.

Model performance at a glance

Lap-time prediction (XGBoost)
MAE 0.392 s
Tire degradation (Temporal Convolutional Network + Monte Carlo Dropout)
P10/P50/P90 quantiles, tire-cliff & pit-window detection
Overtake probability (LightGBM)
AUC-ROC 0.876
Safety-car probability (LightGBM)
classifier
Pit-stop duration (HistGradientBoosting quantile)
MAE 0.487 s
Undercut success (LightGBM binary)
AUC-ROC 0.771
Team-radio NLP
Whisper + RoBERTa + SetFit + BERT-large pipeline
Measured, not assumed

Clean air is worth
more at some tracks.

When the car ahead pits, you inherit clear track. We measured what that is worth, per circuit, across 479 cases where a car sat within two seconds of a driver who then boxed.

Suzuka+0.77sMonaco+0.65sLusail+0.65sSpa+0.59sZandvoort+0.42sMiami+0.40sMarina Bay+0.30sAustin+0.25sBarcelona+0.02sMonza-0.01sSao Paulo-0.07sLas Vegas-0.11sSpielberg-0.28s

Nothing in the measurement knows what downforce is. It reads lap times. Yet the circuits sorted themselves: high-downforce, fast-corner tracks at the top, where following costs you the most air. Slipstream tracks at the bottom, where losing the car ahead costs you a tow worth more than the clear road.

That is why the overcut is a real move at Suzuka and a worse pit stop at Monza. Staying out trades one lap of fresh rubber, worth 0.25s a lap, for one lap of clear track. Highlighted bars are the circuits where that trade pays.

RAG agent

Ask the regulations. Get cited answers.

The RAG Agent indexes FIA Sporting & Technical Regulations 2023–2025 in a local Qdrant collection with BGE-M3 embeddings.

↵ query
answered · 2 sourcesBGE-M3 · top-k=5 · Qdrant cosine 0.82

src/rag/retriever.py :: query_rag_tool()1 / 3
Three surfaces · one brain

Use it how you race.

Same orchestrator. Same models. Pick the front-end that matches the moment — pit wall, lab, or Twitch stream.

Command line

Three console scripts ship with the package. f1-strat is a Rich interactive launcher that walks you through mode, race, driver, lap range and LLM provider. f1-sim is the headless runner that iterates the race lap-by-lap and streams a live per-lap table with action, confidence and MC scores. f1-arcade opens the 2D replay window.

zsh
$ uv run f1-strat
↵ live reload·OPENAI_API_KEY optional
f1-strat · interactive
Walkthrough

See F1 StratLab in full motion.

Six agents, seven models, one live race — a guided tour of the system end to end.

f1stratlab — demo.mp4walkthrough
1080p · H.264 · 16:9 masterView source →
Install & run

One command. One venv. No PyTorch dance.

pyproject.toml routes torch / torchvision to the right CUDA wheel per platform via [tool.uv.sources] — so there's no manual PyTorch step on Windows or Linux.

Three console scripts — f1-strat (launcher), f1-sim (headless), f1-arcade (2D replay)
Lazy first-run download (~7–8 GB) from the f1-strategy-dataset HF repo
OPENAI_API_KEY or LM Studio on :1234 — both work
Offline mode via F1_STRAT_OFFLINE=1
~/F1-StratLab
# install uv once per machine
$ curl -LsSf https://astral.sh/uv/install.sh | sh

# clone + install in one shot
$ git clone --recursive https://github.com/VforVitorio/F1-StratLab.git
$ cd F1-StratLab
$ uv sync

# run the interactive launcher
$ uv run f1-strat
Built with
ML & Models
PyTorchXGBoostLightGBMHistGBTTransformers
NLP
WhisperRoBERTaSetFitModernBERTBERT-large
Agents & RAG
LangGraphPydantic v2QdrantBGE-M3
Data & Runtime
FastF1OpenF1FastAPIReactDockerArcadeRichuv
Final Degree Project · Thesis

F1 StratLab: AI Models for Strategy Recommendations in Formula 1 Races

Vega, V. (2026) · Bachelor's Thesis, Intelligent Systems Engineering, UIE Campus Coruña · Awarded Distinction (Spain's top grade) · Recommended for conversion into a research paper

Roadmap

There's still a race to win.

Where F1 StratLab is headed next: from anticipating rivals to live-race inference.

v2.0.0shipped

Modern frontend

Done: the React web app replaced Streamlit as the post-race UI, across six surfaces (dashboard, comparison, model lab, strategy, race, chat). The FastAPI backend stays.

v2.6.0

Arcade, modernized

A web-native frontend for part of the live Arcade experience, running alongside the pyglet 2D replay: the web app's modern strategy and telemetry surfaces come to the trackside view.

v2.8.0

Rival Agent

Anticipate each rival's next move and feed it to the orchestrator. Reactive becomes anticipatory.

v3.0.0

Live race inference

Real-time OpenF1 WebSocket ingestion, plus adaptation to the 2026 regulation.

side reposIndependent repositories that extend the core. Related, but shipped on their own.
gridmind · v0.1.0

F1 LLM

A domain LoRA fine-tune for sharper strategy reasoning and narration.

radiogate · v0.1.0

Radio NLP

A large team-radio corpus with a novel bluffing / deception signal.

pitlab · v0.1.0

MLOps studio

Button-driven retraining: download, merge, inspect, retrain. No notebooks.

box-bot · v0.1.0

Race-time bot

Live narration of the orchestrator on X during a Grand Prix.

Planned, not committed. Directions, not deadlines.

FAQ

Frequently asked questions

What is F1 StratLab?

F1 StratLab is an open-source Python system that uses seven machine learning models and six LangGraph sub-agents to generate real-time Formula 1 race strategy recommendations, including pit-stop timing, tire compound selection, and undercut opportunity detection.

What ML models does F1 StratLab use?

XGBoost for lap-time prediction (MAE 0.392s), a Temporal Convolutional Network with Monte Carlo Dropout for tire degradation, two LightGBM classifiers for overtake (AUC-ROC 0.876) and safety-car probability, a HistGradientBoosting quantile regressor for pit-stop duration (MAE 0.487s), a LightGBM classifier for undercut success (AUC-ROC 0.771), and a four-stage NLP pipeline (Whisper + RoBERTa + SetFit + BERT-large) for team radio.

How does the tire degradation model work?

The Tire Agent wraps a causal TCN trained with Monte Carlo Dropout to produce P10/P50/P90 degradation quantiles per compound, detect the tire performance cliff, and output a recommended pit window with a calibrated confidence score.

How does the RAG agent handle FIA regulations?

The RAG Agent indexes the FIA Sporting and Technical Regulations (2023–2025) in a local Qdrant vector database using BGE-M3 embeddings, retrieves the top passages by cosine similarity, reranks them, and synthesizes a cited answer referencing specific article numbers.

What data does F1 StratLab use?

Telemetry, lap data, and race-control messages from 71 Formula 1 Grand Prix across the 2023–2025 seasons, sourced from the FastF1 and OpenF1 public APIs. The dataset is published at VforVitorio/f1-strategy-dataset on Hugging Face.

Contributing

Open source. Yours to fork.

Spot a bug, ship a new agent, tune a model — issues and pull requests are welcome.

Víctor Vega (VforVitorio)
Meet the author

Víctor Vega

Also known as VforVitorio. Junior AI Engineer at NTT DATA Spain, working across many areas of AI, from computer vision to LLM behavior, agentic AI solutions, and tooling such as Model Context Protocol (MCP) servers. Bachelor's in Intelligent Systems Engineering at UIE Campus Coruña, graduated with a 9.0/10 average and 4 Distinctions (Matrícula de Honor), with a thesis awarded Distinction (Matrícula de Honor) and recommended for conversion into a research paper. Now pursuing a Master's Degree in Artificial Intelligence Research (AEPIA / UIMP) alongside his full-time role. Building AI for Formula 1, from telemetry modelling to multi-agent reasoning.