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

# Testing and run history

> Test AI Agents before launch and inspect what happened after each run.

Tests show how an AI Agent will handle realistic support cases. Run history shows what it did after a test or live trigger.

[Open run history](https://armin.cx/app/_/ai/agents-v2/runs) to inspect executions across all agents.

## What to test

Test the agent with messages that represent real customer situations:

* the happy path the agent should handle
* messages that should escalate
* ambiguous customer requests
* missing order or customer data
* sensitive actions that require approval
* messages that should not trigger the agent

## Test ownership and hand-offs

Use a short ticket conversation for each case:

| Test case                       | Example                                                                                   | Expected behavior                                                                                                                 |
| ------------------------------- | ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| Customer follow-up              | The order-tracking agent answers. The customer asks for the tracking link within 30 days. | The same agent continues with the order context when no human replied in between.                                                 |
| Late follow-up                  | The customer writes again more than 30 days after the agent finished.                     | The previous agent does not restart. The message is checked for another eligible automation.                                      |
| Human reply after finished work | The agent answers and finishes its current work. A teammate replies next.                 | That agent does not continue its follow-up chain. The next customer message can be checked for a fresh match.                     |
| Human reply during a pause      | The agent asks for a photo and waits. A teammate replies before the customer sends it.    | The old agent cannot resume. While the pause remains open, it also blocks a fresh AI Agent. The human team owns the conversation. |
| Specialist hand-off             | A returns agent learns that the item arrived damaged.                                     | It hands the conversation to one eligible damaged-product specialist, and the returns agent stops.                                |
| Human hand-off                  | A customer asks for an exception that no specialist can decide.                           | The agent hands the ticket to the configured person, team, or human queue.                                                        |
| No action needed                | The customer says, "Thanks, that solved it."                                              | The case can end without a reply or human alert when nothing else is needed.                                                      |
| Messages during work            | The customer sends two updates while the agent is still checking an order.                | After current work, the agent receives the latest update. No duplicate agent starts.                                              |

Also test a later customer message after a human hand-off. It may be matched to an eligible AI Agent again. If the ticket must stay human-only, test after narrowing or disabling matching AI Agent triggers, stopping Classic AI auto-reply, and narrowing or disabling macro Workflows with AI prompts.

## Create useful test cases

<Steps>
  <Step title="Start from real tickets">
    Use real customer wording when possible. Short synthetic prompts often miss the details that
    make support cases hard.
  </Step>

  <Step title="Add expected behavior">
    Define what the agent should do: answer, ask a follow-up, use an action, request approval, or
    escalate.
  </Step>

  <Step title="Include negative cases">Add examples where the agent should not act.</Step>

  <Step title="Review action usage">
    Check that the agent uses only the actions needed for the case.
  </Step>

  <Step title="Retest after changes">
    Rerun the relevant cases after changing instructions, triggers, skills, actions, or approvals.
  </Step>
</Steps>

## Use run history

Use it to check:

* why this agent received the ticket
* which instructions and skills influenced the run
* which actions the agent used
* whether approval was requested
* what customer-facing reply was produced
* why the agent escalated or stopped

The public [run history link](https://armin.cx/app/_/ai/agents-v2/runs) covers all agents. Agent-specific URLs contain private IDs and should not be published. Open an agent from the [AI Agents overview](https://armin.cx/app/_/ai/agents-v2), then select **Runs** or **Tests**.

## Debug unexpected behavior

If a run did not behave as expected, check:

* whether another automation already owned the conversation
* whether an exact or meaning-based trigger selected a different agent
* whether the agent instructions were too broad
* whether a skill contained conflicting guidance
* whether the needed action was enabled
* whether approval blocked the final step
* whether the ticket lacked required customer or order context

[Ask Torben to diagnose the run](https://armin.cx/app/_/ai/agents-v2?askTorben=Help%20me%20diagnose%20why%20an%20AI%20Agent%20did%20not%20handle%20a%20ticket%20as%20expected.%20Ask%20me%20for%20the%20ticket%20number%2C%20agent%20name%2C%20or%20run%2C%20then%20suggest%20specific%20improvements.). Include the ticket number, agent name, or run so Ask Torben can find the relevant execution.

For selection problems, read [Routing and ownership](/ai-agents/routing-and-ownership).

## Best practices

* Test before activation and after every major instruction or action change.
* Keep approval on while you review early production runs.
* Add a negative test whenever the agent overreaches.
* Use run history to improve instructions, not just to debug failures.
