F1 Race Strategy Agent banner
DoomDust7 DoomDust7

F1 Race Strategy Agent

AI community

Description

CSE 598 Agentic AI capstone baseline — an agentic F1 race-strategy engineer: a Claude tool-use loop that recommends pit/tyre strategy over real FastF1 telemetry, tested against a deterministic optimum.

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

F1 Race Strategy Engineer Agent — CSE 598 Capstone Baseline

An **agentic** baseline: Claude acts as a Formula 1 race strategist. Given a driver and their starting tyre, the agent reasons over **real 2021 Spanish GP telemetry** to recommend a pit/tyre strategy. It runs a genuine *plan → call tools → observe → refine* loop — it inspects tyre degradation, proposes candidate one- and two-stop strategies, simulates each with a deterministic race-time model, compares them, and submits a final recommendation.

The recommendation is **objectively checkable**: it is compared against the optimum of the same deterministic simulator (see `data/ground_truth.json`).

What the baseline does (step by step)

  1. Model — Anthropic claude-opus-5 (configurable) via the official anthropic SDK, driven by a hand-written tool-use loop in `src/agent.py` (the loop is explicit on purpose, so the agentic cycle is visible).
  2. Tools the agent can call (`src/tools.py`):
    • get_race_info — race length, compounds, pit-loss, min stint length.
    • get_driver_stints — a driver's actual stints + starting compound (from data).
    • estimate_tyre_degradation — fits a linear pace-vs-tyre-age model per compound from that race's green-flag laps.
    • simulate_strategy — deterministic estimate of total race time for any proposed stint plan (validates: laps sum to race length, ≥2 compounds, min stint length).
  3. Data — real timing data from FastF1, pre-downloaded into cache/ and read in offline mode → no network needed for race data.

Setup

git clone https://github.com/DoomDust7/f1-race-strategy-agent.git
cd f1-race-strategy-agent
python -m venv .venv
source .venv/bin/activate           # Windows: .venv\Scripts\activate
pip install -r requirements.txt

API key (required)

The agent calls the Anthropic API, so you need an API key with credits.

cp .env.example .