Where to apply prompt engineering
Introduction
When working with SignalWire AI Agents, you can apply prompt engineering in five key areas, each serving a distinct purpose in creating effective, cohesive AI interactions. This guide explores each area in detail, helping you understand where and how to apply prompt engineering effectively.
Main Prompt
The main prompt serves as the foundation for your AI agent’s behavior across all interactions. Prompt engineering in this area defines the agent’s persona, purpose, and behavioral guidelines, establishing consistency in how it responds to users.
Purpose and Application
Main conversation prompts act as the core identity and instruction set for your AI agent. They define:
- The agent’s role and personality
- General conversational style
- Core knowledge areas
- Global behavioral boundaries
Good vs Bad Main Prompts
✅ Clear, Structured Main Prompt
❌ Vague, Unstructured Main Prompt
A well-structured prompt that clearly defines the agent’s role, guidelines, boundaries, and response structure.
Context Steps
The context steps lets you apply prompt engineering to guide the agent through different phases of a conversation. These stage-specific prompts are applied during specific steps in multi-stage conversation flows, offering precise control over complex interactions with distinct phases.
Purpose and Application
Context step prompts allow you to:
- Customize behavior for specific conversation stages
- Define goals and boundaries for each interaction phase
- Control transitions between different stages of a workflow
- Maintain contextual awareness during multi-step processes
Good vs Bad Context Steps
✅ Well-Structured Context Step
❌ Poorly Defined Context Step
A detailed context step that clearly outlines information collection, rules, and error handling.
SWAIG Functions
When using SWAIG Functions with your SignalWire AI Agents, prompt engineering can be applied directly in the function properties themselves. Rather than embedding guidance in your main prompt text, you provide this context through descriptive function names and clear descriptions.
Key Prompting Elements
The function definition itself contains the prompting information the AI needs:
- Function Name: Choose descriptive names that indicate the function’s purpose (
check_appointment_availabilityis better thanfunction_1) - Function Description: Write clear guidance about when and why to use the function
- Parameter Descriptions: Explain what information to extract from the conversation
SWAIG Functions Comparison
Below is a side-by-side comparison of a well-defined versus a poorly defined SWAIG function:
Post-Prompt
The post-prompt is where prompt engineering can be applied to process conversation data after an interaction has completely ended. Unlike other areas that affect the live conversation, post-processing prompts guide activities to extract valuable insights and structured data from completed interactions.
Purpose and Application
Post-prompts enable:
- Automated extraction of business intelligence
- Conversation summarization for records
- Data structuring for CRM integration
- Pattern identification across multiple interactions
- Quality assessment and improvement
Good vs Bad Post-Prompts
Structured Post-Processing Prompt
Vague Post-Processing Prompt
A comprehensive post-processing prompt with clear data requirements and output format.
Conscience
The conscience is where prompt engineering establishes fundamental ethical boundaries that bind the agent to its core purpose and values. Applied continuously across all interactions as core principles, prompts in this area ensure the agent maintains alignment with essential values regardless of other instructions it might receive.
Purpose and Application
Conscience prompts provide:
- Non-negotiable ethical boundaries
- Override capability for safety and compliance
- Brand protection mechanisms
- User safety and privacy guarantees
- Legal and regulatory guardrails
Good vs Bad Conscience Prompts
Comprehensive Ethical Guidelines
Oversimplified Ethical Guidelines
Well-structured ethical guidelines with clear boundaries and protocols.