Skip to main content

A robust, type-safe Python SDK for Garmin Connect data extraction.

Project description

Garmin Training Toolkit SDK

A robust, type-safe Python SDK for extracting biometric data and telemetry from Garmin Connect, optimized for autonomous agents and LLM tool-calling.

Architecture: LLM-Native & Vendor-Agnostic

The SDK has been refactored to prioritize:

  1. Semantic Naming: No more cryptic Garmin fields. We use min_target, max_target, and target_type.
  2. Provider Pattern: Logic is decoupled from Garmin-specific APIs. You can now use a standardized BaseBiometricProvider interface.
  3. Agent-First Schema: Pydantic models include exhaustive descriptions and Literal types, allowing LLMs to understand the tool requirements with 100% accuracy from the JSON schema alone.

Installation

This project uses uv for dependency management.

# In your consumer project:
uv add git+https://github.com/restrok/garmin-training-toolkit-sdk.git#subdirectory=garmin_toolkit

Quick Start

1. Standardized Provider Interface

The recommended way to use the SDK is via the GarminProvider.

from datetime import date
from garmin_training_toolkit_sdk.core.garmin import GarminProvider

# 1. Initialize (automatically finds local tokens)
provider = GarminProvider()

# 2. Fetch Activities (Returns vendor-agnostic Protocol models)
activities = provider.get_activities(date(2026, 4, 1), date(2026, 4, 30))
latest = activities[0]
print(f"Activity: {latest.name} | Distance: {latest.distance_m}m")

# 3. Get Telemetry
telemetry = provider.get_telemetry(latest.id)
print(f"Sample HR: {telemetry.ticks[0].hr_bpm} bpm")

2. LLM-Native Workouts (Agent Friendly)

Agents can create workouts using semantic naming or high-level helpers.

from garmin_training_toolkit_sdk.protocol.workouts import create_simple_hr_workout

# High-level helper for Agents
workout = create_simple_hr_workout(
    name="Z2 Recovery Run",
    date="2026-05-01",
    bpm_min=135,
    bpm_max=145,
    duration_mins=45
)

# Upload via the provider
report = provider.upload_training_plan(workout)
print(f"Status: {report.message}")

Tool Factory (For AI Agents)

If you are building an AI Agent (LangChain, AutoGPT, etc.), you can use the ToolFactory to generate a standardized set of tools from any provider.

from garmin_training_toolkit_sdk.core.factory import ToolFactory
from garmin_training_toolkit_sdk.core.garmin import GarminProvider

provider = GarminProvider()
tools = ToolFactory.create_tools(provider)

# These tools have semantic descriptions that LLMs love:
# - get_activities
# - get_telemetry
# - upload_training_plan

Directory Structure

  • core/: Provider implementations (Garmin, etc.) and the Tool Factory.
  • protocol/: Vendor-agnostic Pydantic models (Activity, Telemetry, Workout).
  • extractors/: Low-level data extraction logic.
  • uploaders/: Logic for calendar and workout management.

Testing & Mocks

The SDK includes a MockGarminClient in testing/mock.py to allow consumers to test their pipelines without hitting Garmin's production APIs.

from garmin_training_toolkit_sdk.testing.mock import MockGarminClient
# Use in your unit tests to avoid rate limits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

garmin_training_toolkit_sdk-0.5.0.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

garmin_training_toolkit_sdk-0.5.0-py3-none-any.whl (46.5 kB view details)

Uploaded Python 3

File details

Details for the file garmin_training_toolkit_sdk-0.5.0.tar.gz.

File metadata

  • Download URL: garmin_training_toolkit_sdk-0.5.0.tar.gz
  • Upload date:
  • Size: 35.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for garmin_training_toolkit_sdk-0.5.0.tar.gz
Algorithm Hash digest
SHA256 be0f55509e4572e94429be6e2dc7e0f1fddf291d7c212577c59c2da733422c2f
MD5 7f98c2b87edc1853d780733c7e69cf89
BLAKE2b-256 e036117eefb16ec4e494fd1f31964735f42cab76ebd19a52812538c8792e20c3

See more details on using hashes here.

File details

Details for the file garmin_training_toolkit_sdk-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: garmin_training_toolkit_sdk-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 46.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for garmin_training_toolkit_sdk-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60c7ae804af0dd6a7148f2e3d343dd2d814cb5eb0fe55ecbb789cb57b18e0755
MD5 69317c6e9c50aee283b4c8f172d6e722
BLAKE2b-256 0a01d24e5019aebed38d5bda95fc2df9260cbd4a7e686232c6b6cdd53ba6dfb9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page