Working with Examples
Learn how to use examples to improve your AxCrew agents
Understanding Examples
Examples are input/output pairs that help guide your agent's behavior. They work as few-shot learning examples, showing the agent how to respond to specific inputs.
Benefits of using examples:
- Achieve more consistent output formats
- Guide the agent toward specific response styles
- Demonstrate step-by-step problem-solving approaches
- Teach agents how to handle edge cases
Adding Examples to Agent Configuration
You can add examples to your agent configuration using the examples array:
Matching Examples to Signatures
For examples to be effective, they must match the input/output signature of your agent:
- Field names in the examples should exactly match those in your agent's signature
- Field values should reflect the expected types (strings, numbers, objects, etc.)
- The format and style of the examples should demonstrate how you want the agent to respond
For an agent with signature:
Your examples should look like:
Example Quality Guidelines
For the most effective examples:
- Be Specific: Include details that guide the agent's understanding
- Use Realistic Data: Examples should reflect real-world scenarios
- Cover Edge Cases: Include examples that handle unusual inputs
- Consistent Formatting: Maintain a consistent format across all examples
- Include Reasoning: For complex tasks, show the reasoning process
- Appropriate Length: Examples should be concise but complete
- Diverse Examples: Include a range of different input scenarios
Example Types
Format Examples
Demonstrate the desired output format:
Reasoning Examples
Demonstrate the reasoning process:
Edge Case Examples
Show how to handle unusual inputs:
Example Count Recommendations
- Minimum: 2-3 examples to show patterns
- Optimal: 3-5 examples for most use cases
- Complex Tasks: 5-10 examples for more complex tasks
- Balance: Too few won't guide the agent enough; too many might consume excessive tokens
Dynamic Examples
You can also generate examples dynamically:
Best Practices
- Match Your Use Case: Tailor examples to your specific use case
- Regular Updates: Refine examples based on actual outputs
- Balance Specificity: Be specific enough to guide but not so rigid that the agent can't generalize
- Consistent Formatting: Maintain the same format across examples
- Test Thoroughly: Test with various inputs to ensure examples are effective
- Adjust Temperature: Lower temperature (0-0.3) makes agents follow examples more closely