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

# Sessions, runs, and operations

> Understand Whitney's durable training lifecycle and ordering rules.

A session fixes the provider, funding route, cost ceiling, idle lease, and
capability snapshot. A session owns one run. A run fixes the base model, LoRA
configuration, and optional resume checkpoint.

Operations are durable and ordered. For every run operation, send:

* a positive `seq_id` that advances by one,
* an `idempotency-key` that is reused on retry,
* and the canonical request hash for exactly that request.

Do not submit the next operation until the previous operation succeeds. A
failed, cancelled, interrupted, or timed-out operation is terminal; recover by
following its error semantics rather than inventing a new sequence number.

## Training and sampling

Trainer operations include `forward`, `forward_backward`, `optim_step`,
`save_state`, `load_state`, `save_weights_for_sampler`, and `export_lora`.
Sampling uses a sampler created or synchronized from a specific trainer weight
version. `sample` never silently pulls newer trainer weights.

## Completion and cleanup

Call `finish` only after the caller-owned loop is complete. Call `cancel` on
failure or interruption. Close the session after all work is terminal so
Whitney can reconcile usage and release provider resources.

Wall-clock, idle, startup, and stuck-operation limits remain active for every
session. Set `max_cost_microusd` when you need an explicit dollar ceiling.
