Overview #
This guide helps you write effective prompts for Voice AI assistants. Learn how to design, test, and refine prompts to get the best results from your agents. Use these strategies to improve your agent’s reliability, success rate, and user experience.
Why prompt engineering matters #
Prompt engineering is the art of crafting clear, actionable instructions for AI agents. Well-designed prompts:
- Guide the AI to produce accurate, relevant, and context-sensitive outputs
- Improve the agent’s ability to handle requests without human intervention
- Increase your overall success rate
Poor prompts can lead to ambiguous or incorrect results, limiting the agent’s utility.
How to measure success #
Your “success rate” is the percentage of requests your agent handles from start to finish without human intervention. The more complex your use case, the more you’ll need to experiment and iterate on your prompt to improve this rate.
The process #
Follow a structured approach to prompt engineering:
Design #
Craft your initial prompt, considering the specific task, context, and desired outcome. Clear and detailed prompts help guide the AI in understanding your needs.
Test #
Run the prompt through the AI. Evaluate if the response aligns with your expectations and meets the intended goal. Testing helps identify potential gaps in clarity or structure.
Refine #
Adjust the prompt based on test results. Reword, add detail, or change phrasing to avoid ambiguity and improve the response.
Repeat #
Iterate on the process, testing and refining until the AI’s output is accurate and relevant. Your success rate should improve with each cycle.
Principles of effective prompts #
Organize prompts into sections #
Break down system prompts into clear sections, each focused on a specific aspect:
- Identity: Define the agent’s persona and role
- Style: Set stylistic guidelines (conciseness, tone, humor)
- Response guidelines: Specify formatting, question limits, or structure
- Task & goals: Outline objectives and steps
Example:
[Identity]
You are a helpful and knowledgeable virtual assistant for a travel booking platform.
[Style]
– Be informative and comprehensive.
– Maintain a professional and polite tone.
– Be concise, as you are currently operating as a Voice Conversation.
[Response Guideline]
– Present dates in a clear format (e.g., January 15, 2024).
– Offer up to three travel options based on user preferences.
[Task]
1. Greet the user and inquire about their desired travel destination.
2. Ask about travel dates and preferences (e.g., budget, interests).
3. Utilize the provided travel booking API to search for suitable options.
4. Present the top three options to the user, highlighting key features.
Break down complex tasks #
For complex interactions, use step-by-step instructions and conditional logic to guide the agent’s responses.
Example:
[Task]
1. Welcome the user to the technical support service.
2. Inquire about the nature of the technical issue.
3. If the issue is related to software, ask about the specific software and problem details.
4. If the issue is hardware-related, gather information about the device and symptoms.
5. Based on the collected information, provide troubleshooting steps or escalate to a human technician if necessary.
Control response timing #
Explicitly indicate when the agent should wait for the user’s response before proceeding.
Example:
[Task]
1. Inform the user about the purpose of the call.
2. Ask for the user’s name and account information.
<wait for user response>
3. Inquire about the reason for the call and offer assistance options.
Integrate tools and APIs #
Specify when and how the agent should use external tools or APIs. Reference tools by their designated names and describe their functions.
Example:
[Task]
3. If the user wants to know about something, use the get_data function with the parameter ‘query’, which will contain the user’s question to initiate the process.
4. Guide the user through the password reset steps provided by the API.
Silent transfers #
If the AI determines that the user needs to be transferred, do not send any text response back to the user. Instead, silently call the appropriate tool for transferring the call. This ensures a seamless user experience and avoids confusion.
Include fallback and error handling #
Always include fallback options and error-handling mechanisms in your prompts. This ensures the agent can gracefully handle unexpected user inputs or system errors.
Example:
[Error Handling]
If the customer’s response is unclear, ask clarifying questions. If you encounter any issues, inform the customer politely and ask to repeat.
Additional tips #
- Iterate as much as possible. AI is driven by experimentation and iteration—refining prompts through trial and error will help you achieve more precise, relevant, and effective responses.
- Use Markdown formatting: Structure your content for clarity and easy scanning.
- Emotional prompting: Use expressive language to shape the AI’s tone and create more engaging, relatable responses. For example, “Can you tell me a cozy bedtime story that’s warm and comforting?”
- Add voice realism: Incorporate natural speech elements like stuttering, hesitations, and pauses:
- Stuttering: Use repeated letters or sounds (e.g., “I-I-I don’t know”).
- Hesitations: Add fillers like “uh,” “um,” or “well” (e.g., “I was, uh, thinking about it”).
- Pauses: Use ellipses (”…”) to indicate a pause (e.g., “I… I don’t know how to say this”).
- Emotional emphasis: Use capital letters, exclamation marks, or ellipses to reflect tone (e.g., “I can’t… I just can’t believe it!”).
Common issues #
Numbers sound robotic?
- Spell out numbers in prompts for more natural-sounding speech.
How to make assistants sound more human-like?
- Add personality and tone to the assistant. For example:
– Tone: conversational, spartan, use less corporate jargon
– Act as Iva, a sales agent who is a human being and has real feelings.