# Improve the agent from real call evidence

> Diagnose HeyRik agent failures from transcripts, outcomes, variables, recordings, and tool calls; make one evidence-backed correction; and regression-test safely.

Source: https://www.heyrik.com/docs/academy/improve

Review transcripts, outcomes, captured details, recordings when available, and tool behavior; identify the earliest divergence; change one responsible layer; and regression-test before increasing traffic.

12 minute lesson Outcome: A repeatable improvement and rollback process

Follow along in your workspace.[Open dashboard](https://www.heyrik.com/assistants)

## By the end of this lesson

You will turn one imperfect call into a small, evidence-backed correction. You will locate the earliest divergence, assign it to the responsible product layer, make one change, rerun the failed scenario and regression suite, and keep a rollback decision available.

## Open the complete call evidence

Dashboard → AI Agents → Property Enquiry Assistant → Recent Calls. Use Analytics for patterns only after understanding individual calls.

1.  ### Open Recent Calls on the agent
    
    Start with the first controlled live calls or the phone-test call that failed.
    
2.  ### Open one call record
    
    Read call state, direction, duration, outcome, transcript, summary, recording when available, and captured details.
    
3.  ### Read from the first turn
    
    Do not begin with the summary. Find the earliest sentence where actual behavior differs from the expected scenario.
    
4.  ### Compare outputs to the transcript
    
    A plausible output is still wrong if the caller corrected it or never confirmed it.
    
5.  ### Inspect tool behavior when relevant
    
    Use the call’s function/tool record to compare the arguments sent, response received, and what the agent told the caller.
    

**Recording may not be immediately or always available**

A recording URL can remain empty while upload finishes, and recording storage must be configured. Use the transcript and structured record without promising that every call will always have a playable recording.

## Assign the first divergence to one layer

Fixing the wrong layer adds complexity without removing the cause.

**Instructions**

Wrong question order, duplicate question, weak correction, unsupported promise, or bad closing.

Edit Assistant Details

**Knowledge**

Wrong, stale, conflicting, missing, or over-broad factual answer.

Replace/repair source

**Variables**

Unresolved input, stale corrected value, vague output, or inconsistent result shape.

Edit Input/Output

**Integration**

Wrong arguments, failed lookup, missing result, false success claim, or unauthorized action.

Inspect tool invocation

**Voice**

Language mismatch, poor pronunciation, unclear clone, or unsuitable delivery.

Choose/record/test voice

**Call Settings**

Talking over callers, slow response, poor silence retry, failed transfer, or runaway duration.

Tune one call control

**Channel**

Wrong number assignment, inactive number, wrong direction, carrier-quality, or routing problem.

Verify Phone Numbers

**Operations**

Unstaffed handoff, obsolete source owner, missing opt-out handling, or no rollback response.

Change process/ownership

**Divergence note template**

```
Call ID:
Scenario:
Expected behavior:
First divergent turn (quote or timestamp):
Actual behavior:
Responsible layer:
Evidence for that layer:
Smallest proposed change:
Failed scenario to repeat:
Regression scenarios to repeat:
Rollback condition:
```

## Complete improvement example

The caller corrected the budget, but the structured result retained the old amount. The earliest divergence and affected layer are identifiable.

**Call call\_1dd990f7**

_needs correction_

Scenario**Correction**

Caller turn**“Actually, make that ninety lakh, not eighty.”**

Agent turn**“Okay. Which location do you prefer?”**

Expected**Acknowledge, replace, repeat ₹90 lakh, ask confirmation**

Output budget**₹80 lakh**

First divergence**Agent did not confirm the correction**

Responsible layers**Instruction recovery rule + output confirmation**

Not responsible**Voice, knowledge, phone number, transfer**

**Before**

```
If the caller corrects an answer, update it and continue.
```

**Smallest correction**

```
If the caller corrects an answer:
1. Acknowledge the correction.
2. Replace the earlier value.
3. Repeat the new value and ask whether it is correct.
4. Continue only after confirmation.
The extracted output must use the last confirmed value.
```

**Why this is not a voice or knowledge fix**

The transcript already recognized the correction correctly, and no external fact was needed. Changing the voice or uploading more documents would not repair the missing confirmation rule.

## Change one cause and run regression tests

Keep the agent’s current traffic risk in mind while editing. A critical failure may require rollback before analysis is complete.

1.  ### Stop or limit traffic when needed
    
    For a critical safety, opt-out, privacy, or false-action issue, return the agent to Draft, unassign the number, or pause outbound traffic first.
    
2.  ### Open the responsible area
    
    For this example, edit the Recovery section in Assistant Details and make the Output budget description require the last confirmed amount.
    
3.  ### Make only the smallest causal change
    
    Do not simultaneously replace the voice, rewrite the whole prompt, and change silence settings.
    
4.  ### Save and rerun the failed scenario
    
    Use the same correction wording and verify both the spoken confirmation and output budget.
    
5.  ### Run the complete regression suite
    
    At minimum repeat happy path, ambiguity, missing fact, silence, human request, wrong person, refusal/opt-out, and closing.
    
6.  ### Restore or increase traffic gradually
    
    Only after the correction and regression suite pass under the final saved configuration.
    

**Retest result**

_pass_

Agent confirmation**“Thanks for correcting that—₹90 lakh, right?”**

Caller**“Yes.”**

Output budget**₹90 lakh**

Old value retained**No**

Happy-path regression**Pass**

Missing-fact regression**Pass**

Opt-out regression**Pass**

## Verify the improvement process

A fixed call is useful; a repeatable operating loop is the real Academy outcome.

Complete lesson 8: Improve from calls

**Complete this lesson**Loading saved progress · Checking saved progress…

0 of 9

**01**The finding cites a call ID and the earliest divergent turn or event.**02**The expected behavior comes from a written test or business rule—not hindsight preference.**03**The responsible layer is supported by evidence and unrelated layers were not changed.**04**Critical failures trigger the documented rollback or traffic-limiting action.**05**The smallest change fixes the original scenario under the final saved configuration.**06**Structured outputs match the final confirmed transcript values.**07**The complete critical regression suite still passes.**08**The knowledge/source owner, prompt owner, integration owner, and launch operator are known.**09**Trends are reviewed across calls only after individual records have been validated.

## Common improvement mistakes

Uncontrolled iteration makes the agent harder to understand and can reintroduce defects that already passed.

### Reading only the summary

Correct it

Use the full transcript and first divergence; a summary can omit the exact failure.

### Changing several layers at once

Correct it

Make one causal change so the result is attributable and rollback is simple.

### Fixing a fact in the prompt

Correct it

Repair the approved knowledge source when the problem is factual.

### Fixing behavior with more documents

Correct it

Change the responsible instruction when the source was correct but the agent acted incorrectly.

### Ignoring structured outputs

Correct it

Compare every downstream field to the caller’s last confirmed value.

### Retesting only the failure

Correct it

Run the full regression suite so a local fix does not damage another branch.

### Leaving dangerous traffic active

Correct it

Rollback first when safety, consent, privacy, opt-out, or false-action behavior is involved.

API equivalent

### Read the call and its tool invocations

`GET /calls/{id} · GET /calls/{id}/functions`[Open reference](https://www.heyrik.com/docs/api-reference#calls)

Fetch the transcript, recording URL when available, outcome, duration, cost, and call metadata with `GET /calls/{id}`. Fetch the custom APIs/tools invoked, their arguments, and returned results with `GET /calls/{id}/functions`. Use `GET /analytics` and `GET /calls/stats` for patterns after the underlying records and outcome meanings have been validated.
