> ## Documentation Index
> Fetch the complete documentation index at: https://docs.machina.gg/llms.txt
> Use this file to discover all available pages before exploring further.

# F1 Stats Agent

> Comprehensive Formula 1 statistics, driver insights, and race analysis for F1 enthusiasts.

## Key Features

<CardGroup cols={2}>
  <Card title="Race Analytics" icon="chart-line">
    Post-race lap times, position changes, and race strategy insights for completed Grand Prix events.
  </Card>

  <Card title="Driver Statistics" icon="user-helmet-safety">
    Comprehensive driver profiles with career statistics, performance trends, and head-to-head comparisons.
  </Card>

  <Card title="Team Performance" icon="users-gear">
    Constructor standings, car development analysis, and historical team performance data.
  </Card>

  <Card title="Circuit Information" icon="road">
    Detailed track layouts, sector analysis, and historical race data for all F1 circuits.
  </Card>
</CardGroup>

## Implementation Guide

### 1. Installation

The F1 Stats Agent is installed using the `_install.yml` configuration:

```yaml theme={null}
setup:
  title: "F1 Stats Agent"
  description: AI-powered Formula 1 statistics and insights.
  category:
    - sports-analytics
  estimatedTime: 5 minutes
  features:
    - Historical F1 race data analysis
    - Driver and team statistics tracking
    - Circuit performance insights
  integrations:
    - formula1-api
    - sportradar
```

### 2. Folder Structure

The template creates a standard folder structure for organizing your F1 data:

```yaml theme={null}
- Races: Historical race data and results
- Drivers: Driver profiles and statistics
- Teams: Constructor information and performance data
- Circuits: Track information and race history
- Chat Threads: User queries and conversations
```

### 3. Data Synchronization

Configure data synchronization for different F1 data types:

#### Race Data Sync

```yaml theme={null}
workflow:
  name: "sync-f1-race"
  title: "Sync F1 Race Data"
  description: "Workflow to sync Formula 1 race data."
  inputs:
    race_id: "$.get('race_id') or None"
  tasks:
    - type: "connector"
      name: "task-load-race-data"
      connector:
        name: "formula1-api"
        command: "get-race/{race_id}/{data_type}"
        command_attribute:
          race_id: "$.get('race_id')"
          data_type: "'full.json'"
```

#### Driver Stats Sync

```yaml theme={null}
workflow:
  name: "sync-f1-driver"
  title: "Sync F1 Driver Stats"
  description: "Workflow to sync Formula 1 driver statistics."
  inputs:
    driver_id: "$.get('driver_id') or None"
```

### 4. Chat Processing

The template includes a thread executor for processing F1-related queries:

```yaml theme={null}
workflow:
  name: "f1-thread-executor"
  title: "F1 Thread Executor"
  description: "Workflow to execute F1 stats queries."
  tasks:
    # Load pending thread
    - type: "document"
      name: "load-pending-thread"
      config:
        action: "search"
        search-limit: 1
        search-vector: false
    
    # Generate response using AI
    - type: "prompt"
      name: "f1-stats-prompt"
      connector:
        name: "machina-ai-fast"
        command: "invoke_prompt"
        model: "llama-3.3-70b-versatile"
```

### 5. Scheduler Configuration

Set up schedulers to automate periodic F1 data updates:

```yaml theme={null}
agent:
  name: "f1-data-scheduler"
  title: "F1 Data Update Scheduler"
  description: "Scheduler responsible for keeping F1 data current."
  context:
    config-frequency: 24  # Runs daily to fetch latest available data
  workflows:
    - name: "sync-f1-race"
      description: "Workflow to sync race data after events"
```

## Customization Options

### Data Sources

* Configure different F1 data providers based on your needs
* Add custom data sources by creating new connector configurations

### AI Models

* Switch between different language models:
  * OpenAI (gpt-4o) for highest quality responses
  * Groq (llama-3.3-70b-versatile) for faster processing
  * Other models as needed for specific use cases

### Sync Frequency

* Adjust scheduler frequencies based on F1 race calendar
* Configure different update rates for race weekends vs. off-season periods

### Content Generation

* Customize prompt schemas to generate different types of F1 content
* Modify mapping configurations to transform data for your specific needs

## Sample Workflows

The F1 Stats Agent includes several sample workflows:

* **sync-f1-race.yml**: Synchronize race results data
* **sync-f1-driver.yml**: Update driver statistics
* **sync-f1-team.yml**: Update constructor data
* **f1-thread-executor.yml**: Process F1-related queries
* **f1-race-preview\.yml**: Generate race weekend previews
* **f1-race-recap.yml**: Create post-race analysis

## Next Steps

* Explore the [Workflows](/core-components/workflows) documentation to understand how to customize the template
* Learn about [Connectors](/core-components/connectors) to add additional F1 data sources
* Review [Mappings](/core-components/mappings) to transform data for your specific needs
* See [Prompts](/core-components/prompts) to customize F1 content generation
