Navigate F1 history with AI β grounded answers, zero hallucination, exportable data.
The F1 Knowledge Agent is a RAG (Retrieval-Augmented Generation) agent grounded in Formula 1 Teams & Constructors data. Unlike a live-search agent, it answers questions only from its pre-loaded knowledge base β making every answer reliable, citeable, and auditable.
Every response comes in two layers:
- π Plain English answer β sourced directly from documents, with citation
- π Data Output table β structured data ready to copy into Excel, Python, or Tableau
User Question β search_documents tool β Relevant passages β Claude β Answer + Data Table
| Component | Implementation |
|---|---|
| Brain | Claude Sonnet 4 (Anthropic) β native tool use pattern |
| Knowledge Base | 6 curated F1 documents loaded as Python dictionaries |
| Retrieval | Keyword search with title weighting (2x) and stop-word filtering |
| Output | Two-layer: plain English answer + exportable markdown table |
How it differs from Compass
| Compass (Live Search) | F1 Knowledge Agent (RAG) | |
|---|---|---|
| Data source | Live web, Wikipedia, Google News | Pre-loaded static knowledge base |
| Best for | Current events, real-time data | Historical facts, structured analytics |
| Reliability | Depends on live sources | Fully auditable β answers trace to docs |
| Architecture | ReAct loop with 4 external APIs | RAG retrieval with native tool use |
Together, these two projects demonstrate both core AI agent architectures used in production systems.
| # | Document | Coverage |
|---|---|---|
| 1 | Ferrari Scuderia History | Founded 1929, 16 titles, Schumacher era, current status |
| 2 | Red Bull Racing History | Founded 2005, Vettel dynasty, Verstappen dominance, 2023 peak |
| 3 | Mercedes AMG Petronas History | 8 consecutive titles, Hamilton era, post-2021 decline |
| 4 | McLaren Racing History | Senna/Prost golden era, decline, 2024 comeback |
| 5 | Williams Racing History | Frank Williams dynasty, financial struggles, Dorilton sale |
| 6 | Constructors Championship All-Time Data | Full year-by-year table 1958β2024, all team totals |
Document 6 is the analytics layer β structured as a clean table so the agent can produce exportable data outputs for further analysis in Python, Excel, or Tableau.
Easy (direct facts):
- "Which F1 team has the most Constructors Championships?"
- "When was Red Bull Racing founded?"
- "How many titles has Mercedes won?"
Medium (comparative):
- "Compare Red Bull and Mercedes titles won after 2010."
- "Which team won back-to-back Constructors titles most recently?"
Hard (analytical):
- "Which team had the most dominant single season in F1 history?"
- "What pattern do teams show after a dominant era ends?"
Gracefully declined (knowledge gaps):
- "Who will win the 2026 title?" β Agent refuses to speculate
- "What was Ferrari's tire strategy in the 2022 Bahrain GP?" β Agent flags the gap
The notebook deliberately stress-tests three core RAG failure scenarios every production system faces:
| Failure Mode | Test | Key Lesson |
|---|---|---|
| Outdated data | Inject 2019 standings alongside 2024 docs | Keyword search has no date awareness |
| Contradicting documents | Two sources give different Ferrari title counts | Agent blends without flagging conflict |
| Knowledge gap | Ask for race-level data not in any document | Risk of hallucination when retrieval is partial |
Each failure includes a written root-cause analysis and proposed fixes β the same evaluation framework used in real enterprise RAG deployments.
- Open
F1_Knowledge_Agent.ipynbin Google Colab - Get an Anthropic API key at console.anthropic.com
- Paste your key in Cell 2
- Runtime β Run all
QUESTION: Which F1 team has the most Constructors Championships?
============================================================
π Searching: 'most constructors championships F1 team'
Found 3 relevant documents
π ANSWER:
Ferrari holds the record for the most Constructors Championships in Formula 1
history with 16 titles, spanning from 1961 to their most recent in 2008.
Source: constructors_championship_alltime.md, ferrari_history.md
π DATA OUTPUT:
| Team | Constructors Titles | First Title | Last Title | Active |
|-----------|--------------------:|-------------|------------|--------|
| Ferrari | 16 | 1961 | 2008 | Yes |
| Williams | 9 | 1980 | 1997 | Yes |
| McLaren | 9 | 1974 | 2024 | Yes |
| Mercedes | 8 | 2014 | 2021 | Yes |
| Red Bull | 6 | 2010 | 2023 | Yes |
- LLM: Claude Sonnet 4 (Anthropic API, native tool use)
- Retrieval: Keyword-based search with title weighting and stop-word filtering
- Domain: F1 Teams and Constructors Championship (1958β2024)
- Environment: Google Colab
- Course: ISOM 260/900 β AI for Business, Suffolk University
| Project | Description |
|---|---|
| Compass Agent | Live-search AI research agent using Wikipedia, web fetcher, calculator, and Google News |
| Sports Analytics Portfolio | Predictive modeling and statistical analysis across multiple sports domains |
Benedict Daxell Santoso
- Business Analytics & Information Systems, Suffolk University (May 2026)
- LinkedIn: linkedin.com/in/benedictdaxellsantoso
- GitHub: github.com/bdsantoso168
ποΈ F1 Knowledge Agent β grounded answers, exportable data, zero hallucination.