Prerequisites
Before building, clarify exactly what you are tracking. Understand the terminology used during monitoring:- Main Agent: Your AI agent (the one being tested).
- Testing Agent: The simulated user interacting with your agent.
Step 1: Metric Definition
Navigate to the Metrics section and select Create Metric.- Name & Type: Give your metric a descriptive name (e.g.,
Correct End Call by Main Agent). Select the Metric Type (usually Boolean for pass/fail checks). - Success Impact: Toggle Affects Call Success to
Trueif this metric is critical (i.e., if this fails, the entire call is considered a failure). - Description (The Prompt): Write a natural language description of what constitutes success.
Step 2: Set Triggers
Define when the metric should run under the Evaluation Trigger section.- Always: Runs on every call (default).
- Custom: Use logic to run metrics only in specific scenarios (e.g.,
return Trueonly if the agent is attempting to book an appointment).
Step 3: Initial Validation (Test Metric)
Before saving, validate your logic immediately within the builder.Step 4: The Feedback Loop (Observability)
This is the most critical step for accuracy. You must “teach” the metric by providing ground-truth data.Best Practice: Repeat this process for at least 6 calls to create a robust dataset for optimization.
Step 5: Optimization (Labs)
Once you have annotated data (feedback), use the Labs feature to auto-optimize the metric.Review Current Performance
You will see your annotated examples and the current “Overall Score” against your human feedback.
Auto Improve
Click Auto Improve.The system will use your feedback and explanations to rewrite the metric’s internal logic/prompt to handle the edge cases you identified.
Summary of Workflow
The complete workflow for building high-fidelity metrics follows this iterative process:- Draft: Create a basic description and logic.
- Test: Run on historical calls.
- Annotate: Correct mistakes manually and explain the why.
- Optimize: Use “Auto Improve” to let the system refine the prompt based on your annotations.
Next Steps
- Learn about custom metrics
- Explore predefined metrics
- Set up instruction following metric
- Use Metric Lab to optimize your metrics