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:
- Semantic Naming: No more cryptic Garmin fields. We use
min_target,max_target, andtarget_type. - Provider Pattern: Logic is decoupled from Garmin-specific APIs. You can now use a standardized
BaseBiometricProviderinterface. - Agent-First Schema: Pydantic models include exhaustive descriptions and
Literaltypes, 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. Calendar Range Queries (New)
items = provider.get_calendar_range(date(2026, 5, 25), date(2026, 6, 5))
print(f"Found {len(items)} scheduled items across month boundaries.")
# 4. Wellness Metrics (New)
sleep = provider.get_sleep_history(date(2026, 4, 1), date(2026, 4, 7))
hrv = provider.get_hrv_history(date(2026, 4, 1), date(2026, 4, 7))
profile = provider.get_user_profile()
# 5. Workout Introspection (New)
workouts = provider.get_workout_templates()
for w in workouts:
print(f"Template: {w.workout_name} ({w.sport_type})")
# 6. Get Telemetry
telemetry = provider.get_telemetry(latest.id)
Key Features
🛡️ Robust Authentication & Self-Healing
The SDK now handles OAuth scopes more comprehensively (including USER_PROFILE) and features automated self-healing. If a 401 Unauthorized is encountered on a non-critical endpoint, the provider automatically attempts a token refresh and retries the operation seamlessly. This protection now covers all activity, calendar, and wellness data fetches.
📅 Date-Based Query Standardization
Methods like get_scheduled_workouts have been refactored to accept standard date objects. The SDK handles all internal year/month pagination and boundary logic, including the new get_calendar_range method which deduplicates items across month boundaries.
🧩 Provider-Agnostic Interface
The BaseBiometricProvider now includes standardized methods for:
- Deletion:
unschedule_workoutanddelete_workout_template. - Wellness:
get_sleep_history,get_hrv_history, andget_user_profile. This allows higher-level coaching and ETL logic to remain completely brand-agnostic.
🧪 Agent Tool Compatibility
Tools generated by the ToolFactory now include a .run() method, ensuring full compatibility with LangChain StructuredTool expectations and making them directly callable for internal execution. The factory now exposes 10 core tools covering activities, workouts, and biometrics.
Tool Factory (For AI Agents)
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
Metadata
Release files for garmin-training-toolkit-sdk 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| garmin_training_toolkit_sdk-0.8.0.tar.gz | 46.4 kB | Without provenance | Details for garmin_training_toolkit_sdk-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| garmin_training_toolkit_sdk-0.8.0-py3-none-any.whl | Python 3 | none | any | Details for garmin_training_toolkit_sdk-0.8.0-py3-none-any.whl |
Total release size: 105.3 kB
Release files / garmin_training_toolkit_sdk-0.8.0.tar.gz
| Download URL | garmin_training_toolkit_sdk-0.8.0.tar.gz |
|---|---|
| Size | 46.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9753947f2b49ff484f3097dcc8fe43f678f447c239d4616019cf5237b40526f8
|
|
BLAKE2b-256 checksum How to use checksums |
d40eb164630680864a3ad8e2c3d73e21e27abd9b53980f9ed30dfc6d9d58dd06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|
Release files / garmin_training_toolkit_sdk-0.8.0-py3-none-any.whl
| Download URL | garmin_training_toolkit_sdk-0.8.0-py3-none-any.whl |
|---|---|
| Size | 58.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb1c183c7c8f8cc6863ddc0bdbce361ff6e97ef426be62bd45c76b2010d5a43e
|
|
BLAKE2b-256 checksum How to use checksums |
db221317f8111a013db61bd948ba07469d087e36f1ac8e3d212d711264d33d7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}
|
Security for garmin-training-toolkit-sdk 0.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.