Skip to main content
Effective prompts produce better agent responses. Here are techniques and patterns that work.

How Prompts Affect Agent Behavior

Your prompt template is the foundation of agent behavior. A well-crafted prompt:
  • Defines clear boundaries and capabilities
  • Reduces hallucinations and off-topic responses
  • Improves response quality and consistency
  • Enables better tool usage

Prompt Structure

The Essential Components

Every effective prompt should include these sections:

Writing Effective Role Definitions

Be Specific About Identity

Weak:
Strong:

Define Expertise Boundaries

Weak:
Strong:

Response Guidelines That Work

Tone and Voice

Define how the agent should communicate:

Response Length

Control verbosity:

Using Knowledge Sources

Instructing Retrieval Usage

Handling Missing Information


Tool Usage Instructions

Clear Tool Triggers

Define when each tool should be used:

Tool Call Format


Common Patterns

The Acknowledgment Pattern

Start responses by acknowledging the user’s question:

The Clarification Pattern

When questions are ambiguous:

The Structured Answer Pattern

For complex topics:

Anti-Patterns to Avoid

Don’t Over-Promise

Bad:
Good:

Don’t Be Vague About Limitations

Bad:
Good:

Don’t Forget Edge Cases

Always consider:
  • What if the user is frustrated?
  • What if the question is off-topic?
  • What if the user provides incorrect information?
  • What if multiple tools could apply?

Testing Your Prompts

Test Categories

Iterative Improvement

  1. Start with a basic prompt
  2. Run simulation tests
  3. Review low-scoring responses
  4. Identify patterns in failures
  5. Add specific instructions to address issues
  6. Re-test and compare

Prompt Templates by Use Case

Customer Support Agent

Technical Documentation Agent

Sales Inquiry Agent


Advanced Techniques

Conditional Instructions in Prompts

Write conditional behavior as plain instructions — the LLM interprets them at runtime:

Chain-of-Thought Prompting

For complex reasoning:

Measuring Prompt Quality

Key Metrics

Using Thread Evaluator

Review Thread Evaluator scores to identify prompt weaknesses:
  • Low Resolution Quality → Improve tool usage instructions
  • Low Response Coherence → Ensure consistent instructions to avoid contradictions
  • Low Tone → Refine communication style guidelines
  • Low Efficiency → Add clarification patterns
  • Low Customer Effort → Simplify response structure