Developer production · Server APIs
The Conversations APIBy ForeverLearning

Build with Conversations · Step 2

Close and debrief

End the practice. Show what happened.

Hand it to your coding assistant.

Where to run it. Open a copy of the 01-first-room folder of conversations-room-starter (or your own step 1 app) in your coding assistant, with your key in FOREVERLEARNING_API_KEY, the API host in FOREVERLEARNING_BASE_URL and your assignment in FOREVERLEARNING_ASSIGNMENT_ID, in the environment it runs commands in. Then paste the prompt.

Paste this
Goal: a Finish button that closes the practice, and a debrief that shows what happened and what it means, each line linked to the turn it came from.

Read first: https://developers.foreverlearning.ai/docs/conversation-practice/ (the Conversations API integration guide), and the OpenAPI contract and the TypeScript example linked there. Use only what they describe.

Start from: this folder, step 1's practice room.

Build:
1. Give each turn on the page an id made from its ordinal (for example turn-3), so other parts of the page can link to it.
2. A Finish button. On Finish, the server closes the session with POST /v1/sessions/<session id>/end and an operation id it saves with the session first; a retried Finish sends the same operation id. Accept the closeout only when its session_ended event and its done event arrive. Show the closing turn like any other, with its safety status and receipt, and append its receipt to receipts.jsonl.
3. Then read the session's debrief and show it in plain words: what happened, what it means, the key moments with their takeaway and the next thing to try, how each character responded at the start and later, and the next practice. Beside each line, link to the turns its evidence references point to.
4. When the debrief is unavailable, show its reason in a plain sentence of your own, never the code.
5. After Finish, no more turns can be sent in that session.

Rules:
- Keep step 1's faces beside each character's line, and its one place for your own face artwork.
- The key is already in the environment. Never print it or write it into a file, not even a .env file.
- Keep step 1's rules: the key only on the server, a new Idempotency-Key for each POST, a failed turn (final, not charged) in your own words with the user free to send again, the characters' words exactly as returned.
- Describe how the characters responded as simulated responses in this practice, never as a reading of the user.
- The closeout is a billable text turn, at 3¢ per text turn, charged when it is saved; reading the debrief adds no charge. Test with one practice only: the opening, two or three messages and one Finish.
- Ending is optional: opening the learner's next session closes the open one with one billable closeout (3 cents), the same as calling end yourself. Call end when you want the debrief right away. Do not call end just to start another practice.
- Stop only the processes you started; never stop processes by name.

Done when:
- you ran `npm start`, practiced two or three turns, pressed Finish, and the closing turn showed with its receipt
- the debrief shows on the page, and at least one of its links lands on the turn it names
- receipts.jsonl has one line for each confirmed turn, the closeout included

Paste into your coding assistant.

Check it.

How to check it. Open http://localhost:3000, answer the character two or three times, then press Finish. You should see:

  • the closeout, with its receipt
  • a debrief: what happened and what it means, each line linked to the turn it came from
  • how the character's responses changed, and the next practice

The full check is in CHECK.md. To compare your result, the finished checkpoint is the 02-close-and-debrief folder of conversations-room-starter.

Close and debrief: what you should see

The replies and the debrief below are quoted word for word from one of our test runs of this kit, an app built from its prompt. Every reply is written fresh, so yours will use different words.

Run npm start, open http://localhost:3000, answer the character two or three times, then press Finish.

The closeout

The character's closing line and the Coach's closing note, shown like any other turn. Under it, the safety status and the receipt: 1 text turn · $0.03. Showing a shortened request id is fine if the full id is on the reply too, for example on hover. The closeout is a billable text turn, charged when it is saved. After it, the message box goes away: the practice is finished.

Jon: Okay. We can pick this up another time.

Coach

Debrief: You used an open question to get Jon to describe the second report, and he provided specific timing, ownership, and process details.

Strength: You kept the exchange focused on the work rather than turning it into a personal accusation.

Growth edge: The next conversation could connect those facts to the impact of the missed handoff and the expectation for future sign-off.

Practice markers: Open question; Clarity and specificity.

The closing turn keeps the faces beside each character's line, as every turn does (see step 1's check for where your own artwork goes).

Your debrief

Reading the debrief adds no charge. It describes the recorded practice:

  • What happened and what it means, each line with links to the turns it came from. Follow a link and the page scrolls to that turn.
  • Key moments: a title, the takeaway and the next thing to try.
  • How they responded: how each character's responses moved, from the start to later. These are simulated responses in this practice, never a reading of you.
  • Your next practice.
  • From the Coach: the Coach's closing words.

What happened

At turn 1, the first recorded practice moment included Clarity and specificity and Open question.

At turn 2, the last recorded practice moment included Open question.

What it means

Clarity and specificity was recorded as something you practiced in this session.

An open question was recorded as a way of inviting the other person’s response.

Key moments

Clarity and specificity

Takeaway: The recorded evidence shows Clarity and specificity in this session.

Next thing to try: In another practice, notice what changes when you use Clarity and specificity again.

Open question

Takeaway: The recorded evidence shows Open question in this session.

Next thing to try: In another practice, notice what changes when you use Open question again.

How the characters responded

These are simulated character responses in this practice, never a reading of you.

At the start, Jon responded more cautiously.

Later, Jon showed more strain.

Later, Jon showed more strain.

Next practice

Build on: Clarity and specificity

In your app, each of these lines links to the turns it came from.

Feedback comes at three levels: the Coach in the moment, this debrief after, and Insights across practices (a later step).

If the debrief isn't there

A practice that is too short may have no debrief. Your app says so in a plain sentence, for example: "This practice was too short for a debrief. Next time, stay with the conversation a few more turns before you finish."

The receipts

receipts.jsonl gains one line for each confirmed turn: the opening, each message and the closeout ("operation":"closeout").

The kit.

The repository

A start folder and the finish.

Open the kit

02-close-and-debrief in conversations-room-starter

Pick the room and the cast.

Open step 3