Skip to navigation

Wording, rules, and medium

View as MarkdownOpen in Claude

Every string an Operations service generates comes from a key in DEFAULT_WORDING: the step text, tool descriptions, tool results and prompts, gates, the transfer notice, and the record’s now line. The prompt’s Rules section comes from DEFAULT_RULES. Both can be changed when the service is made.

from signalwire.operations import DEFAULT_RULES, DEFAULT_WORDING

wording

wording= on Operations or ServiceAgent takes overrides keyed like DEFAULT_WORDING, such as "step.main" or "transfer.notice". DEFAULT_WORDING is a read-only mapping of every key to its default text.

  • A {name} in a template is a placeholder, filled in when the words are used. An override may leave placeholders out, but not add new ones.
  • An unknown key or placeholder raises ValueError when the service is made.
  • Platform variables such as ${global_data.today} are kept as written.

The model answers in the language its role asks for. The generated words are instructions to the model, so English ones work in any language. The transfer notice is the one string the platform speaks word for word.

Each task pack and prefab has its own table and wording= argument: APPOINTMENTS_WORDING (Appointments), MESSAGES_WORDING (Messages), PAYMENTS_WORDING (Payments), KNOWLEDGE_WORDING (InfoBotKnowledge), FrontDeskAgent.WORDING (FrontDeskAgent, set with desk_wording=), and PersonalAssistantAgent.WORDING (PersonalAssistantAgent, set with assistant_wording=).

rules

DEFAULT_RULES is a read-only mapping with three keys:

KeyDefault rule
replyKeep each reply short, but give every fact the caller asks for.
factsState only facts that came from a tool result. Never guess records, prices or policies.
confirmNothing changes until the caller says yes to a change read back to them and it is confirmed.

confirm is left out for a service with no operations. rules= as a list replaces them all. As a mapping it changes them by key: a new key adds a rule, an existing key replaces that rule, and None removes it.

medium

medium= is "voice", "chat", or None; any other value raises ValueError.

  • With a value, the reply rule starts with “This is a phone call.” or “This is a chat.”
  • With None, each call’s medium is read from the request’s conversation_type, kept in the record as medium, and stated at the start of now. Your code reads it as call.medium.

Example

from signalwire.operations import Operations
ops = Operations(
role="Atiendes el teléfono de una tienda. Hablas siempre en español.",
rules={"facts": None, "tone": "Use usted."},
wording={"transfer.notice": "Un momento, le paso con una persona."},
medium="voice",
)