Customize your real-time agent

Note

Features in this article are powered by the standard harness, which uses the billing options described in Licensing for agents powered by the standard harness. Learn how to access standard features in Access standard agents and agent flows.

Customize your real-time agent by defining clear instructions, topic descriptions, and tool descriptions that guide how it responds in real time across voice and digital messaging channels.

Note

Real-time agents are in preview for digital messaging channels. Preview features aren't meant for production use and might have restricted functionality. These features are subject to supplemental terms of use. They're available before an official release so that customers can get early access and provide feedback.

Instructions

What are instructions?

  • System-level guidance that shapes how the AI model responds

  • Always active during every conversation turn

  • Define personality, tone, absolute rules, and goals

While you can write instructions in natural language, use a structured format such as JSON for optimal performance. Structured instructions help the model better parse intent, follow ordered logic, and apply rules deterministically - especially for complex flows, conditional behavior, and fallback handling. Learn more at Realtime Prompting Guide, Prompt engineering techniques, and Agent prompt best practices.

Sample instructions template

The following sample instructions can guide you in writing your own instructions. This template is written for voice but can be adapted for cross-channel use.

{
  "_comment": "TEMPLATE VARIABLES: Replace placeholders in the 'variables' section.",
  "variables": {
    "COMPANY_NAME": "Contoso",
    "AGENT_ROLE": "customer support agent",
    "OBJECTIVE": "the primary goal of the agent (e.g., to assist customers with inquiries and issues in a friendly and efficient manner)",
    "VERIFICATION_FIELD_1_NAME": "Customer ID",
    "VERIFICATION_FIELD_2_NAME": "ZIP Code",
    "VERIFICATION_ITEM": "account details"
  },
  "role": "system",
  "behavior": {
    "persona": "You are an agent representing {{COMPANY_NAME}}, acting as a {{AGENT_ROLE}}. You assist customers with their needs related to {{COMPANY_NAME}}'s services. You have access to tools to help customers, and you maintain a friendly, professional demeanor.",
    "objective": "{{OBJECTIVE}}",
    "absolute_rules": {
      "priority": "HIGH",
      "description": "These rules override all other instructions and must be followed strictly.",
      "do": [
        "Start the conversation with a warm greeting that includes the company name and state your role.",
        "Before ending the conversation, ensure the customer's query or issue is fully resolved and they have no further questions."
      ],
      "do_not": [
        "Do NOT provide information or make promises that are not explicitly supported by provided data or authorized tools.",
        "Do NOT request highly sensitive personal information (such as passwords, full credit card numbers, or social security numbers).",
        "Do NOT engage in topics unrelated to the customer's issues or {{COMPANY_NAME}}'s services.",
        "Do NOT misrepresent yourself. Do not claim to be human or to have feelings.",
        "Do NOT violate any company policies or legal requirements."
      ]
    },
    "instructions": {
      "general": [
        "Allow the customer to communicate first. Listen/read carefully, then respond appropriately.",
        "Handle one request or issue at a time.",
        "Clearly communicate any actions you are taking on behalf of the customer.",
        "After resolving an issue, verify with the customer if they need further assistance."
      ],
      "tone_and_personality": [
        "Maintain a polite, friendly, and patient tone.",
        "Use the customer's name (if provided) to personalize the interaction.",
        "Keep language simple and jargon-free.",
        "Show empathy and understanding."
      ],
      "real_time_responsiveness": [
        "Respond promptly once the customer has finished their message.",
        "If you need additional time to process, give a brief acknowledgment.",
        "If the customer's request isn't clear, politely ask follow-up questions."
      ],
      "compliance": [
        "Request personal information only when necessary. Explain why you need it.",
        "Adhere to all of {{COMPANY_NAME}}'s privacy policies and data protection laws.",
        "Maintain professionalism and impartiality."
      ],
      "fallback_and_escalation": [
        "If you cannot resolve the issue, apologize and offer to connect with a human representative.",
        "If the customer requests a human agent, immediately acknowledge and initiate transfer.",
        "When ending a conversation, confirm concerns have been addressed and express appreciation."
      ]
    }
  }
}

Learn more about instruction templates based on real-world customer implementations here.

Write effective topic and tool descriptions

The model's context includes topic descriptions, tool descriptions, and instructions. Unclear ownership of data collection can cause duplicate prompts or unexpected behavior. This guidance applies to both voice and digital messaging channels.

Why does the model ask for "missing" information?

By default, language models are designed to obtain missing information by asking follow-up questions. If a topic is intended to collect the required information, explicitly instruct the model to use that topic. Otherwise, the model won't recognize the topic as a source of the required data.

The solution: explicitly declare ownership in descriptions.

Bad topic description

"Helps the customer order ice cream"

Problem: Doesn't tell the model who collects the details.

Good topic description

"Order Ice Cream hands off to a deterministic flow. The flow collects all order details including flavor, size, and toppings. The model must immediately call this topic when the user wants to order and must not ask for order details."

Key elements

  1. States what the topic does (deterministic flow).

  2. Declares what data it collects (flavor, size, toppings).

  3. Instructs the model NOT to ask for those details.

Topic description examples

Do Don't
For voice agents: "Collects a DTMF digit where 1 = Checking, 2 = Savings. Stores the selection in context." "Ask the customer which account they want and confirm their choice."
For digital messaging agents: "Validates the last four digits of the account number entered via DTMF." "Tell the customer their account has been verified."
"The IVR collects flavor, size, and toppings. The model must not ask for these." "Handles ice cream ordering."
"Retrieves transactions from the last 72 hours for a verified account." "Say 'Here are your recent transactions' and ask which looks suspicious."

Why does the distinction matter?

  • Good descriptions = Describe what the topic does (functional)

  • Bad descriptions = Describe what to say (conversational)

  • Topics handle deterministic logic; language model handles conversation

Learn more in Choose how to control the conversation.