Developer production · Server APIs
The Conversations APIBy ForeverLearning

Build with Conversations · Step 3

Pick the room and the cast

One hundred rooms. Up to five characters.

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 practice picker. The user chooses a ready-made room and the people in it, or practices on their own topic, then practices as in step 1, with every character's line under that character's own name and face.

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. A picker page, the first thing a user sees, built from the catalog the server reads: its rooms (title, category_id, description, modes, min_participants, max_participants, recommended_personas, topic_consent_required), its personas (display_name, role), its categories and its modes (each with a label). Use plain form controls with visible labels, so the picker works from the keyboard and with a screen reader:
   - Radio buttons labeled "A ready-made room" and "Open practice", the first chosen.
   - For a room: a select labeled Room, listing every room whose topic_consent_required is false by its title, grouped under its category's label (rooms that need topic consent come in a later step). Show the chosen room's description. Never show a room id.
   - A select labeled Mode: the chosen room's modes, by the catalog's labels, with guided chosen.
   - A checkbox for each persona, labeled with the persona's display_name and role. Choosing a room ticks its recommended_personas, and the user may change who is ticked. Say the room's limit in words (for example "This room seats 1 to 2 people"), and allow a start only with min_participants to max_participants people ticked.
   - For open practice: a text box labeled Topic (optional, up to 240 characters), radio buttons labeled "One-on-one" (exactly one person) and "A room" (two to five people), and the same person checkboxes, none ticked to begin with.
   - A button labeled Start practice.
2. On Start practice, the server checks the same limits, then prepares one session for the user. For a room: setup kind "room", its room_id, the mode, and the ticked people as participants, each by persona_id. For open practice: setup kind "open", mode "open_practice", cast_shape "one_on_one" or "room", the ticked people as participants, and the topic. Then it requests that session's opening once. If the API refuses the setup, show a short message in your own words and keep the picker as it was: preparing a session adds no charge.
3. The practice page, as in step 1: the room's title (or "Open practice" and the topic), the names of the people in it, the opening, and each message the user sends as a turn on that session. Show each entry of each turn's cast under its own display_name in its own bubble, with that speaker's face (match the saved turn's characters to the line by speaker_id). With several people, more than one may answer in a turn. Keep step 1's Coach panel, safety status, receipt, faces file and receipts.jsonl.
4. A button labeled New practice that goes back to the picker. A new choice prepares a new session. Do not end the earlier session yourself: opening the new one closes it with one billable closeout (3 cents).

Rules:
- Keep the API key on the server, in the FOREVERLEARNING_API_KEY environment variable. Read the API host from FOREVERLEARNING_BASE_URL, and send FOREVERLEARNING_ASSIGNMENT_ID as X-Assignment-Id. Never send the key to the browser, print it or write it into a file.
- Give every POST its own new Idempotency-Key, a UUID. If a turn's outcome is uncertain (the connection ends before done), look it up with GET /v1/requests/<request id>. Never send it again under a new key while its outcome is uncertain.
- If a turn fails (an error event arrives before done), it was not charged and it is final: show a short message in your own words and let the user send a message again. Never show raw error text or JSON.
- An error status instead of an event stream means the turn was not committed or charged. Let the user send it again; the server sends it with a new Idempotency-Key.
- Show the characters' words exactly as returned. When a saved turn's structure is "unavailable", show its text without inventing a speaker.
- The faces are the characters' simulated responses in this practice, never a reading of the user. Give each face its mood in words as its accessible label only, never as a caption on the page: the user reads the face.
- Use a pseudonymous user id, never a name or an email. Make a new random id for each new browser; never reuse a fixed test id.
- Preparing a session adds no charge. The opening and each message are billable text turns, at 3¢ per text turn, however many people are in the room. Test as one user: test through a browser, or keep one cookie jar across your requests, so every request carries the same cookie. Test two practices, no more: "Direct Feedback To A Report" with its recommended people (the opening and one message), and a practice with two or more people you chose (the opening and one message). Don't end a session: closing is a turn too.
- 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`, picked a room, and its opening showed with each speaker's name and face
- you chose your own people for a practice, and the people you chose answered, each under their own name
- the Coach's note, the safety status and the receipt show with each reply, and receipts.jsonl has one line for each confirmed turn

Paste into your coding assistant.

Check it.

How to check it. Open http://localhost:3000. Pick "Direct Feedback To A Report" and press Start practice, then answer. Press New practice, pick a room, choose your own people, and answer again. You should see:

  • each speaker's line under their own name, with their face beside it, and more than one speaker answering when the room holds several
  • the Coach's note in its own panel, and the safety status and the receipt with each reply
  • a start refused, in plain words, when the people ticked are outside the room's limit

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

Pick the room and the cast: what you should see

The replies 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 and open http://localhost:3000.

The picker

The picker comes first. Every ready-made room that needs no topic consent is in the Room list, grouped by category, with its description. (Rooms that ask for topic consent come in a later step.) Under it:

  • Mode: the room's modes, with guided practice chosen.
  • The people: a checkbox for every character, by name and role. Choosing a room ticks the people it recommends. Untick them and tick others if you like: anyone can join any room, as long as the room's limit holds. The page says the limit in words, for example "This room seats 1 to 2 people".
  • Open practice: your own topic (up to 240 characters), one-on-one with one person or a room of two to five.

Tick more people than the room seats and press Start practice: the practice doesn't start, and the page says why in plain words. Preparing a session adds no charge, so a refused start costs nothing.

A room with several people

Pick "Direct Feedback To A Report" and press Start practice. The room opens with the people you chose. With more than one person in the room, more than one may answer in a turn, each in their own bubble, under their own name, with their own face.

Your own people

Press New practice, pick a room, tick your own people and start. The people you ticked are the people in the room: they are the ones who answer.

For example, open practice as a room with Dana and Noor, on the topic "Agreeing on who presents the quarterly results at Friday's meeting." Both answer in each turn:

Dana: Look, Friday's meeting is in three days, and I'm not presenting the quarterly results for the team again. We need one person owning that deck and the questions that come with it.

Noor: I can take part of it. I have been tracking the open threads, so I could handle the results summary if that helps. I just do not want us deciding this in a way that leaves the handoff unclear.

Coach

What happened: Dana set a firm boundary around presenting, while Noor offered partial help and raised the need for a clear handoff.

Why it matters: The room has two workable starting points, but ownership and scope are still open.

Next move: You could name who should own the presentation and ask what support would make that handoff workable.

You: I'd like to present the results this time. How should we split it?

Dana: You present the results. Noor, you take the open questions and track anything we cannot answer on the spot. I will handle the overall narrative and step in if the room gets stuck.

Noor: That works for me. I can keep the question list tight and flag anything that needs a follow-up before Friday.

Coach

What happened: You offered to present the results, and Dana assigned Noor the open questions while keeping the overall narrative.

Why it matters: The split gives each person a defined part and leaves a clear backup for questions that need follow-up.

Next move: You could confirm who will prepare the question list and when you will review the deck together.

With each reply

As in step 1: the Coach's note in its own panel, the safety status (for example Safety: clear · action: none) and the receipt (1 text turn · $0.03 and the request id). Showing a shortened request id is fine if the full id is on the reply too, for example on hover. A room of five costs the same per turn as a room of one: 3¢ per text turn.

The faces

Beside each character's line, a face drawn in code that follows their mood on that turn: one of five moods, or the neutral face when no expression is reported. The faces are the characters' simulated responses, never a reading of you.

Your own artwork. All the face artwork is in one place: in the finished checkpoint, the block marked YOUR OWN ARTWORK GOES HERE in public/faces.js. Put your images in public/faces/ and write each one's address there, one per mood (and if you like, per expression or per character). Any mood you leave empty keeps the drawn face.

If a message doesn't go through

If the API answers with an error instead of the reply, the turn was not committed or charged. The page says so in plain words and you can send it again; your server sends it as a new request.

The receipts

receipts.jsonl gains one line for each confirmed turn: each opening and each message.

The kit.

The repository

A start folder and the finish.

Open the kit

03-room-and-cast in conversations-room-starter

Practice before it counts.

Read the integration guide