Prompt engineering fundamentals
The agent prompt is the foundation of your AI agent’s behavior. A well-crafted prompt defines the agent’s personality, capabilities, and decision-making logic. Poor prompts lead to inconsistent, irrelevant, or incorrect responses.Prompt structure template
Access control and permissions
Role-based prompt access
- SuperAdmin/Admin: Full access to all prompt features including AI refinement
- Developer: Can edit prompts and use refinement tools; changes require approval for production
- Tester: Read-only access for testing purposes
- Viewer: Limited to viewing published prompts only
Creating effective prompts
Step-by-step prompt creation
1
Define the agent's role
Clearly specify what the agent is and what it does.Good example:Poor example:
2
Provide context and background
Give the agent relevant business context and domain knowledge.Good example:
3
Define capabilities and limitations
Clearly state what the agent can and cannot do.Good example:
4
Include examples and patterns
Provide sample interactions to guide the agent’s responses.Good example:
5
Set output format requirements
Specify how the agent should structure its responses.Good example:
AI-powered prompt refinement
Using the built-in refinement tool
1
Access refinement
In the Inspector’s Details tab, click “Refine with AI” after writing your initial prompt.
2
Review suggestions
The AI will analyze your prompt and suggest improvements for:
- Clarity and specificity
- Missing context or examples
- Better structure and organization
- More precise instructions
3
Apply or customize
Choose to apply all suggestions, select specific improvements, or manually edit the refined version.
Refinement best practices
- Iterate multiple times: Refine prompts based on actual agent performance
- Test with real scenarios: Use actual customer queries to validate prompt effectiveness
- Monitor performance: Track response quality and adjust prompts accordingly
- Version control: Keep track of prompt changes and their impact on performance
Debugging prompt issues
Common prompt problems and solutions
Agent gives irrelevant responses
Agent gives irrelevant responses
Symptoms: Agent responds to queries but answers are off-topic or unhelpfulDebugging steps:Resolution: Add more specific role definition, relevant examples, and business context
- Check if the prompt clearly defines the agent’s role and scope
- Verify that examples match the types of queries you expect
- Review the context section for missing business information
- Test with sample queries to identify gaps
Agent ignores instructions
Agent ignores instructions
Symptoms: Agent doesn’t follow specific instructions or constraintsDebugging steps:Resolution: Make instructions more explicit, add negative examples, and strengthen constraints
- Check if instructions are clear and unambiguous
- Verify that constraints are explicitly stated
- Review the examples to ensure they demonstrate desired behavior
- Test with edge cases to identify instruction gaps
Inconsistent response format
Inconsistent response format
Symptoms: Agent responses vary in structure and formatDebugging steps:Resolution: Clarify output format requirements and provide consistent examples
- Check if output format requirements are clearly specified
- Verify that examples demonstrate the desired format
- Review the prompt for conflicting format instructions
- Test with multiple queries to identify format inconsistencies
Agent asks for unnecessary information
Agent asks for unnecessary information
Symptoms: Agent requests information that’s not needed for the taskDebugging steps:Resolution: Streamline information requirements and provide examples of efficient interactions
- Review the prompt for overly broad information requests
- Check if examples demonstrate efficient information gathering
- Verify that the agent understands what information is actually needed
- Test with scenarios where minimal information should suffice
Advanced prompt techniques
Chain-of-thought prompting
Few-shot learning
Role-playing and persona
Testing and validation
Prompt testing checklist
- Role is clearly defined and specific
- Context includes relevant business information
- Capabilities and limitations are explicitly stated
- Examples demonstrate desired behavior
- Output format is clearly specified
- Constraints are unambiguous
- Prompt handles edge cases appropriately
- Response quality meets business requirements
Performance monitoring
- Response relevance: Track how often responses directly address customer queries
- Information efficiency: Monitor how quickly agents gather necessary information
- Constraint compliance: Ensure agents follow all specified rules and limitations
- Customer satisfaction: Measure customer feedback on agent interactions
Integration with other components
RAG integration
- Knowledge Base: Ground prompts with enterprise data
- Data Sources: Connect prompts to relevant information sources
Tool integration
- Tools: Enable prompts to trigger external actions
- DevStudio: Create custom tools for specific prompt needs
Variable management
- Variables: Use captured data to personalize prompts
- Decision Logic: Create dynamic prompts based on workflow state
Best practices summary
- Start specific: Define clear roles and boundaries from the beginning
- Iterate based on data: Use actual performance metrics to refine prompts
- Test thoroughly: Validate prompts with real-world scenarios
- Monitor continuously: Track performance and adjust as needed
- Document changes: Keep track of prompt versions and their impact
- Collaborate: Get feedback from stakeholders and end users
- Stay current: Update prompts as business requirements evolve