# 02 Read the room

> Deepgram workshops › Build a voice agent › Mission 02
> Web version: https://workshops.deepgram.com/voice-agent/frustrated-callers
> 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/frustrated-callers/notice.md)
- [Change one thing](https://workshops.deepgram.com/voice-agent/frustrated-callers/change-one-thing.md)

## Notice

### Push it past the limit

**Goal:** Annoy the agent until it reaches its frustration limit, then hear it change course.

**You need:** early access to the `timing` feature for live runs. The offline check works without it.

**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._

**You should see:** the meter under the status line fill with each annoyed turn, then the agent change course. If the check misses it, lower the **Frustration limit** and tap **Reconnect and apply**.

**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.

**You should see:** the check marked done. Tap **I did this** only if you heard the agent change tone or offer a way out after your annoyed turns reached the limit.

**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 from how you talk as well as the words: cutting it off, repeating yourself, snapping. 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, and 3 is a good first run.

The default prompt ends with the recovery rule. It reads: "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, because your tone is part of what it hears. The meter fills as it counts. When the first check passes, it says which annoyed turn tripped the flag and how many seconds in. The second check reads what the agent said after the flag and looks for an apology or an offer.

## Change one thing

### Move the limit

**Goal:** Change the frustration limit, write your own recovery line, then make the agent offer a way out without apologizing.

**You need:** the agent from the last lesson, still running or ready to start.

The **Frustration limit** is how many annoyed turns the agent puts up with before it changes course.

**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._

**You should see:** the agent give in after your first complaint at 1, and take longer at 5. If both runs feel the same, tap **Reconnect and apply** after each change and keep complaining until the meter fills.

### Write a better recovery

The recovery is the last line of your prompt. It tells the agent what to do once the limit trips.

**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._

**You should see:** the agent follow your line once the limit trips, for example by offering a callback. If it doesn't, make the line more direct, tap **Reconnect and apply**, and push again.

### 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.

**You should see:** the agent's first reply after the flag offer a way out, with no apology. If it still says sorry, try "Never apologize. Offer a callback.", tap **Reconnect and apply**, and push it past the limit again.

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

### Run the same mission from your own code

Open the starter for your language: [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.

**You should see:** `make check 02` finish with no FAIL lines. If any remain, finish the TODOs and run it again.

**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. When `escalated` turns true, it sends `UpdatePrompt` with a recovery line. `UpdatePrompt` adds to the prompt the agent already has, so send only the new lines. 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. 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`.
