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

Prompt editing requires “Developer” role or higher. Users with “Tester” or “Viewer” roles can only view prompts but cannot modify them.

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

Use refinement as a starting point, not a final solution. Always review and customize AI suggestions to match your specific use case.
  • 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

Symptoms: Agent responds to queries but answers are off-topic or unhelpfulDebugging steps:
  1. Check if the prompt clearly defines the agent’s role and scope
  2. Verify that examples match the types of queries you expect
  3. Review the context section for missing business information
  4. Test with sample queries to identify gaps
Sample debugging code:
Resolution: Add more specific role definition, relevant examples, and business context
Symptoms: Agent doesn’t follow specific instructions or constraintsDebugging steps:
  1. Check if instructions are clear and unambiguous
  2. Verify that constraints are explicitly stated
  3. Review the examples to ensure they demonstrate desired behavior
  4. Test with edge cases to identify instruction gaps
Sample debugging code:
Resolution: Make instructions more explicit, add negative examples, and strengthen constraints
Symptoms: Agent responses vary in structure and formatDebugging steps:
  1. Check if output format requirements are clearly specified
  2. Verify that examples demonstrate the desired format
  3. Review the prompt for conflicting format instructions
  4. Test with multiple queries to identify format inconsistencies
Sample debugging code:
Resolution: Clarify output format requirements and provide consistent examples
Symptoms: Agent requests information that’s not needed for the taskDebugging steps:
  1. Review the prompt for overly broad information requests
  2. Check if examples demonstrate efficient information gathering
  3. Verify that the agent understands what information is actually needed
  4. Test with scenarios where minimal information should suffice
Sample debugging code:
Resolution: Streamline information requirements and provide examples of efficient interactions

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

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

  1. Start specific: Define clear roles and boundaries from the beginning
  2. Iterate based on data: Use actual performance metrics to refine prompts
  3. Test thoroughly: Validate prompts with real-world scenarios
  4. Monitor continuously: Track performance and adjust as needed
  5. Document changes: Keep track of prompt versions and their impact
  6. Collaborate: Get feedback from stakeholders and end users
  7. Stay current: Update prompts as business requirements evolve