Skip to main content

Overview

This guide covers advanced usage patterns:
  • Deterministic A/B testing
  • Metrics aggregation across versions
  • Production-ready patterns
  • Real-world use cases

A/B Testing with Consistent Routing

The same context always gets the same version, ensuring consistent user experiences.

Metrics Aggregation Pattern

Record metrics with the same context to aggregate by version:

Email Campaign Example

Complete email campaign workflow with A/B testing:

Chatbot Example

Customer support chatbot with context tracking:

Product Description Generator

Generate product descriptions with A/B testing:

Gradual Rollout Pattern

Safely roll out new prompt versions:

Best Practices

Record metrics asynchronously to avoid blocking your main application flow.
Always handle errors gracefully with fallbacks and logging.
Always use the same context structure across prompt executions and metric recordings.
Regularly check the dashboard to ensure traffic is distributed as expected.
Know what metrics matter before running A/B tests.

Next Steps

Error Handling

Learn production-ready error handling patterns

API Reference

Explore the complete API reference