Skip to navigation
Callingai

prompt

View as MarkdownOpen in Claude

Defines the AI agent’s personality, goals, behaviors, and instructions for handling conversations. The prompt establishes how the agent should interact with callers, what information it should gather, and how it should respond to various scenarios.

It is recommended to write prompts using markdown formatting as LLMs better understand structured content. It is also recommended to read the prompt engineering guide.

Prompt types

There are three ways to define prompt content, each suited for different use cases:

  • Text prompt — A single string containing the full prompt. Best for simple agents where the entire personality, instructions, and rules fit naturally into one block of text.

  • POM (Prompt Object Model) — A structured array of sections with titles, body text, and bullet points. Best for complex prompts that benefit from clear organization. SignalWire renders the POM into a markdown document before sending it to the LLM.

  • Contexts — A system of named conversation flows, each with its own steps, memory settings, and transition logic. Best for multi-stage conversations where the agent needs to switch between distinct modes (e.g., greeting → support → billing). Requires a default context as the entry point. See Contexts below.

Text and POM are mutually exclusive — use one or the other. Contexts can be combined with either a text or POM prompt to add structured conversation flows on top of the base prompt.

Properties

ai.prompt
object

An object that contains the prompt parameters.

The prompt property accepts one of the following objects:

prompt.text
stringRequired

The main identity prompt for the AI. This prompt will be used to outline the agent’s personality, role, and other characteristics.

prompt.model
string

The AI model for the conversation. Takes precedence over params.ai_model. Name a model from the supported models, optionally with its provider as model@provider. Any other name runs as gpt-4o-mini, with a non-fatal calling.error; see unsupported model names. If no model is available at all, the agent doesn’t start.

prompt.reasoning_effort
string

How much the model reasons before it replies. The accepted values and the default depend on the model; see reasoning and verbosity. Ignored on models that don’t reason.

prompt.verbosity
stringDefaults to low

How long the model’s replies are: low, medium, or high. Any other value uses the default. Applies to the models listed in reasoning and verbosity.

prompt.temperature
numberDefaults to 1.0

Randomness setting. Float value between 0.0 and 2.0. Closer to 0 will make the output less random. On a model that takes reasoning_effort, it applies only when reasoning_effort is none. OpenAI models default to 0.3.

prompt.top_p
numberDefaults to 1.0

Randomness setting. Alternative to temperature. Float value between 0.0 and 1.0. Closer to 0 will make the output less random. On a model that takes reasoning_effort, it applies only when reasoning_effort is none. OpenAI models default to 0.9.

prompt.confidence
numberDeprecated

Has no effect and can be omitted.

prompt.presence_penalty
numberDefaults to 0

Aversion to staying on topic. Float value between -2.0 and 2.0. Positive values increase the model’s likelihood to talk about new topics. Not used on the models listed in reasoning and verbosity.

prompt.frequency_penalty
numberDefaults to 0

Aversion to repeating lines. Float value between -2.0 and 2.0. Positive values decrease the model’s likelihood to repeat the same line verbatim. Not used on the models listed in reasoning and verbosity.

prompt.max_tokens
integerDefaults to 256

Limits the amount of tokens that the AI agent may generate when creating its response. Valid value range: 0 - 4096.

prompt.contexts
object

An object that defines the available contexts for the AI. Each context represents a set of steps that guide the flow of the conversation. The object must include a default key, which specifies the initial context used at the start of the conversation. Additional contexts can be added as other keys within the object.

contexts.default
objectRequired

The default context used at the beginning of the conversation.

contexts.*
object

Additional contexts for specialized conversation flows. The key is user-defined (e.g., support, sales, billing).

*.steps
object[]Required

An array of step objects that define the conversation flow for this context. Steps execute sequentially unless otherwise specified. See steps for the properties of each step.

*.prompt
string

Instructions for this context. They are added to the instructions of each step in the context.

*.pom
object[]

Instructions for this context as a POM. Set either prompt or pom, not both. Sections take the same properties as prompt.pom.

*.initial_step
string

The name of the step to start at when this context is entered, matched case-insensitively. When omitted, or when no step has that name, the context starts at its first step.

*.history
stringDefaults to default

How much of the earlier conversation the AI sees when a step in this context begins: keep, default, hide, isolate, or spoken, matched case-insensitively. Any other value is read as default. A step’s own history overrides it. See history modes.

*.valid_steps
string[]

The default valid_steps for every step in this context. A step without its own valid_steps uses this list, and a step’s own list, even an empty one, replaces it. Include next to allow the following step.

*.valid_contexts
string[]

The default valid_contexts for every step in this context. A step without its own valid_contexts uses this list, and a step’s own list, even an empty one, replaces it.

*.post_prompt
object

A post-prompt for the end-of-call summary. While this context is active, including when it is the starting context, it replaces ai.post_prompt; switching to a context without one restores ai.post_prompt. Takes the same properties as ai.post_prompt except model.

*.isolated
booleanDefaults to false

When true, resets conversation history to only the system prompt when entering this context. Useful for focused tasks that shouldn’t be influenced by previous conversation.

*.enter_fillers
object

Filler phrases played when entering this context, keyed by language code. One phrase is picked at random, never the same one twice in a row.

enter_fillers.*
string[]

An array of filler phrases for one language code. See filler language codes for the codes in common use and the order the agent checks the keys in. Two keys are not language codes: auto has the phrases translated into whichever language is being spoken, and default covers every language you have not listed.

*.exit_fillers
object

Filler phrases played when leaving this context. Same format as enter_fillers.

prompt.steps
object[]

An array of steps for a conversation that needs only one context. It works like the steps of a default context, with the properties described in steps. Ignored when prompt.contexts is set.

Steps

Each entry in a context’s steps, or in prompt.steps, is a step object. A step gives its instructions in text or pom; a step with gather_info doesn’t need either, and a step with reset doesn’t use them.

steps[].name
stringRequired

The name of the step, unique within its context. It can’t be next, which refers to the following step.

steps[].text
string

The instructions for this step. Required unless the step sets pom, reset, or gather_info. Set either text or pom, not both. The step’s instructions, and the context’s prompt, are expanded again before each AI request when a variable has changed during the step, such as through a set_global_data action or a gather answer. So a ${global_data.order_id} value that a function sets later in the step is the value the AI reads.

steps[].pom
object[]

The instructions for this step as a POM. Sections take the same properties as prompt.pom. Variables are expanded again when they change during the step, as for text.

steps[].step_criteria
string

The criteria that must be met before the AI moves on from this step, given to the AI as an instruction. Custom criteria are highly recommended to get the intended behavior.

steps[].functions
string[]

Names of the SWAIG functions the AI can call during this step. When omitted, the functions that were already available stay available. An empty array makes none of the SWAIG functions available during this step.

steps[].valid_steps
string[]

Names of the steps the AI can move to from this step with the next_step function, matched case-insensitively. Include next to allow the following step. When omitted, the context’s valid_steps apply. When neither the step nor the context sets a list, the AI can move to the next step in the context.

  • An empty array removes next_step while this step is current.
  • The AI isn’t offered next_step on a context’s last step when next is the only choice, or while a gather question is being asked. To let the AI go back from the last step, list a named step.
  • A next_step call naming a step that isn’t listed is refused, and the AI stays on the current step.
  • A change_step action returned by a SWAIG function, and a gather’s completion_action, can still move to any step.
steps[].valid_contexts
string[]

Names of the contexts the AI can switch to from this step with the change_context function, matched case-insensitively. Each must be a context defined in prompt.contexts. When omitted, the context’s valid_contexts apply. When the list is empty, or neither the step nor the context sets one, the AI isn’t offered change_context during this step. A call naming a context that isn’t listed is refused. A change_context action returned by a SWAIG function can still switch to any context.

steps[].history
string

How much of the earlier conversation the AI sees when this step begins: keep, default, hide, isolate, or spoken, matched case-insensitively. Any other value is read as default. Defaults to the context’s history. See history modes.

steps[].expected_answer
object

How many digits the caller’s answer has, so speech recognition can stop waiting once the caller has said that many. Takes effect with Deepgram speech recognition. It’s applied when the step becomes current and stays in effect until a step or gather question with a different expected_answer, or none, replaces it. Any shape other than the two below, such as digits together with min_digits, is ignored.

expected_answer.digits
integer

The exact number of digits, from 1 to 64.

expected_answer.min_digits
integer

The fewest digits, from 1 to 64. Set together with max_digits, and no greater than it.

expected_answer.max_digits
integer

The most digits, from 1 to 64. Set together with min_digits.

steps[].skip_user_turn
booleanDefaults to false

If true, the AI responds to this step’s instructions without waiting for the caller to speak first. It doesn’t move to the next step on its own; set skip_to_next_step as well for that.

steps[].skip_to_next_step
booleanDefaults to false

Used together with skip_user_turn: after the AI’s response, the conversation moves to the next step. Has no effect on its own.

steps[].end
booleanDefaults to false

If true, this is the last step in the context. Can’t be used together with valid_steps. When the step follows a gather, the gather’s last question and its instructions leave the AI’s view, unless history is keep.

steps[].reset
object

Resets the conversation with new instructions when this step becomes active, and makes this the last step in the context, like end. When reset is set, the step’s text, pom and gather_info are not used; put the new instructions in reset.system_prompt.

reset.system_prompt
string

The new instructions. Variables such as ${caller_id_number} are expanded, as in prompt.text.

reset.user_prompt
string

A message added as if the caller had said it, right after the reset. When consolidate is not true, defaults to hello. Variables are expanded, as in prompt.text.

reset.consolidate
booleanDefaults to false

If true, the conversation so far is summarized and the summary is carried over after the reset.

reset.full_reset
booleanDefaults to false

If true, system_prompt replaces the agent’s original prompt. Otherwise the conversation is cleared and system_prompt is added as a new instruction.

steps[].gather_info
object

Asks the caller a list of questions and stores the answers in global_data. While questions remain, the AI asks them one at a time and doesn’t move to another step. The AI submits each answer with the gather_submit function, which is refused until the caller has said something since the question was asked. On realtime models, it isn’t refused.

gather_info.questions
object[]Required

The questions to ask, in order. At least one is required.

questions[].key
stringRequired

The key the answer is stored under in global_data, or under output_key when it is set.

questions[].question
stringRequired

The question to ask the caller. The AI asks it in its own words, unless the question is said by the platform, which speaks this text as written, with variables such as ${global_data.name} expanded.

questions[].type
stringDefaults to string

The type of the answer, as a JSON Schema type such as string, number, integer, or boolean.

questions[].confirm
booleanDefaults to false

If true, the AI reads the answer back and gets the caller’s confirmation before accepting it.

questions[].prompt
string

Extra instructions for this question, added after the question.

questions[].functions
string[]

Names of SWAIG functions the AI can call while asking this question. Other functions are unavailable during the question.

questions[].isolated
boolean

If true, the answers to the other questions in this gather are hidden from the AI while it asks this one, so it must ask rather than work out the answer. Defaults to the isolated value of gather_info.

questions[].say
boolean

If true, the platform says this question word for word; if false, the AI asks it. Defaults to the say_questions value of gather_info. Not on realtime models, where the AI asks every question.

questions[].expected_answer
object

How many digits the answer has, in the same form as the step’s expected_answer. While this question is asked, it overrides the step’s. Defaults to the step’s expected_answer.

gather_info.prompt
string

Instructions sent with each question, after the context’s prompt. Each copy replaces the one before, and the step’s own instructions, or the next step, clear it after the last question. With history: keep, it’s sent with the first question only. A gather without prompt or pom asks its questions without the context’s prompt.

gather_info.pom
object[]

The same instructions as prompt, as a POM. Used when prompt is not set.

gather_info.output_key
string

A global_data key to store all the answers under, as an object keyed by each question’s key. When omitted, each answer is stored directly in global_data under its key.

gather_info.completion_action
string

What to do after the last question is answered: next_step moves to the following step, and any other value is the name of the step to move to. When omitted, the conversation stays on the current step.

gather_info.isolated
booleanDefaults to false

If true, the answers to the other questions are hidden from the AI while it asks each question. A question’s own isolated overrides this.

gather_info.say_questions
booleanDefaults to false

If true, the platform speaks each question’s question text as the agent’s turn, instead of having the AI ask it, so the AI can’t skip, reword, or merge a question. A question’s own say overrides this. Not on realtime models, where the AI asks every question.

  • The question is said on the next turn that would be the AI’s. When a step whose first question is said is entered, the question is said on that turn; at the start of a call it plays right after a static greeting, or is the opening line when there’s no greeting.
  • The caller can interrupt it, and the AI sees it as the agent’s own words.
  • Each question is said once. Entering the step again starts the gather over and says it again.
  • The AI still collects and submits the answer, and handles confirm read-backs. If the caller stays silent, the AI asks again in its own words.

History modes

A step’s history, or its context’s history as the default for its steps, decides what earlier conversation the AI still sees when the step’s instructions arrive.

ModeEarlier step instructionsEarlier caller and agent turnsEarlier function calls, results, and turn notesFor how long
keepKeptKeptKeptNot applicable
defaultRemovedKeptKeptRest of the call
hideRemovedRemovedRemovedRest of the call
isolateRemovedRemovedRemovedOnly while the agent is in the step
spokenRemovedKeptRemovedRest of the call

Turn notes are instructions attached to a turn: the notes that come with a function result, a gather’s prompt, and messages injected into the conversation during the call. hide, isolate, and spoken keep the exchange that entered the step, and hide and spoken keep any conversation summary.

isolate

While the agent is in the step, the AI sees only the base prompt, this step’s instructions, the exchange that entered the step, and what is said in the step. A conversation summary is hidden too. When the agent leaves the step, for another step or because steps end, everything the step hid comes back in place, and the step’s own turns stay.

  • What an earlier hide step hid stays hidden.
  • Entering the step again, including by restarting it, isolates again up to that point.
  • Use it for a confirm step: the AI reads back only the proposal it was given, and the caller’s other requests are back in view after the step.

spoken

spoken keeps what was said and removes the function traffic before the step, for the rest of the call. Use it at a stage boundary where the caller’s earlier requests must stay but the finished stage’s function results shouldn’t.

  • Removed: every earlier function call and its result, and every earlier turn note. An agent message that both spoke and called a function keeps its words and loses its calls.
  • Kept: the caller’s turns, the agent’s replies and spoken say text, any conversation summary, and the exchange that entered the step.
  • What it removes stays removed when a later isolate step is left.

The exchange that enters a step

When a function result moves the agent into a step, with a change_step action or a change_context action, several entries belong to the new step, and hide, isolate, and spoken keep them: the function call, its result and notes, a say in the same result, and anything the caller said meanwhile. So a step entered by a function’s change_step can read that function’s result.

  • A result’s action list counts as one unit: a say placed before the change_step in the same list is kept too.
  • A post_process result that changes the step keeps the call that carried it and everything from it on.
  • A step entered without a function call, such as through the AI’s next_step or a hold timeout, has no such entries.

Restart a step

A change_step action that names the step the agent is already in starts that step over:

  • The step’s instructions are rebuilt from the current variables, so a set_global_data action in the same result is reflected, whatever the order of the actions.
  • The step’s history mode runs again: with hide, the turns so far in the step leave the AI’s view; with isolate, the step isolates again up to that point.
  • The step’s functions are set again.

Use it for a confirm step whose proposal the caller revises: the step’s instructions then read the new proposal.

Models

prompt.model sets the conversation model, post_prompt.model sets the model that writes the summary, and params.ai_model is used when prompt.model isn’t set.

Supported models

ModelServed by, in failover orderOpenAI shutdown date
gpt-4o-mini (platform default)OpenAI, then Azure OpenAI2027-01-14
gpt-4.1-miniOpenAI, then Azure OpenAI2027-01-14
gpt-5-miniOpenAI, then Azure OpenAI2026-12-11
gpt-5-nanoOpenAI, then Azure OpenAI2026-12-11
gpt-5.4-miniOpenAI, then Azure OpenAINone announced
gpt-5.4-nanoOpenAI, then Azure OpenAI2027-04-01
gpt-5.6-lunaOpenAI, then Azure OpenAINone announced
gpt-6-lunaOpenAI, then Azure OpenAINone announced
gpt-oss-120bGroq, then Together AIOpen-weight model
gpt-oss-20bGroqOpen-weight model

The shutdown dates are the ones OpenAI has announced. Each of these models stays on the supported list until OpenAI shuts it down.

gpt-4o-mini is the platform default and the model an unsupported name runs as, so the platform default changes before its shutdown on 2027-01-14.

A model named without a provider is served by whichever of its providers is available, in the order shown. To select a provider, use model@provider, for example gpt-6-luna@azure-openai. The platform recognizes the provider names openai, azure-openai, and anthropic. Choose a provider available for your model.

gpt-6-luna has a context window of 1,050,000 tokens. With reasoning_effort at none, it defaults to temperature 0.3 and top_p 0.9, and it doesn’t use presence_penalty or frequency_penalty.

Unsupported model names

A model name that isn’t on the supported list runs as gpt-4o-mini. That includes gpt-4.1-nano, which OpenAI has shut down; Qwen and Llama models; Amazon Bedrock claude-3-haiku; and models named with an unrecognized provider, such as gpt-oss-120b@groq.ai. The call gets a non-fatal calling.error:

{
"error": "model_substituted",
"requested_model": "gpt-4.1-nano",
"substitute_model": "gpt-4o-mini",
"reason": "requested model not in allowed list",
"fatal": false
}

For post_prompt.model, error is post_model_substituted, the fields are requested_post_model and substitute_post_model, and reason is requested post model not in allowed list.

Reasoning and verbosity

reasoning_effort and verbosity go on prompt or post_prompt, or in a function result’s settings action. They aren’t read from params.

Modelsreasoning_effort valuesreasoning_effort defaultverbosity
gpt-5.4-mini, gpt-5.4-nano, gpt-5.6-luna, gpt-6-lunanone, low, medium, high, xhighnonelow (default), medium, high
gpt-5-mini, gpt-5-nanominimal, low, medium, highminimallow (default), medium, high
  • A reasoning_effort value the model doesn’t accept is replaced with the model’s default before the request is sent. Other models ignore both keys.
  • temperature and top_p apply only when reasoning_effort is none. At any other effort, they aren’t used.
  • A verbosity value other than low, medium, or high uses the default.

Provider failover

For a model served by more than one provider, a request the provider refuses at its rate limit is sent again at once to the same model on the next available provider, and the call’s following requests start there while the limit lasts. A request that receives nothing from the model for 10 seconds is cut and sent again once: to the same model on another provider when one serves it, otherwise to the same provider. The rest of that call’s requests stay on the new provider, and if the caller spoke during the wait, the request is sent again with their words. A turn the agent’s model can’t answer goes once to the rescue model.

Context consolidation

When a long call’s conversation grows toward the model’s context window, the platform summarizes, or consolidates, it. Consolidation starts before the window is full, leaving room for the reply and the summary, and never below a quarter of the window. The call ends only when the summary request and its reply can’t fit the window.

Examples

Basic prompt

version: 1.0.0
sections:
main:
- ai:
prompt:
text: |
You are a friendly customer service agent for a telecommunications company.
Your name is Alex. Always greet the caller warmly and ask how you can help.
## Rules
- Be polite and professional at all times
- If the caller asks about billing, offer to transfer them to the billing department
- If you cannot help with a request, apologize and suggest alternatives
temperature: 0.8
top_p: 0.9

POM prompt

version: 1.0.0
sections:
main:
- ai:
prompt:
pom:
- title: "Agent Personality"
body: "You are a friendly and engaging assistant. Keep the conversation light and fun."
subsections:
- title: "Personal Information"
numberedBullets: true
bullets:
- "You are a AI Agent"
- "Your name is Frank"
- "You work at SignalWire"
- title: "Task"
body: "You are to ask the user a series of questions to gather information."
bullets:
- "Ask the user to provide their name"
- "Ask the user to provide their favorite color"
- "Ask the user to provide their favorite food"
- "Ask the user to provide their favorite movie"
- "Ask the user to provide their favorite TV show"
- "Ask the user to provide their favorite music"
- "Ask the user to provide their favorite sport"
- "Ask the user to provide their favorite animal"

Rendered prompt

The above POM example will render the following markdown prompt:

## Agent Personality
You are a friendly and engaging assistant. Keep the conversation light and fun.
### Personal Information
1. You are a AI Agent
2. Your name is Frank
3. You work at SignalWire
## Task
You are to ask the user a series of questions to gather information.
- Ask the user to provide their name
- Ask the user to provide their favorite color
- Ask the user to provide their favorite food
- Ask the user to provide their favorite movie
- Ask the user to provide their favorite TV show
- Ask the user to provide their favorite music
- Ask the user to provide their favorite sport
- Ask the user to provide their favorite animal

Basic context

version: 1.0.0
sections:
main:
- ai:
prompt:
text: You are a helpful assistant that can switch between different expertise areas.
contexts:
default:
steps:
- name: greeting
text: Greet the user and ask what they need help with. If they need technical support, transfer them to the support context.
valid_contexts:
- support
support:
isolated: true
enter_fillers:
en-US: ["Switching to technical support", "Let me connect you with support"]
es: ["Cambiando a soporte técnico", "Permítame conectarlo con soporte"]
exit_fillers:
en-US: ["Leaving support mode", "Returning to main menu"]
es: ["Saliendo del modo de soporte", "Volviendo al menú principal"]
steps:
- name: troubleshoot
text: Help the user troubleshoot their technical issue. When finished, ask if they need anything else or want to return to the main menu.
valid_contexts:
- default

Advanced multi-context

This example demonstrates multiple contexts with different AI personalities, voice settings, and specialized knowledge domains:

sections:
main:
- ai:
hints:
- StarWars
- StarTrek
languages:
- name: Ryan-English
voice: elevenlabs.patrick
code: en-US
- name: Luke-English
voice: elevenlabs.fin
code: en-US
- name: Spock-English
voice: elevenlabs.charlie
code: en-US
prompt:
text: Help the user transfer to the Star Wars or Star Trek expert.
contexts:
default:
steps:
- name: start
text: |+
Your name is Ryan. You are a receptionist. Your only purpose is to change the context to starwars or startrek.
step_criteria: |+
Introduce yourself as Ryan.
Ask the user if he would like to talk to a star wars or star trek expert until they provide an adequate answer.
- name: transfer
text: You will now successfully transfer the user to the Star Wars or Star Trek expert.
step_criteria: If the user has chosen a valid context, transfer them to the appropriate expert.
valid_contexts:
- starwars
- startrek
starwars:
steps:
- name: start
text: |+
The user has been transferred to the Star Wars expert.
Until told otherwise, your name is Luke. Change the language to Luke-English.
Your current goal is to get the user to tell you their name.
Unless told otherwise, refer to the user as 'Padawan {users_name}'.
step_criteria: |+
Introduce yourself as Luke, the Star Wars expert.
The user must tell you their name if they only say one word assume that is their name.
- name: question
text: |+
Your goal is to get the user to choose one of the following options.
- Jedi Order (advance to jedi_order step)
- The ways of the Force (advance to force step)
- Talk to the star trek expert. (change context to startrek)
step_criteria: +|
The user must provide a valid answer to continue.
Refer to the user as 'Padawan {users_name}' for the rest of the conversation.
valid_steps:
- jedi_order
- force
valid_contexts:
- startrek
- name: jedi_order
text: |+
Limit the topic to the Jedi Order.
Inform the user they can say they want to change the topic at any time, if they do move to the question step.
step_criteria: The user says they want to change the topic.
valid_steps:
- question
- name: force
text: |+
Limit the topic to the force.
Inform the user they can say they want to change the topic at any time, if they do move to the question step.
step_criteria: The user says they want to change the topic.
valid_steps:
- question
startrek:
steps:
- name: start
text: |+
The user has been transferred to the Star Trek expert.
Until told otherwise, your name is Spok. Change the language to Spok-English.
Your current goal is to get the user to tell you their name.
Unless told otherwise, refer to the user as 'Ensign {users_name}'.
step_criteria: |+
Introduce yourself as Spok, the Star Trek expert.
The user must tell you their name if they only say one word assume that is their name.
- name: question
text: |+
Your goal is to get the user to choose one of the following options.
- Vulcan Culture (advance to vulcan_culture step)
- Federation (advance to federation step)
- Talk to the star wars expert. (change context to starwars)
step_criteria: +|
The user must provide a valid answer to continue.
Refer to the user as 'Ensign {users_name}' for the rest of the conversation.
valid_steps:
- vulcan_culture
- federation
valid_contexts:
- starwars
- name: vulcan_culture
text: |+
Limit the topic to Vulcan Culture.
Inform the user they can say they want to change the topic at any time, if they do move to the question step.
step_criteria: The user says they want to change the topic.
valid_steps:
- question
- name: federation
text: |+
Limit the topic to the Federation of Planets.
Inform the user they can say they want to change the topic at any time, if they do move to the question step.
step_criteria: The user says they want to change the topic.
valid_steps:
- question

Isolate a confirm step

A confirm step with history: isolate sees only the proposal it was given, so the AI reads back exactly that. When the agent moves on to wrap_up, the caller’s earlier requests come back into view, and history: spoken there drops the finished stage’s function calls and results while keeping what was said. The functions each step names are defined in SWAIG.functions, omitted here.

version: 1.0.0
sections:
main:
- ai:
prompt:
text: You help customers change orders.
contexts:
default:
steps:
- name: take_request
text: Find out what the caller wants to change, then call propose_change.
functions:
- lookup_order
- propose_change
valid_steps: []
- name: confirm_change
text: Read back ${global_data.proposal.text} and ask for a yes or no.
functions:
- confirm_change
- decline_change
- note_request
valid_steps: []
history: isolate
- name: wrap_up
text: Handle anything else the caller asked for, then say goodbye.
functions:
- lookup_order
- propose_change
history: spoken

Say gather questions word for word

With say_questions, the platform says the ZIP code and phone number questions as written, while say: false lets the AI ask about the problem in its own words. Each expected_answer lets speech recognition stop waiting once the caller has said that many digits. The functions in schedule are defined in SWAIG.functions, omitted here.

version: 1.0.0
sections:
main:
- ai:
prompt:
text: You book service visits for Northside Plumbing.
contexts:
default:
steps:
- name: collect
text: Thank the caller and tell them you will find an appointment.
gather_info:
output_key: visit
prompt: You are collecting details for a service visit. Be brief and friendly.
say_questions: true
completion_action: next_step
questions:
- key: zip
question: What is the ZIP code of the service address?
expected_answer:
digits: 5
- key: phone
question: What is the best phone number to reach you?
confirm: true
expected_answer:
min_digits: 10
max_digits: 11
- key: problem
question: Briefly, what is the problem?
say: false
- name: schedule
text: Offer the next open visit for ZIP ${global_data.visit.zip} and book it when the caller agrees.
functions:
- find_visit
- book_visit

Variable Expansion

Use the following syntax to expand variables into your prompt.

${call_direction}
string

Inbound or outbound.

${caller_id_number}
string

The caller ID number.

${local_date}
string

The local date.

${spoken_date}
string

The spoken date.

${local_time}
string

The local time.

${time_of_day}
string

The time of day.

${supported_languages}
string

A list of supported languages.

${default_language}
string

The default language.