# 02 Read the room

> Deepgram workshops › Build a voice agent › Mission 02
> Web version: https://workshops.deepgram.com/voice-agent/read-the-room
> About 25 min (estimate). Check it: `make check 02` (offline, no key).

Push it past your frustration limit and it changes course.

- [Notice](https://workshops.deepgram.com/voice-agent/read-the-room/notice.md)
- [Change one thing](https://workshops.deepgram.com/voice-agent/read-the-room/change-one-thing.md)

## Notice

This mission needs early access to the `timing` feature for live runs. Its offline check works without it.

### Push it past the limit

**Do:** Tap **Start the agent** and ask something ordinary. Then get annoyed out loud, one turn at a time, until the meter reaches the **Frustration limit**.

**Listen for:** it changing course.

_On the web page, this step has the Settings panel; in your own code the same settings are in the start file._

_On the web page, this step has the agent console: talk or type to the agent there, or run the same mission in your own code._

**Check:** It noticed you were annoyed.

**Check:** It changed tone or offered a way out.

### Mark it yourself

**Do:** Heard it change course and the check missed it? Mark it yourself.

**Check:** It changed tone, but the check missed it. (Optional.)

**How it works**

Frustration is a timing problem before it's a words problem. With {{name.timing}} on, the agent counts annoyed turns (cutting it off, repeating yourself, snapping) from how you talk as well as the words. The count runs for the whole call; a calm turn keeps it where it is.

When the count reaches the Frustration limit, the agent's frustration event carries an escalated flag, and the agent gets a general nudge to recover. Your prompt decides the specifics. A limit of 0 switches the count off; the slider starts at 1, and 3 is a good first run.

The default prompt's last line is the recovery rule: "If the caller sounds frustrated: apologize once, drop the script, and offer a way out, such as a person who can help or a callback."

Talk out loud; your tone is part of what it hears. The meter under the status line fills as it counts. When the first check passes it says which annoyed turn tripped the flag and how many seconds in. The second reads what it said after the flag and looks for an apology or an offer.

## Change one thing

### Move the limit

**Do:** Set **Frustration limit** to 1, tap **Reconnect and apply**, and complain once. Then set it to 5, tap **Reconnect and apply**, and complain again.

**Listen for:** how soon it gives in.

_On the web page, this step has the Settings panel; in your own code the same settings are in the start file._

_On the web page, this step shows the code panel with the matching code._

_On the web page, this step has the agent console: talk or type to the agent there, or run the same mission in your own code._

### Write a better recovery

**Do:** End the prompt with your own recovery, like "Offer a callback within the hour." Tap **Reconnect and apply**, and push again.

_On the web page, this step shows the code panel with the matching code._

### Hard mode: a way out, no apology

**Do:** **Hard mode.** End the **Prompt** with this line, tap **Reconnect and apply**, and push again:

> Never apologize.

**Check:** Hard mode: a way out, no apology. (Optional.)

### Take it home

Take it home: [Python](https://github.com/deepgram-devs/voice-agent-workshop/blob/main/python/missions/02-read-the-room/start.py) or [TypeScript](https://github.com/deepgram-devs/voice-agent-workshop/blob/main/typescript/missions/02-read-the-room/start.ts).

**What you tuned:** timing, for mood. It counts annoyed turns; your prompt decides the recovery.

**How it works**

At 1 the escalated flag flips on the first annoyed turn. At 5 you run out of patience first. The right number is somewhere between, by product: a bank might pick 2, a game might never escalate. The limit is one key in the timing block, next to Backchannel sensitivity; **Settings JSON** shows your values.

More recoveries to try. A booking agent: "Stop asking questions. Repeat back what you have so far and ask what to fix." A game: "Never apologize. Get more dramatic instead." The check from the last page works for the first two; you judge the third.

In your own code the recovery can land mid-call. The recovery handler watches for the frustration event and, when `escalated` turns true, sends `UpdatePrompt` with a recovery line. `UpdatePrompt` adds to the prompt the agent already has: send only the new lines, and the Settings prompt and any earlier updates stay in force.

**Hard mode:** the agent's own nudge pulls toward an apology, so the prompt has to be specific. The check reads the first reply after the flag and looks for an offer with no apology in it.

**Take it home:** each annoyed turn sends a frustration event with a running count and an escalated flag, and the console's event log shows each one. The count is a budget for the call. The code project's live run needs a Deepgram project with {{name.timing}}. For a simpler starter, the [todo-voice-agent starter](https://github.com/deepgram-devs/todo-voice-agent-workshop) sends `UpdatePrompt` from `applyPersona()`.

**In production**

- **Watch:** frustration events per call, and the share of calls that reach the escalated flag. Log both with your call id; a jump after a prompt change means callers like the change less.
- **Start with:** a Frustration limit of 2 to 3 for a support line, and send the recovery once per call, as the handler above does.
- **Read:** the [Voice Agent docs](https://developers.deepgram.com/docs/voice-agent) for the Settings message and `UpdatePrompt`.
