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

# Adaptive triggers

> How a session adapts while a teammate trains, what presets and profiles control, and how a teammate takes a change back.

> [!NOTE]
>
> Live adaptation is behind a feature flag during early access. Routes return `404` while the
> feature is off for an account.

When a teammate trains a program the engine built, live adaptation watches each logged set and
adjusts the remaining sets in that session when effort runs clearly harder or easier than planned.
Teammates and coaches choose how sensitive those adjustments are, and the teammate can undo any
live change with one tap.

Set these two values once in your terminal. Every example in these docs reads them, so
no example has a host or a key typed into it.

```bash theme={null}
export TF_API_BASE="https://api.technicallyfit.com"
export TF_API_KEY="tf_test_your_key_here"
```

Use a test key (it starts with `tf_test_`) while you build. Never paste a live key into a
page, a ticket or a chat.

## Triggers and presets

A **trigger** is a plain rule that watches set-level effort readings against the planned target
for each movement. For example, a trigger can fire when reported effort is at least 1.5 over target
on two consecutive sets of the same movement.

A **preset** groups a tested set of triggers for a training goal:

| Preset | What it is for |
| - | - |
| `general_fitness` | Default. Balanced thresholds that dial back after two hard sets and build after two easy sets. |
| `hypertrophy` | Adjusts remaining sets when effort drifts over or under target across two sets. |
| `strength` | Responds quickly to effort spikes and sustained over-target sets to protect bar speed. |
| `power` | Guards output quality with tight upper effort thresholds and single-set spike protection. |

List the presets available for a profile with `GET /v1/adaptation-presets`:

```bash theme={null}
curl "$TF_API_BASE/v1/adaptation-presets" \
  -H "X-API-Key: $TF_API_KEY"
```

## The on/off switch and when changes take effect

Every teammate has one adaptation profile with:

* an `enabled` switch (defaults to `true`);
* a `preset` (defaults to `general_fitness`);
* a `policy` (`resolve_remaining`, which adjusts the remaining sets of the current session);
* the `triggers` in force (the preset's triggers plus any custom triggers).

Profile changes apply at the **next session start**. A session that is already running keeps the
triggers it started with so behavior stays predictable mid-workout.

Read or update a teammate's profile through the `/v1` API (requires `programs:read` or
`programs:write` and the teammate's `programs` consent):

```bash theme={null}
curl "$TF_API_BASE/v1/teammates/member-1042/adaptation-profile" \
  -H "X-API-Key: $TF_API_KEY"
```

```bash theme={null}
curl -X PUT "$TF_API_BASE/v1/teammates/member-1042/adaptation-profile" \
  -H "X-API-Key: $TF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enabled": true, "preset": "hypertrophy"}'
```

## Who can change a profile

* **Teammate without a coach:** changes their own switch, preset and custom triggers.
* **Teammate with a coach:** both can see every trigger and who created or last updated it. Both
  can add custom triggers, and the coach can change any trigger, including ones the teammate added.
* **Organization:** can read and update the profile for a teammate who granted `programs` consent.

Anyone else receives `403`.

## What a live change does and the session cap

When a trigger fires on a live set, only the remaining sets of the current session are updated.
Sets already logged stay untouched. Each response includes a plain sentence explaining what
changed and why, along with the `adaptation_id`.

To keep a workout steady, live adaptation applies at most **3 changes per session** across all
triggers. Once a trigger fires, it also enters a cooldown period (a fixed number of sets or the
rest of the session) before it can fire again on that movement.

## The veto and the quiet period

The teammate always has the final say. Calling the veto endpoint undoes the latest live change in
an active session:

```bash theme={null}
curl -X POST "$TF_API_BASE/v1/teammates/member-1042/adaptations/6f2a9c10-4b8d-4a2e-9c1f-1234567890ab:veto" \
  -H "X-API-Key: $TF_API_KEY"
```

When a change is vetoed:

* sets not yet logged return to the prescription from before that change;
* sets already logged stay as logged;
* that trigger stays quiet for the rest of the session, while other triggers can still fire.

Only the newest applied change in an active session can be vetoed. Repeating the same veto returns
the same result without writing anything new.

## Live adaptation vs next-day adaptation

Live adaptation and next-day adaptation work together without competing:

* **Live adaptation** adjusts the remaining sets of **today's active session** while sets are
  logged live.
* **Next-day adaptation** uses logged sets and pain reports to update **upcoming sessions** in the
  program after the session is logged. See [Programs and revisions](https://docs.technicallyfit.com/guides/programs-and-revisions.md)
  and [Proposals and coach approval](https://docs.technicallyfit.com/guides/proposals-and-coach-approval.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.