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

# Prompting basics

> How Dialog-RSN-1 uses your `instructions`: the default spoken style, choosing the reply language, changing guidance mid-call, and fitting your setup in the context window.

The `instructions` parameter is the system prompt. Dialog-RSN-1 gets it word for word, alongside your tools, your knowledge topics and the conversation so far, and it controls both what the model says and how it takes turns. A `response.create` can add instructions for a single reply, and a platform content policy applies whatever your instructions say.

Dialog-RSN-1 is built for fast voice conversations. It follows your instructions, calls your tools and answers from your knowledge base while the caller is on the line, and it decides on each turn whether to reason before it answers.

## Start with your business logic

Dialog-RSN-1's default style is already written for speech on a phone line: plain spoken sentences with no markdown, headings or lists. So an opening line like "you are a voice assistant talking to a caller on the phone" adds nothing. Spend your `instructions` on what your agent does, who it's for, and what it must and mustn't do.

```text instructions: start with what the agent does theme={"theme":{"light":"github-light","dark":"github-dark"}}
You answer the phone for Harbor Dental. You can book, move and cancel
check-ups and hygienist appointments. For anything clinical, such as pain
or a broken tooth, offer the next emergency slot and don't give advice.
```

To change the default style, for example for a persona of your own, see [Response style](https://docs.poly.ai/dialog-rsn-1/prompting/response-style.md).

## Choosing the reply language

Dialog-RSN-1 can reply in many languages. To choose one, set [`poly_response_language`](https://docs.poly.ai/api-reference/dialog-rsn-1/reference#polyai-extensions) on the session to an ISO 639 tag such as `es` or `pt-BR`, or say so in your instructions. If your instructions name a language, or say when to switch, they take precedence.

```text instructions: follow the caller's language theme={"theme":{"light":"github-light","dark":"github-dark"}}
Reply in the language the caller speaks. If they switch language mid-call,
switch with them.
```

## Changing guidance mid-call

Keep one `instructions` for the whole call. When the call reaches a process that needs its own guidance, such as a return, add that guidance as a `system` message in the history with `conversation.item.create`, and swap in the process's tools with `session.update`. Delete the message with `conversation.item.delete` when the process ends.

Changing `instructions` itself mid-call makes the next reply slower, because Dialog-RSN-1 then has to process the whole conversation again. The bike shop in the [realtime agents example](https://github.com/polyai/dialog-rsn-1-realtime-agents) runs a return this way.

## Fitting the context window

Keep your `instructions` and `tools` under about 20,000 tokens together, so the conversation has room to grow. The [context window](https://docs.poly.ai/api-reference/dialog-rsn-1/limits.md) is 32,768 tokens, audio included. Every reply's prompt holds your `instructions`, every tool definition, and the conversation so far.

Only the conversation gets smaller as a call goes on. From the tenth caller turn, older turns give up their audio and keep their transcript. Your `instructions` and `tools` go into every prompt in full, on every turn, so a setup of 28,000 tokens leaves about 4,000 for the call itself, which a few turns use up.

When a prompt outgrows the window, that response fails with `context_length_exceeded`: an `error` event, then a `response.done` with `status: "failed"`. The connection stays open. A `session.update` with oversized `instructions` is accepted without complaint, so the first sign is the first reply failing.

### Measuring your setup

Read `response.usage.input_tokens` off the first reply. Send your `session.update`, one short user message and a `response.create`, then check the number on `response.done`. That count is the fixed cost every later turn starts from.

For a rough estimate before you send anything, count about four characters of English per token, and about 100 tokens for a tool with a one-line description and two parameters. Some measured first replies:

| Setup | `input_tokens` |
| - | - |
| 270 characters of instructions, no tools | 392 |
| The same instructions, 20 tools | 2,477 |
| 13,550 characters of instructions, no tools | 3,136 |
| 108,400 characters of instructions, no tools | 22,736 |

### Making room

* **Cut what the model doesn't need on every turn.** Long policy text, FAQs and product lists cost their full size on every reply.
* **Move reference material behind a search tool.** Return the passages as [`poly_knowledge`](https://docs.poly.ai/dialog-rsn-1/tools-and-knowledge#searching-and-getting-citations-back) on the tool result, so only what the caller asks about enters the prompt.
* **Declare fewer tools.** Merge tools that take the same arguments, and drop the ones this agent never calls.
* **Give a long process its own step.** Add its guidance and tools only while the call is in it, as in [Changing guidance mid-call](#changing-guidance-mid-call).

## Next steps

> [card] [Turn-taking](https://docs.poly.ai/dialog-rsn-1/prompting/turn-taking.md)
>
> Describe your callers to set how patient Dialog-RSN-1 is.

> [card] [Speech understanding](https://docs.poly.ai/dialog-rsn-1/prompting/speech-understanding.md)
>
> Put the names your callers say in your prompt, and Dialog-RSN-1 hears them.

> [card] [Tools and knowledge](https://docs.poly.ai/dialog-rsn-1/tools-and-knowledge.md)
>
> The tool loop, speech while a tool runs, and search results with citations.

> [card] [Reference](https://docs.poly.ai/api-reference/dialog-rsn-1/reference.md)
>
> Every session field, event and error code.
