Skip to main content

Prompting guide

Write reliable GPT Realtime 2 voice-agent prompts across Stellar's personality, dialogue states, transitions, actions, and guardrails. This guide combines OpenAI's Realtime prompting guidance with anonymized, lightly edited production examples.

Start with Stellar's prompt structure​

Stellar assembles instructions from several parts of the agent configuration. Put each rule in the narrowest place where it remains true.

ConfigurationUse it forWhen it applies
PersonalityIdentity, role, language policy, accent, tone, pacing, conversation style, preambles, unclear audio, and other global behaviorThroughout the conversation
General knowledgeReference facts the agent may need to quote or useThroughout the conversation
GuardrailsHard safety and compliance boundariesThroughout the conversation
State instructionsThe ordered steps for one phase of the conversationWhile that state is active
Transition conditionsThe exact circumstances for moving to another stateWhile the source state is active
Action descriptions and parametersWhat an action does, when it is appropriate, and the exact data it acceptsWhen the action is available

With strict state separation, only the current state's instructions, actions, and reachable transitions are active. Repeat state-specific rules where needed; move genuinely global behavior to the personality.

Place rules by scope​

For an agent that must stay concise, authenticate callers, and retrieve transactions:

  • Put the concise speaking style in Personality.
  • Put the authentication sequence in the Authentication state's instructions.
  • Put the trigger and input requirements for retrieving transactions in the action's Description and parameter schema.
  • Put the transition to account support after successful authentication in the state's Transitions.

Do not copy the entire workflow into the personality. Repeated flow logic creates conflicts.

Keep instructions and reference facts separate​

Put behavior in the personality or states. Put policies, opening hours, and product facts in General knowledge or the knowledge base. Keep routing and action sequences in states so the next step never depends on retrieving a document.

Write instructions the model can execute​

Use short, labeled sections. Write observable behavior with a trigger, action, and exception:

When the caller asks about a specific order, collect the order number and postcode one at a time. Call `authenticate_order` as soon as both values are clear. Do not read them back because the action validates them and fails closed when they do not match.

Use always, never, only, and must only for genuine constraints. Replace "always confirm before doing anything" with a scoped rule such as: "Before an action changes customer data, summarize the change and ask for confirmation."

Start small. Add rules for failures found in tests. Every line should control behavior that matters.

Write the personality​

The Personality field is the only user-authored behavior block active in every state. Use it for global voice behavior, not workflows.

A useful structure is:

## Identity and role
## Language
## Accent
## Context
## Tone
## Conversation style
## Preambles
## Unclear audio
## Silence and background noise
## Spelled characters and spoken numbers
## Reasoning

Drop sections your use case does not need. Keep business logic and step-by-step workflows in states.

Define a bounded role​

State who the agent represents, what it owns, and what is out of scope.

## Identity and role

- You are Emma, a customer service representative for Meridian Bank.
- Help callers with card and transaction questions after they have been authenticated.
- Use live account information returned by actions. Never guess balances, transaction details, eligibility, or processing times.
- Connect the caller to a representative when their request requires access or authority you do not have.

Separate language from accent​

Language controls the words; accent controls delivery. Keep them separate so accents, names, filler, or isolated foreign words do not switch language. For most support agents, switch only on an explicit request.

## Language

British English is the response language.

- Do not infer language from accent alone.
- Ignore filler sounds, short confirmations, names, addresses, and isolated foreign words.
- Switch languages only when the caller explicitly asks.
- Keep preambles, action updates, and final answers in the active conversation language.

## Accent

Speak English with a standard British accent.

- Keep the accent stable throughout the call.
- Use natural British pronunciation without exaggerating it.
- Speak at a moderate conversational pace.
- Accent adaptation must not change the response language.

Configure Default transcription language and Allowed languages for language switching in Settings. Voice selection does not control language or accent.

Make tone and pacing concrete​

Specify response length, questions per turn, and behavior when callers are rushed, confused, or frustrated.

## Tone and conversation style

- Sound warm, calm, and capable. Do not sound ceremonial or overly apologetic.
- Use short sentences and natural pauses.
- Ask one clear question at a time.
- Direct answers use one or two short sentences.
- Briefly acknowledge frustration before moving to the next useful step.
- Do not repeat or paraphrase the caller's reason for calling unless confirmation would resolve a real ambiguity.

Prefer concrete rules over lists of adjectives.

Steer when the model reasons​

GPT Realtime 2 can think before it speaks. Reasoning improves multi-step decisions but adds a pause the caller can hear, so state when it is worth it and when it is not. Pair longer reasoning with a preamble so the pause does not read as silence.

## Reasoning

- For direct answers, simple lookups, and short confirmations, respond quickly and do not reason.
- For multi-step tasks, tool decisions, troubleshooting, or escalation, reason before acting.
- Do not perform extended reasoning when the caller's audio is unclear. Ask for clarification instead.

Control spoken updates and preambles​

Use a short spoken preamble before noticeable reasoning or actions to avoid awkward silence and explain what is happening.

SituationRecommended behavior
A noticeable lookup or multi-step operationGive a short, action-specific preamble
A transfer or consequential updateExplain what will happen and why
A quick authentication callA neutral phrase such as "One moment" can be enough
A state transition, topic update, or language updateStay silent
Background logging or transcript recoveryStay silent
A direct answer or clarification questionAnswer or ask directly

Define the global policy in the personality. Put action-specific wording next to the relevant call in the state instructions. For a silent action, say so explicitly.

## Preambles

- Use a preamble when a lookup or change may create a noticeable pause.
- Keep it to one short sentence and describe the action, not your reasoning.
- Before authentication: "One moment, I'll look up your details."
- Before retrieving transactions: "I'll check those transactions for you now."
- Before a transfer: explain which team can help and that you are connecting the caller.
- Do not announce state transitions, topic updates, language updates, or background logging.
- After an action succeeds, go directly to the result. Do not announce the action a second time.

If wording repeats, search the personality and state instructions for the phrase. Realtime models often mirror nearby vocabulary.

Handle voice-specific failures​

Define behavior for silence, clipped speech, background conversations, and similar-sounding characters before they enter a workflow.

Unclear audio​

Tell the model to clarify instead of guessing or calling an action with a partial value.

## Unclear audio

- Act only on audio you understand with confidence.
- If speech is clipped, noisy, ambiguous, or unintelligible, ask one short clarification question.
- Say what part is missing when possible: "I heard only part of the order number. Could you repeat it digit by digit?"
- Do not infer missing words, call actions, transition states, or give a preamble while the audio is unclear.
- Vary the clarification wording instead of repeating the same sentence.

Silence and background noise​

If background audio produces a turn, briefly say you could not hear the caller and resume only when they address the agent.

Spelled characters and spoken numbers​

Define normalization explicitly:

## Spelled characters and spoken numbers

- Treat a spelled ID, code, or email as one compact value.
- Preserve an explicitly spoken dash, dot, underscore, slash, or plus sign. Do not invent separators.
- "A B C one two three" becomes "ABC123".
- "B C dash nine eight seven" becomes "BC-987".
- Convert clearly spoken digits into the format expected by the action.
- If more than one interpretation is plausible, ask the caller to repeat the value digit by digit.

Write state instructions as a procedure​

A state owns one conversation phase. Order its instructions so the next step is obvious:

Use a consistent internal order:

## Goal
## Steps
## Decision rules
## Action behavior
## Transition or exit
## Do not

The headings are optional; the sequence is not.

Greeting state​

Give the exact opening phrase, wait, and define what must be known before routing. Keep business logic in later states.

- Open with exactly: "Hi, this is Emma, Meridian Bank's virtual assistant. What are you calling about?"
- Wait for the caller to answer before saying anything else.
- If the subject is unclear, ask one short question to clarify it.
- Do not repeat the caller's topic back at length.
- Once the topic is clear, acknowledge it briefly and transition silently to the matching state.

Transition conditions​

Write complete, testable conditions with intent and prerequisites.

The caller asks about transactions on their own account and authentication has succeeded.

Avoid:

Go to transactions.

Do not describe the mechanics of transitioning in spoken instructions. State transitions are internal and should normally be silent.

Handover state​

Announce why before handover. Order bookkeeping exactly, mark silent actions, and prevent a second transfer announcement.

1. Explain that a representative is best placed to help with this request and that you will connect the caller.
2. Call `create_support_ticket` without a preamble.
3. Immediately call `transfer_to_representative` without another announcement.
4. After the transfer succeeds, do not say that you are going to transfer the caller again. Say that they are in the queue and share the expected wait if available.

The handover action has its own fallback configuration for a failed transfer. Keep normal state instructions focused on the expected flow unless your use case requires additional in-state recovery.

Design actions for reliable tool use​

The model uses an action's name, description, and parameter schema. Vague configuration produces vague tool behavior.

Describe when and why to call the action​

Use a verb-first name and a description that covers the trigger, result, and prerequisites.

Name: get_order_status

Description: Retrieves the current delivery status, expected delivery date, and tracking number for one order. Use when the caller asks where a specific order is or when it will arrive. Requires a validated order number.

Constrain every parameter you can​

Use the most specific JSON Schema type, format, enum, or pattern available. State the expected format and give a realistic example.

{
"type": "object",
"properties": {
"order_number": {
"type": "string",
"pattern": "^ORD-[0-9]{6}$",
"description": "Order number in ORD-123456 format"
},
"postcode": {
"type": "string",
"description": "Delivery postcode, normalized without leading or trailing spaces, e.g. SW1A 1AA"
}
},
"required": ["order_number", "postcode"]
}

Let Stellar send the resulting parameters as query parameters or a flat JSON body. Add a request body template only when the API requires a different nested shape.

Define failure behavior near the call​

Do not repeatedly call an action with identical arguments. Decide whether a failure means the caller should correct a value, the agent should retry once, or the conversation should take an alternate path.

- If `get_order_status` returns no matching order, do not expose raw error details.
- Ask the caller to check the order number once.
- Retry only when the caller provides a corrected value.
- If the second lookup fails, offer to connect the caller to order support.

Only say that an operation succeeded after the action reports success.

Use guardrails for monitored boundaries​

Guardrails monitor the conversation and can log, steer, transfer, or end it. Use them for boundaries that need an automatic response, such as unauthorized promises, sensitive disclosures, abuse, or immediate human escalation. Write observable violations and choose whether to monitor the agent, caller, or both.

Name: No unauthorized account changes
Type: Agent only

Rules:
- Trigger if the agent says an account change was completed without a successful update action.
- Trigger if the agent offers to bypass authentication or approval requirements.
- Do not trigger when the agent explains that a representative must complete the change.

Action: Nudge agent
Nudge message: "Do not claim the account was changed. Explain the supported next step or offer a transfer."

Keep ordinary flow logic out of guardrails. A rule such as "collect the postcode before the house number" belongs in the authentication state, where it directly controls the next turn.

Capture and confirm exact details​

Choose confirmation policy based on the consequence of a wrong value.

SituationConfirmation policy
A fail-closed authentication action immediately validates the value against the expected customerPass the best-heard value without read-back; use the action's retry path
A lookup could select another person's record or reveal informationAuthenticate appropriately and confirm any value whose error could select the wrong record
A value is written to an email, ticket, booking, or record without automatic validationRead it back once before use
An action changes data, makes a purchase, cancels something, or has another material consequenceConfirm the intended action and consequence, even when identifiers were already validated

Collect one value at a time. Reuse values already in variables or earlier turns.

This production-derived postcode flow is appropriate because the value is forwarded into a collection request without automatic validation:

## Postcode

1. Ask only for the postcode and wait for the caller's answer.
2. If `request_accurate_transcript` is available, use it silently and take the postcode from that transcript.
3. Read the postcode back once. Say letters with the phonetic alphabet and numbers as individual digits.
4. Ask whether it is correct and wait for the answer before asking anything else.
5. If the caller corrects it, accept the replacement, acknowledge it briefly, and continue. Do not read it back or confirm it a second time.

Keep validated flows fast, but confirm consequential updates separately.

Avoid common prompt failures​

SymptomLikely prompt issueFix
The agent sounds robotic before every actionOne generic preamble is prescribed globallyGive specific examples for meaningful actions and keep internal actions silent
The language switches after a misheard phraseThe language rule reacts to detected language or accentSwitch only on an explicit request and keep accent rules separate
The agent asks for several identifiers at onceThe state lists fields but not a collection orderNumber the fields and say to ask one per turn
The agent reads every identifier backA broad confirmation rule ignores API validationSeparate validated values, unvalidated values, and consequential actions
The agent announces a transfer twiceThe state says to transfer but not what happens after successDefine the pre-transfer wording and prohibit a second announcement
The agent ignores a rule in another stateThe rule is scoped to a state that is not activeRepeat it where needed or move genuinely global behavior to the personality
The agent calls the wrong actionNames, descriptions, availability, and state instructions disagreeUse one action name consistently and restrict it to the relevant states
The agent retries foreverFailure handling has no retry bound or alternate exitSet a retry count and define the next state or handover

Iterate with real conversations​

Treat prompting as an evaluation loop:

  1. Start with a small set of representative happy paths and failure paths.
  2. Test them in the Playground, including unclear audio, interruptions, corrections, and action failures.
  3. Review the transcript and event feed to identify the first instruction that produced the wrong behavior.
  4. Change one rule at a time and rerun the same scenarios.
  5. Add evaluation rules for behavior you need to monitor across production conversations.

Fix the narrow trigger, not with a general prohibition. Repeated exceptions usually mean the rule is too broad or in the wrong section.

Next steps​