Skip to main content
PROJECT 01AI Sports Science RAG AgentProduction

AthleteIQ

Sports Science Intelligence for Coaches and Athletes

Overview & Impact

The Problem & The System Solution

The Problem

Coaches and athletes need rapid access to sports science guidance, but general-purpose language models can hallucinate, perform unreliable calculations, and provide unsafe advice in health-adjacent situations.

The System Solution

Built a LangGraph ReAct agent with four specialized tools: sports-science retrieval, deterministic ACWR calculation, timestamped athlete metric logging, and three-tier safety escalation.

01

Sports science is a domain where accuracy is non-negotiable. A coach asking for workload ratios for an injured athlete needs exact calculations, not an approximation. Existing AI tools either hallucinate figures or avoid the question entirely.

02

AthleteIQ was built to solve this precisely. By separating probabilistic LLM reasoning from deterministic Python math tools, every workload calculation is computed programmatically and verifiable, not generated by a language model.

03

The system uses LangGraph's ReAct loop to decide which tool to call based on query type: vector retrieval for sports science knowledge, Python math for ACWR, a database writer for metric logging, and an immediate safety escalation bypass when emergency language is detected.

Architecture & System Flow

System Design Visualizer

LANGGRAPH REACT AGENT ARCHITECTURE

AthleteIQ Hub-and-Spoke Architecture

Deterministic + RAG
1. USER QUERYINPUT
Coach / Athlete Query
Sports Science Input Telemetry
LANGGRAPH CORE
ReAct Agent & Safety Router
Evaluates intent, safety boundaries, & dispatches tools
ChromaDB Vector Store (RAG Tool)
56 Knowledge Base Chunks Retrieval
ACWR Python Math Engine
Deterministic Calculation Tool
Metric Telemetry Logger
Timestamped Database Record
RESPONSIBLE AI // EMERGENCY ESCALATION ROUTE

Emergency language triggers an immediate hard bypass of vector retrieval to prevent hallucinated medical guidance.

INTERACTIVE STEP INSPECTOR

Step-by-Step System Execution Payload

Step 1 of 4
COMPONENT / NODE

OpenRouter Fast-Classifier

DATA / PAYLOAD FORMAT

Athlete Query + Historical Load Telemetry

LATENCY TARGET
80ms classification
TECHNOLOGY USED
Python / Fast-Classifier
SAFETY GUARDRAIL / FAILOVER
3-Tier Emergency Medical Escalation Filter

Key Engineering Decisions

The LLM does not perform safety-critical workload mathematics. AthleteIQ routes ACWR calculations to deterministic Python logic.

Bypasses retrieval entirely when a medical emergency is detected, instantly routing to immediate human escalation.

Uses a hybrid eval harness combining LLM-as-judge scoring with rule-based checks for safety-critical questions.

Technology Stack

Production Technologies

Backend
Python

Core agent logic, math tools, evaluation harness

AI / ML
LangGraph

ReAct agent state machine and multi-step reasoning loop

LangChain LCEL

Tool calling chains and prompt composition

Hugging Face

all-MiniLM-L6-v2 embeddings for semantic retrieval

OpenRouter API

LLM gateway routing to Claude/GPT for agent reasoning

LLM-as-Judge

Semantic evaluation of retrieval quality and response accuracy

Database
ChromaDB

Local vector store for sports science knowledge base

Features & Capabilities

What It Does

🧠

LangGraph ReAct Agent

Multi-step reasoning loop that selects tools based on query intent.

📚

Sports Science RAG

56-entry ChromaDB knowledge base covering ACWR, HRV, RPE, biomechanics, recovery.

🧮

Deterministic Math Tools

Python ACWR calculations that bypass LLM for exact, auditable workload ratios.

🚨

Safety Escalation

Emergency language triggers immediate human escalation, bypassing all retrieval.

📊

Metric Logging

Timestamped athlete performance data persisted for longitudinal tracking.

🎯

Hybrid Evaluation

LLM-as-judge scoring combined with rule-based assertions across 20 ground-truth cases.

Workflow Pipeline

Step-by-Step System Flow

01

Coach Query

User asks a sports science question or requests workload calculation.

02

Intent Classification

ReAct agent classifies whether query needs RAG, math tool, metric log, or safety escalation.

03

Emergency Check

Safety router scans for emergency language. If detected, bypasses all retrieval and routes immediately to human escalation.

04

Tool Selection

Agent selects the appropriate tool: ChromaDB RAG, ACWR Python tool, or metric logger.

05

Deterministic Execution

Math tools execute exact Python calculations. RAG retrieves grounded sports science content.

06

Response Synthesis

Agent combines tool outputs into a structured, grounded response.

07

Metric Logging

Athlete metrics are timestamped and persisted to the database for longitudinal tracking.

Interface & Dashboard

AthleteIQ Interface

Analytics Dashboard

Conversation View

Engineering Challenges

Hard Problems Solved

The Problem

Language models are unreliable for precise numerical calculations like ACWR ratios. A wrong figure in a training load context could injure an athlete.

Engineering Solution

Routed all workload math to a dedicated Python function tool. The LLM only formats the result — it never generates the numbers.

Results & Evaluation

What Was Achieved

95%
Evaluated Accuracy
Across 20 ground-truth test cases
85%→95%
Accuracy Improvement
After eval harness + KB refinement
56
Knowledge Base Entries
Sports science domain coverage
3-tier
Safety Architecture
RAG → Math → Emergency bypass

Future Roadmap

What's Next

Multi-athlete dashboard
Wearable device integration (HRV, GPS load)
Season periodization planning
Injury prediction scoring
Coach collaboration workspace
Mobile athlete app

6 planned features · Active development