AWS Builder Center
Building ApexGuard: Sub-Second Motorsport Stewarding with Strands Decider 2B and Amazon Bedrock

Building ApexGuard: Sub-Second Motorsport Stewarding with Strands Decider 2B and Amazon Bedrock

Automatic racing incident steward made using Strands Decider 2B model

An engineering breakdown of how we split physical telemetry calculus, bounded policy decisions, and regulatory document drafting to build an automated race-stewarding platform.

Links & Resources


The Problem: The 25-Minute Stewarding Bottleneck

Every motorsport fan has watched it happen: two cars enter a chicane side-by-side, one driver runs the other out of road, and carbon fiber flies. The yellow flag waves, and then... nothing happens for 25 minutes.
Behind the scenes, race stewards are reviewing four different broadcast angles, cross-referencing telemetry printouts, and debating whether the attacking car was "substantially alongside" at the turn-in point. In grassroots karting and esports, it is even worse: with no full-time stewards on hand, incidents either go unpenalized or drag into heated debates on Discord days after the checkered flag.
Naturally, the immediate modern instinct is: can we just feed the telemetry into an LLM?
In practice, piping raw time-series telemetry into a frontier model (like Claude 3.5 Sonnet or GPT-4o) fails immediately:
  1. Latency: General LLMs take 2 to 5 seconds per inference. In race control, you cannot wait 5 seconds for each incident in an online race or on a tight window during a race in real life.
  2. Cost: Ingesting 20Hz–60Hz coordinate streams across 20 cars burns through hundreds of thousands of tokens an hour.
  3. Spatial Math Hallucinations: Large language models are probabilistic token predictors, not geometric engines. They routinely hallucinate Euclidean distance, braking points, and overlap percentages when asked to inspect raw floating-point arrays.
To make automated stewarding viable, we had to rethink the pipeline from first principles.

The Core Concept: Bounded System 1 + Generative System 2

Human race stewards do not re-read the entire sporting code every time two cars touch. Instead, they operate on two speeds:
  • Fast Intuition (System 1): Instantly recognizing whether a contact was just hard racing or an actionable divebomb based on speed and overlap.
  • Formal Legal Writing (System 2): When a penalty is required, carefully citing the specific Sporting Code article, calculating penalty seconds, and issuing a signed bulletin.
We mirrored this mental model in ApexGuard by decoupling the task across three specialized layers:
  • Input: Raw Telemetry Stream (20–60Hz)
    Continuous GPS coordinates, vehicle speeds, throttle/brake telemetry, and steering angles.
  • Layer 1: Deterministic Physics Math (< 4ms | $0.00)
    NumPy calculates real-world physical metrics: front-axle overlap percentage, closing velocity, lateral room to the track edge, and blind-spot vortex entry.
  • Layer 2: Fast Policy Gatekeeper (~115ms | $0.0001)
    Strands Decider 2B evaluates the physical state vector against the active sporting rulebook:
    • Cleared (~80%): Identified as ordinary racing room or benign contact. Dismissed and logged instantly with zero generative tokens.
    • Escalated: Flagged as an actionable breach and routed to Layer 3.
  • Layer 3: Judicial Document Synthesis (~1.5s | On Demand)
    Amazon Bedrock (Amazon Nova Lite) drafts an official, signed FIA Stewards' Decision Document with formal regulatory citations.

Deep Dive: How the Three Layers Work

Layer 1: Deterministic Physics Math (NumPy, <4ms, $0.00)

Raw telemetry coordinates from surveyed circuits are anchored to the horizontal ground plane (X and Z coordinates in meters, ignoring vertical elevation). Before any neural network is touched, NumPy computes a deterministic physical state vector:
  • Longitudinal Closing Speed: The rate at which the distance between the two cars is closing under braking.
  • Chassis Overlap Percentage: The ratio of car length alongside, verifying whether the front axle has reached the defender's A-pillar (the standard 50% threshold under FIA overtaking guidelines).
  • Lateral Clearance and Convergence: The lateral distance between cars and the remaining room to the track edge, pinpointing squeezes or crowding.
  • Randy Pobst "Vortex of Danger": Detects whether the attacking car entered the inside blind-spot wedge where the defending driver physically cannot see them before turn-in.
This step runs in less than 4 milliseconds on a single CPU core, converting noisy telemetry streams into a clean, compact IncidentStateVector.

Layer 2: Fast Policy Gatekeeper (Strands Decider 2B, ~115ms, $0.0001)

Most on-track contact in motorsport is benign—minor wheel-banging or shared responsibility that requires no intervention. Passing every tap to a full generative model is wasteful.
Layer 2 uses Strands Decider 2B, a lightweight 2-billion-parameter decision model developed by AWS Strands Labs. Unlike generative models that stream paragraphs of text, Strands Decider evaluates input against typed, bounded questions in a single forward pass:
  1. Boolean Check: Is this an actionable regulatory infraction? (yes / no)
  2. Category Choice: Which breach applies? (CROWD_SQUEEZE, REAR_END_SHUNT, APEX_DIVEBOMB, RACING_INCIDENT)
  3. Fault Attribution: Who bears predominant blame? (Competitor A, Competitor B, Shared 50-50)
  4. Severity Score: Rate infraction severity on a 1–5 scale (used to determine penalty points and time sanctions).
Because Strands Decider uses a small pointer-head architecture instead of an autoregressive text generator, it returns structured decisions in ~115 milliseconds. If an incident is deemed a normal racing encounter, it is dismissed and logged immediately at near-zero cost.

Layer 3: Judicial Document Synthesis (Amazon Bedrock / Nova Lite, ~1.5s)

When Strands Decider confirms an actionable breach, the case escalates to Layer 3.
Using Amazon Bedrock powered by Amazon Nova Lite (amazon.nova-lite-v1:0), the system drafts an official, publication-ready FIA Stewards' Decision Document. The prompt incorporates the mathematical keyframes and sporting articles, producing a structured ruling that includes:
  • Exact telemetry evidence (entry speeds, overlap ratio at apex, impact G-forces).
  • Legal citations under the FIA International Sporting Code (ISC) Appendix L, Chapter IV.
  • Prescribed sanctions (e.g., 5-second or 10-second time penalty, penalty points added to the driver's superlicense).
  • Digital signatures from the panel of stewards.

Benchmarks: Monolithic LLM vs. ApexGuard

By delegating triage to Strands Decider 2B and document generation to Amazon Nova Lite, the performance delta is substantial:
MetricMonolithic Frontier LLM (Claude 3.5 / GPT-4o)ApexGuard Dual-Engine (Strands 2B + Nova Lite)
Triage Latency2,500 – 4,500 ms~115 ms
Token Cost on Routine Laps~2,500 tokens / incident0 generative tokens (Dismissed at Layer 2)
Estimated Cost (1,000 Incidents)~$25.00 – $45.00~$0.12
Rulebook AccuracyVulnerable to hallucinating articles100% typed & bounded
Offline CapabilityImpossible (hard dependency on cloud)Full local fallback built-in

The Forensic Workbench Experience

We built the frontend as a dedicated race control command center using Next.js 15, TypeScript, TailwindCSS, and HTML5 Canvas.
You can test it directly in your browser: https://apex-guard-red.vercel.app 
Key capabilities in the live application:
  • 2D Canvas Track Radar: Real-world horizontal X/Z coordinate tracking mapped across 25 surveyed international circuits (including Silverstone, Interlagos, Spa-Francorchamps, and Monza). It renders true-to-scale car chassis (5.6 meters long by 2.0 meters wide), yaw direction indicators, and dynamic fading motion trails.
  • Synchronized Video and Telemetry Scrubber: Video replays (captured from F1 25) are locked 1:1 to MoTeC-style telemetry curves (Speed, Throttle, Brake, Steering Angle, and G-forces) with microsecond nudge controls for frame-accurate incident review.

Reusable Artifact: Standalone Decider Agent Pattern

To make this architecture easy for other developers to adopt, we packaged the decision logic into a standalone, dependency-minimal Python module:
You can use the pattern in three lines of Python:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from reusable_agent.decider_agent import StrandsDeciderStewardsAgent, TelemetryVector

# 1. Initialize the agent
agent = StrandsDeciderStewardsAgent()

# 2. Pass a physical telemetry state vector
result = agent.adjudicate_incident(TelemetryVector(
encounter_id="brazil_t4_clash",
track_name="Autódromo José Carlos Pace (Interlagos)",
timestamp_s=31.65,
competitor_a="Russell (Mercedes)",
competitor_b="Hamilton (Ferrari)",
closing_velocity_kmh=31.05,
lateral_convergence_ms=5.84,
overlap_ratio=0.828,
along_track_gap_m=0.96,
lateral_gap_m=2.88,
min_separation_m=3.04,
))

# 3. Read the typed decision and generated bulletin
print(result["decider_ruling"]["breach_category"]) # REAR_END_SHUNT
print(result["decider_ruling"]["penalty_recommendation"]) # 10-Second Time Penalty
print(result["official_bulletin"]["headline"]) # OFFICIAL DECISION: 10-Second Time Penalty

Zero-Downtime Offline Fallback

Trackside race control often takes place in pitlanes with spotty cellular coverage. The agent includes a deterministic local rulebook fallback: if AWS credentials or network connections are absent, the agent automatically executes local rule evaluation with $0 cost and zero downtime.

What We Learned

  1. Small Decision Models Beat Frontier LLMs for Gating: Using a 2B parameter model like Strands Decider for bounded classification reduces latency by 95% and prevents the hallucinations that occur when large models attempt geometry.
  2. Ground AI in Physical Units: LLMs are great at drafting formal legal language, but terrible at calculating distances. Doing vector math in NumPy first makes the generative layer trustworthy.
  3. Fast Triage Keeps Humans in the Loop: Rather than replacing human stewards, sub-second AI triage filters out the 80% noise of ordinary racing incidents, allowing stewards to focus their attention on genuine infractions.

Disclaimer: ApexGuard is an open-source educational prototype created for the AWS Builder Center Agent Experience Hackathon. Formula 1, F1, and FIA are registered trademarks of their respective owners and are referenced solely for technical evaluation under nominative fair use.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article