# Study track

> For the complete documentation index, see [llms.txt](https://docs.lertha.com/llms.txt).
> Any documentation page is available as raw Markdown by appending `.md` to its URL.

> Seven exercises, each one against a running worker, in the order the concepts land.

Do these in order, each against the running lab worker, watching the UI. The lab repository is
`lerta-orchestration-lab`; every command below is in its README.

1. **Durability.** Start `--fail 3`, kill the worker between attempts, restart it. The run
   finishes. Nothing in the client noticed. Then kill the client mid-run and re-attach with
   `orchestrator.handle(type, RunId("..."))`: the result was waiting.
2. **Retries are the engine's, not yours.** `RetryPolicy` in `RunOptions` is the whole retry
   story. Look at the attempt list in the UI. Throw `NonRetryableTaskError` and watch it stop on
   attempt 1.
3. **Ids are idempotency keys.** Run `--id same-id` twice while the first is in flight:
   `RunAlreadyExists`. Switch to `USE_EXISTING`: the second caller gets the first run's handle.
   Decide which `ReusePolicy` an OTP send wants and which a nightly recompute wants.
4. **Cancellation is cooperative.** It is delivered at the next heartbeat. A handler that never
   heartbeats cannot be cancelled, only timed out.
5. **Timeouts are two budgets.** `attemptTimeout` and `overallTimeout`. Unbounded retries without
   an overall budget is rejected; find out why by removing the check.
6. **The agentic part.** Run the agent flow with `--silent`, open the run in the UI, read the event
   history. Kill the worker while the run is parked on the approval, restart it, send the approval
   with `lertha flow signal`. The flow resumes at the `receive` call with all its local state intact. The worker that
   finishes the run is not the one that started it.
7. **Break determinism on purpose.** Put a clock read or a `Random` in a flow body, do the
   kill-and-restart trick, and watch for the non-determinism error. Then run two builds of the
   worker on one queue and see version skew for yourself.

Lessons the first cohort learned the hard way: keep one worker tab, and make the approval wait
long enough for a human.
