> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coval.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Metric Chaining

> Combine metrics into custom logic flows for more efficient and accurate evaluations

Metric Chaining allows you to create conditional metric flows where a follow-up metric runs only when specific criteria are met by a trigger metric. This approach helps you avoid cramming multiple evaluation checks into a single metric while ensuring accuracy and efficiency in your evaluations.

Instead of creating one complex metric that tries to handle multiple scenarios, you can break down your evaluation logic into separate, focused metrics that run conditionally based on the results of previous metrics.

## Benefits of Metric Chaining

* **Improved Accuracy**: Each metric focuses on a specific aspect of the conversation
* **Efficiency**: Only run metrics that are relevant to the specific conversation flow
* **Clarity**: Separate concerns make metrics easier to understand and maintain
* **Flexibility**: Create complex evaluation logic without overwhelming single metrics

## How Metric Chaining Works

1. **Trigger Metric**: The primary metric that runs first and determines whether additional metrics should execute
2. **Follow-up Metric**: The secondary metric that runs conditionally based on the trigger metric's result
3. **Criteria**: The condition that determines when the follow-up metric should run (e.g., "equal to 0", "greater than 0")

## TL;DR Walkthrough:

<iframe className="w-full aspect-video rounded-xl" src="https://www.loom.com/embed/743bcac22b124fc09fe7c49e5429ad87?sid=871e5013-0f7d-4102-8d7b-2755cb684424" title="Loom Video" frameBorder="0" allow="accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />

## Example Use Case: Appointment Setter Agent

Consider an appointment setter agent with two distinct evaluation needs:

1. **Repeat Caller Handling**: Check if the agent correctly identifies repeat callers
2. **Patient Information Collection**: Check if the agent collects necessary information (first name, last name, phone number)

Without metric chaining, you might be tempted to create one large metric covering both scenarios. With metric chaining, you can:

* Use "Repeat Caller Handling" as your trigger metric
* If it returns "No" (agent couldn't identify as repeat caller), then run "Patient Information Collection"
* If it returns "Yes" (agent identified repeat caller), skip the information collection check

## Setting Up Metric Chaining

### Prerequisites

Before creating a metric chain, ensure you have:

1. Created your trigger metric
2. Created your follow-up metric
3. Tested both metrics individually

### Creating a Metric Chain

1. Navigate to **Metric Chains** in your dashboard
2. Click **"Add a Metric Chain"**
3. Configure the chain:
   * **Status**: Set as Active or Inactive
   * **Trigger Metric**: Select your primary metric
   * **Follow-up Metric**: Select the metric to run conditionally
   * **Criteria**: Define when the follow-up metric should run
     * **Equal to 0**: Run follow-up when trigger returns "No"
     * **Greater than 0**: Run follow-up when trigger returns "Yes"
     * **Other conditions**: As needed for your use case
4. **Save** your metric chain

### Applying Metric Chains in Evaluations

When launching an evaluation with metric chains:

1. In your evaluation setup, select **only the trigger metric**
2. The follow-up metric will automatically run based on your chain conditions
3. Do not manually select the follow-up metric - the chain will handle this

<Note>
  Only select the trigger metric when launching evaluations. The chained metrics will run automatically based on your configured conditions.
</Note>

## Example Results

### Scenario 1: Trigger Metric Returns "Yes"

* **Trigger**: "Repeat Caller Handling" returns **Yes**
* **Result**: Agent successfully identified repeat caller
* **Chain Action**: Follow-up metric does NOT run
* **Transcript Example**: "Perfect, John Doe, I see you..."

### Scenario 2: Trigger Metric Returns "No"

* **Trigger**: "Repeat Caller Handling" returns **No**
* **Result**: Agent could not identify repeat caller
* **Chain Action**: "Patient Information Collection" runs automatically
* **Transcript Example**: "I can't find your information in our system, I'm sorry..."

## Best Practices

* **Start Simple**: Begin with two-metric chains before creating more complex flows
* **Test Individually**: Ensure each metric works correctly on its own before chaining
* **Clear Logic**: Make sure your chain conditions align with your evaluation goals
* **Document Chains**: Keep track of your metric chain logic for team collaboration

## Advanced Usage

Metric chaining can be extended for more complex scenarios:

* **Multi-step Chains**: Chain multiple metrics in sequence
* **Different Conditions**: Use various threshold conditions for triggering
* **Business Logic**: Implement complex business rules through chained evaluations

<Info>
  **Need more complex metric chaining scenarios?** Contact our team to discuss advanced metric chain configurations for your specific use case.
</Info>
