prompt
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
defaultcontext 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
An object that contains the prompt parameters.
The prompt property accepts one of the following objects:
Regular Prompt
POM Prompts
prompt.text
The main identity prompt for the AI. This prompt will be used to outline the agent’s personality, role, and other characteristics.
prompt.model
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
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
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
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
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
Has no effect and can be omitted.
prompt.presence_penalty
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
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
Limits the amount of tokens that the AI agent may generate when creating its response. Valid value range: 0 - 4096.
prompt.pom
An array of objects that defines the prompt object model (POM) for the AI. The POM is a structured data format for organizing and rendering prompts that are clearly structured and easy to understand. By breaking prompts into sections, users can manage each section independently and then combine them into a single cohesive prompt. SignalWire renders the POM into a markdown document before sending it to the LLM. Set either pom or text, not both.
pom[].title
The title of the section. Will be a heading in the rendered prompt.
pom[].body
The body of the section. This will be a paragraph in the rendered prompt.
Required if bullets is not present. Every section, at any position or depth, needs a body, bullets, or both.
pom[].bullets
An array of strings that represent the bullets of the section.
This will be a list of short statements/rules in the rendered prompt.
Optional if body is present.
pom[].subsections
An array of section objects allowing users to nest sections within sections. Each subsection accepts the same properties as a top-level POM section (title, body, bullets, numbered, numberedBullets).
pom[].numbered
If true, the section will be numbered in the rendered prompt.
pom[].numberedBullets
If true, the bullets will be numbered in the rendered prompt.
prompt.model
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
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
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
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
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
Has no effect and can be omitted.
prompt.presence_penalty
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
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
Limits the amount of tokens that the AI agent may generate when creating its response. Valid value range: 0 - 4096.
prompt.contexts
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
The default context used at the beginning of the conversation.
contexts.*
Additional contexts for specialized conversation flows. The key is user-defined (e.g., support, sales, billing).
*.steps
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
Instructions for this context. They are added to the instructions of each step in the context.
*.pom
Instructions for this context as a POM. Set either prompt or pom, not both. Sections take the same properties as prompt.pom.
*.initial_step
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
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
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
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
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
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
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.*
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
Filler phrases played when leaving this context. Same format as enter_fillers.
prompt.steps
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
The name of the step, unique within its context. It can’t be next, which refers to the following step.
steps[].text
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
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
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
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
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_stepwhile this step is current. - The AI isn’t offered
next_stepon a context’s last step whennextis 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_stepcall naming a step that isn’t listed is refused, and the AI stays on the current step. - A
change_stepaction returned by a SWAIG function, and a gather’scompletion_action, can still move to any step.
steps[].valid_contexts
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
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
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
The exact number of digits, from 1 to 64.
expected_answer.min_digits
The fewest digits, from 1 to 64. Set together with max_digits, and no greater than it.
expected_answer.max_digits
The most digits, from 1 to 64. Set together with min_digits.
steps[].skip_user_turn
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
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
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
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
The new instructions. Variables such as ${caller_id_number} are expanded, as in prompt.text.
reset.user_prompt
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
If true, the conversation so far is summarized and the summary is carried over after the reset.
reset.full_reset
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
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
The questions to ask, in order. At least one is required.
questions[].key
The key the answer is stored under in global_data, or under output_key when it is set.
questions[].question
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
The type of the answer, as a JSON Schema type such as string, number, integer, or boolean.
questions[].confirm
If true, the AI reads the answer back and gets the caller’s confirmation before accepting it.
questions[].prompt
Extra instructions for this question, added after the question.
questions[].functions
Names of SWAIG functions the AI can call while asking this question. Other functions are unavailable during the question.
questions[].isolated
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
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
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
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
The same instructions as prompt, as a POM. Used when prompt is not set.
gather_info.output_key
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
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
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
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
confirmread-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.
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
hidestep 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
saytext, any conversation summary, and the exchange that entered the step. - What it removes stays removed when a later
isolatestep 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
sayplaced before thechange_stepin the same list is kept too. - A
post_processresult 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_stepor 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_dataaction 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; withisolate, the step isolates again up to that point. - The step’s
functionsare 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
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:
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.
- A
reasoning_effortvalue the model doesn’t accept is replaced with the model’s default before the request is sent. Other models ignore both keys. temperatureandtop_papply only whenreasoning_effortisnone. At any other effort, they aren’t used.- A
verbosityvalue other thanlow,medium, orhighuses 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
POM prompt
Rendered prompt
The above POM example will render the following markdown prompt:
Basic context
Advanced multi-context
This example demonstrates multiple contexts with different AI personalities, voice settings, and specialized knowledge domains:
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.
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.
Variable Expansion
Use the following syntax to expand variables into your prompt.
${call_direction}
Inbound or outbound.
${caller_id_number}
The caller ID number.
${local_date}
The local date.
${spoken_date}
The spoken date.
${local_time}
The local time.
${time_of_day}
The time of day.
${supported_languages}
A list of supported languages.
${default_language}
The default language.