> ## Documentation Index
> Fetch the complete documentation index at: https://docs.poly.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Audio-aware prompting

> Prompts and tools that act on what Dialog-RSN-1 hears beyond the words: a noisy line, a different voice after a security check, the caller's accent, a whispering caller, and hold music on an outbound call.

Dialog-RSN-1 hears the caller's audio itself, so you can prompt it to act on more than the words: background noise, a different voice coming on the line, an accent, a whisper, hold music, or a recording instead of a person. Each of these is a sentence in `instructions`, and for some, a tool.

For a reaction the caller should hear, prompt for the reply directly, with an example of the line you want. For anything your code acts on, have the model report what it hears as tool arguments, and branch on them in your harness. That costs a round trip in the tool loop, so use it when your code needs the state.

## Send raw audio

Stream the call audio as it is. Noise suppression, aggressive gain control and similar pre-cleaning strip the cues Dialog-RSN-1 is trained to use, so they make it perform worse.

## Telling a caller on a noisy line you can hear the noise

Have Dialog-RSN-1 mention the noise once, then say back what it caught. A caller who knows the line is noisy can move somewhere quieter.

```text instructions: flag a noisy line theme={"theme":{"light":"github-light","dark":"github-dark"}}
If there's a lot of background noise on the caller's end, briefly
acknowledge it before helping, for example by saying it's a bit noisy on
their end but you'll do your best. Then say back what they're asking for,
so they know you heard them correctly, and ask for what you need.
```

Example reply: "It's a bit noisy on your end, but I'll do my best. You're calling to check if your prescription is ready to collect, is that right?" On a clean line it answers as normal.

Keep the example phrase. Spoken reactions to audio follow an example much more closely than a description.

## Logging what the model hears about the caller

Start with a tool the model calls to report what it hears. `tag_inbound_audio` below sets `"poly_speech": "none"`, so the model says nothing when it calls it. It gives your code the kind of audio on each turn, the caller's perceived gender and accent, and whether they're whispering. The next three recipes build on it.

```json session.tools: tag_inbound_audio theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "type": "function",
  "name": "tag_inbound_audio",
  "poly_speech": "none",
  "description": "Log what you hear in the caller's audio on this turn: the kind of audio, the caller's perceived gender and accent, and whether they are whispering.",
  "parameters": {
    "type": "object",
    "properties": {
      "content_type": {
        "type": "string",
        "enum": ["speech", "silence", "hold_music", "ambient_noise", "unclear"],
        "description": "The kind of audio on this turn. `speech` = clear speech from the caller. `silence` = silent or near-silent audio. `hold_music` = ringtone, music, or what sounds like the caller's own hold system. `ambient_noise` = background noise only, no speech. `unclear` = something there but you cannot tell whether it is speech or noise."
      },
      "gender": {
        "type": "string",
        "enum": ["male", "female", "unknown"],
        "description": "Perceived gender of the caller based on their voice. Pass `male` or `female` only on clear speech with a confident read. Pass `unknown` on any non-speech audio, on very brief utterances, whispered speech, or when genuinely ambiguous (e.g. a young child). Do NOT guess."
      },
      "accent": {
        "type": "string",
        "description": "The caller's regional accent or dialect, as specific as you can hear it. Pass \"unknown\" on non-speech audio or when speech is too brief or distorted to classify."
      },
      "whispering": {
        "type": "boolean",
        "description": "True if the caller is clearly whispering (breathy, deliberately hushed). False for normal speech, loud speech, soft-spoken callers, or non-speech audio."
      }
    },
    "required": ["content_type", "gender", "accent", "whispering"]
  }
}
```

Add this to your agent's own `instructions`:

```text instructions: tag what you hear theme={"theme":{"light":"github-light","dark":"github-dark"}}
Call tag_inbound_audio as your first action on every user turn, BEFORE any
spoken text or other tool call, UNLESS the values you would log
(content_type, gender, accent, whispering) are identical to your last
tag_inbound_audio call. Then skip and respond directly. Do not ask the
caller about their voice, accent, or surroundings.
```

The "unless identical" clause makes the tool fire when something changes. The model calls it on the first turn, then again only when what it hears is different: a different voice, a whisper starting or stopping, the line going quiet.

Answer each call with a `function_call_output`, then `response.create`, since a tool result ends no turn on its own. The output is where your code tells the model what to do next. When nothing needs to change, return `{"logged": true}` and the model answers the caller as usual. Keep the last values you received, because the recipes below compare against them.

## Re-checking identity when a different voice comes on

Treat a different voice after a security check as an unverified caller. Your code owns whether the caller is verified, so make the decision there. When a `tag_inbound_audio` call arrives with a different `gender` or `accent` from the last one, and the caller has already passed your check, clear that state and say so in the result:

```json function_call_output: a different voice theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "logged": true,
  "verified": false,
  "next_step": "Someone else has come on the line and isn't verified. Don't answer their question and don't repeat anything about the account, even what you've already said. Say you need to check who you're speaking to, and ask for their full name and date of birth."
}
```

Spell out that it mustn't repeat what it already said. The model still has the earlier tool results in context, so say explicitly that it mustn't repeat them to the new voice. Your code should also refuse account tools until the new caller passes your check. If one result shows both a different voice and a whisper, handle the different voice first.

This catches a change the model can hear in those fields: a man taking the phone from a woman, or a different accent. Someone who matches on both, such as a second woman with the same accent, may not trigger a new call. Treat a change as a reason to re-check who's speaking.

## Logging the caller's accent

`accent` is a free-text field, so log it as it comes. Use it as a hint for reporting, or to try routing a caller to a regional team.

Keep the field description neutral. Examples in a description pull the answer toward them: list a few accents there and the model will map nearby accents onto those. The description above names none.

## Offering a text message to a caller who's whispering

A caller who whispers may not be able to talk freely. When `whispering` comes back `true`, don't ask them to speak up, and don't ask why. Use the result to have the model offer a way to carry on that doesn't need their voice:

```json function_call_output: whispering theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "logged": true,
  "next_step": "The caller is whispering and may not be able to talk freely. Don't ask them to speak up or why. Offer to carry on by text message, for example \"I can text you a link to finish this, would that help?\""
}
```

If they say yes, call your own messaging tool. Keep the offer about the task. A line about the caller, like "is it hard to talk right now?" can be heard by whoever else is in the room.

## Staying quiet on hold

On an outbound call, give the model a tool to call while it's on hold. `wait` isn't built in. You declare it like any other tool, with `"poly_speech": "none"` and no arguments. It's worth declaring in any agent that might be put on hold or transferred.

```json session.tools: wait theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "type": "function",
  "name": "wait",
  "poly_speech": "none",
  "description": "Wait silently on the line. Use this when you hear hold music, a \"please hold while we transfer you\" message, a queue announcement, or any other recorded audio that does not need a response. Don't speak or use any other tool, just wait.",
  "parameters": { "type": "object", "properties": {} }
}
```

```text instructions: wait through hold theme={"theme":{"light":"github-light","dark":"github-dark"}}
You're calling Maple Street Pharmacy on behalf of a patient. You don't
work for the pharmacy. The pharmacy may put you on hold. While you hear a
recorded message or hold music, call wait and say nothing. Keep calling
wait until a person picks up, then say you're an assistant calling on the
patient's behalf, and ask your question.
```

Say who the agent is calling for. "You don't work for the pharmacy" keeps the model speaking for the patient when the pharmacy picks up.

Answer `wait` with a `function_call_output`, such as `{"status": "waiting"}`, and don't send `response.create` after it, because the model has nothing to say yet. It stays quiet until the next turn it hears. Hold music on its own usually doesn't open a turn at all, so the model hears the recorded messages, calls `wait` for each, and answers the person who picks up. Keep streaming the line audio the whole time you're on hold. The model can only hear someone pick up in audio you send.

## More ideas to try

* Tell a live person from an IVR or voicemail greeting by how it sounds.
* Notice a child on the line and ask for an adult before any account change.
* Match the text-to-speech voice, or the regional team you route to, to the caller's accent.
* Offer a callback when the caller sounds like they're driving.
* Wait while a caller reads a number off a card, instead of jumping in at a pause.

## Next steps

> [card] [Tools and knowledge](https://docs.poly.ai/dialog-rsn-1/tools-and-knowledge.md)
>
> The tool loop these recipes use, and how `poly_speech` keeps a tool quiet.

> [card] [Turn-taking](https://docs.poly.ai/dialog-rsn-1/prompting/turn-taking.md)
>
> Set how patient Dialog-RSN-1 is, and react to non-speech sounds.
