# Request paths

> What happens when you open a lesson, start an exercise, check it, ask for an explanation, and get an offer.

Applies to: the Sypnia engine (open source, self-hosted) and Sypnia Cloud (paid service).  
Source: https://learn.docs.sypnia.com/architecture/request-paths/

For agents: Paths: (1) open a lesson: GET /lessons/{id}?project= → load lesson version → resolve level (profile) and language → binder runs uses selectors against Cases (map), Data (schema only), Telemetry (preview/test traces) with the person's token, cached 10 min → render level blocks + slots → response with bound items. (2) start: POST /lessons/{id}/exercises → Git API: branch learn/<id> from default branch + commit LEARN.md → exercise row started. (3) check: POST /exercises/{id}/check → check_run queued → runner job {repo, commit, checks, timeout 10 min} → runner clones, runs each check, posts results (signed callback) → all pass: progress done, memory note via account memory API, Telemetry span check-exercise. (4) explain: POST /explain → read the item with the person's token → mask secrets → Sypnia AI task explain with level/language → answer streamed, not stored. (5) offers: product events (EventBridge in Cloud, webhooks self-hosted) → match trigger to undone lesson → rate rules → offer row → App polls GET /offers or receives push.

## Opening a lesson

### 1. The lesson and you

`GET /lessons/failures-have-names?project=la-espiga` loads the current version of the lesson, your level from your profile and your language.

### 2. Your project

The binder answers each `uses` selector by reading your project with **your** token: the map from Cases, the table names from Data, preview traces from Telemetry. What it found is kept for 10 minutes.

### 3. Rendered

Level blocks for other levels are dropped, the slots are filled, and the answer names the items it chose.

## Starting an exercise

`POST /lessons/{id}/exercises` asks Git to create `learn/<lesson>` from your default branch and commit `LEARN.md` to it, then records the exercise as `started`. From the CLI with a local folder, the branch is created on your machine and pushed when you check.

## Checking

### 1. Queued

`POST /exercises/{id}/check` records a run and sends a job to the runner: the repository, the commit, the checks and a 10-minute limit.

### 2. Run

The runner clones that commit into a sandbox and runs each check. A `telemetry` check waits for the branch's preview to send the expected trace.

### 3. Results

The runner sends the results back, signed. When every check passes, the lesson is marked done, a note is written in your memory, and the run appears as a span of the case `check-exercise` in Telemetry.

## Explaining

`POST /explain` reads the item with your token, replaces secret values and masked columns, and asks [Sypnia AI](https://ai.docs.sypnia.com/) for an explanation at your level and in your language. The answer streams back and is not stored.

## Offering a lesson

Products publish events (a scope error in Cases, a failed check, a production deploy, a new problem in Telemetry). Learn matches each one to a lesson you have not done, applies the rules (once per trigger, at most one an hour and three a day), and records an offer that App shows.
