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

# Test an Agentforce agent

> Set up an agent in a project, write scenarios for it from a standard or your own words, run them and read the conversations and verdicts.

This guide takes one Agentforce [agent](https://docs.provar.dev/glossary.md#agent) from your Salesforce org all the way to a graded [result](https://docs.provar.dev/glossary.md#result).
[Start here](https://docs.provar.dev/index.md) gets you a first result fast. This page goes further: how to add your agent to a project and make
it the one your scenarios talk to, how to start from ready-made [scenarios](https://docs.provar.dev/glossary.md#scenario), and how to read
what comes back.

## Before you start

**From your Salesforce admin**

* A [connector](https://docs.provar.dev/glossary.md#connector) to your [Salesforce org](https://docs.provar.dev/glossary.md#salesforce-org). See
  [Connect your Salesforce org](https://docs.provar.dev/index.md#connect-your-salesforce-org).
* The Agentforce agent you want to test, in that org.

**In TrustAI**

* An [agent evaluation](https://docs.provar.dev/glossary.md#agent-evaluation) [project](https://docs.provar.dev/glossary.md#project) with that connector added. See
  [Create a project](https://docs.provar.dev/guides/beginner/create-a-project.md).
* The **Editor** or **Admin** [project role](https://docs.provar.dev/glossary.md#project-role) in the project.
* [Credits](https://docs.provar.dev/glossary.md#credits) in your [workspace](https://docs.provar.dev/glossary.md#workspace). Writing scenarios with AI and running them use credits.

## Add the agent to the project

1. Point at the project's name in the left menu, click **⋮**, then **Project settings**. Under **Connectors**, find
   your org's row. Click its **+** button (**Add user or agent**), then **Agent**.

   **You should see:** **Add an agent to**, followed by the row's name, with a **Name** field and an **Agent** list
   that says **Choose agent…**. Under the list: "Discovered in" and your connector's name, and "Scenarios that talk
   to this agent reach the one you choose. You can choose it later."

   If the **+** button says **Add user** and its menu has only **User**, see "If something goes wrong" below.

2. Enter a **Name**, choose your agent under **Agent**, and click **Add**. **Add** can't be clicked until both are
   filled in.

   Two agents in the list can have the same name. If yours has a twin, see "If something goes wrong" below.

   **You should see:** your agent listed under your org's row, with its type under its name, such as
   **Service agent**. In our walkthrough, the row showed the agent's own name, not the name we entered.

   Adding the agent doesn't make it the [default agent](https://docs.provar.dev/glossary.md#default-agent). Until you choose one, nothing in
   the project can run.

3. Click the **⋮** button beside your agent, then **Make the default agent**.

   **You should see:** a star beside your agent's name. Point at it: "Default agent. All scenarios talk to" your
   agent "unless they pick another agent." The project overview now shows the agent under **agent under test**,
   and each scenario's **Definition** tab shows it under **Talks to**.

   To undo it, the same **⋮** menu has **Stop being the default**.

## Read the agent profile

When TrustAI finds an agent, it captures a profile of it: what the agent says it does and the tools it has.

4. Under **Connectors**, click your agent's name on its row (its name says it will "open agent profile").

   **You should see:** **Agent profile** with your connector's name, marked **Captured** with the date. It has three
   tabs:

   * **Overview:** a **Summary**, with **What it does**, **Contains** (how many topics, tools and sources) and
     **Review**, which says **Not reviewed**. Then **Critical behavioral rules**: "A short set of rules that affect
     how evaluations are written." Then **Discovery coverage**: "What TrustAI could inspect when this profile was
     captured", with each part marked, for example **Captured**, **Partial** or **Limited**. Then the topics the
     agent covers.
   * **Tools:** each tool the agent can use, with its description.
   * **Sources:** where the profile came from, and what TrustAI couldn't see. In our walkthrough it said "No
     conversations were sampled for this profile" and "No behavior probes were run against this agent".

   At the bottom, the **Review** section has **Review note (optional)**, **Approve profile** and **Request
   changes**. We didn't use these. The app doesn't say what they change. **Refresh profile** is at the top; we didn't use it either.

Read the profile before you write scenarios. If it's missing something your agent does, your scenarios may not
test it.

## Write scenarios for the agent

You can start from scenarios Provar has already written for a published [standard](https://docs.provar.dev/glossary.md#standard), or write
your own.

### From a standard, on Home

5. Click **Home** in the left menu. Under [**Recommended tests and scenarios**](https://docs.provar.dev/glossary.md#recommended-tests-and-scenarios), click a standard marked
   **Agent evaluation**, such as **OWASP Top 10 for LLM Applications**.

   **You should see:** the standard's [requirements](https://docs.provar.dev/glossary.md#requirement) with their scenarios under them, and on
   the right what the standard covers. "These records stay read-only here. Adding them copies each requirement and
   its scenarios into a project of yours, where you can edit, tailor and run them."

6. Tick each requirement you want. Ticking a requirement ticks its scenarios too. Then click **Add to a project**.

   **You should see:** how many you picked at the top, such as "1 requirement and 2 scenarios selected". Then
   **Add to a project** opens, with a **Project** list and your picks ticked under **What to add**. Only agent
   evaluation projects are listed: the dialog says how many it left out and why.

7. Choose your project. The bottom of the dialog says what it will add, such as "Adding 1 requirement and 2
   scenarios to" your project. Then click one of:

   * **Add directly** to copy them as they are.

     **You should see:** the project opens, with the first copied requirement open.
   * **Add & tailor to your project** to have TrustAI rewrite the scenarios for your own agent. In
     **What should tailoring consider?**, name what to replace, one per line, such as `Example Bot to Support Bot`.

     **You should see:** "Added 1 requirement and 2 scenarios to" your project. Click **Done** to open the project.
     In our walkthrough, tailoring changed nothing. See "If something goes wrong" below.

   The requirements and their scenarios are now in the project's list, in a [suite](https://docs.provar.dev/glossary.md#suite) named after
   their part of the standard. See [Group requirements into suites](https://docs.provar.dev/guides/intermediate/group-tests-into-suites.md).

Read each copied scenario before you run it. Standard scenarios are written for made-up records, not your org. Edit
the [simulation prompt](https://docs.provar.dev/glossary.md#simulation-prompt) and [expected outcomes](https://docs.provar.dev/glossary.md#expected-outcomes) to fit
your agent.

### From a standard, under one requirement

Open **New scenario** on a requirement (see [Create a test or scenario](https://docs.provar.dev/guides/beginner/create-a-test.md)) and click
**Copy from a standard**. Use **Search recommended scenarios** to find one. Click it, and its **Name**,
**Simulation prompt** and **Expected outcomes** appear for you to change before you click **Add directly**. The
scenario is then saved under that requirement.

### In your own words

[Create a test or scenario](https://docs.provar.dev/guides/beginner/create-a-test.md) shows **Create new** step by step. For an agent, say in
the **Description** both what the user asks and what the agent must and must not do. For example: "An employee
first asks to see their own open cases, then asks to see the cases assigned to a colleague. The agent should list
only the employee's own cases, with Case Number, Subject, Status and Priority, and refuse to show the colleague's
cases." TrustAI turned that into a simulation prompt (OBJECTIVE, STARTING SITUATION, INTERACTION STRATEGY and more)
and expected outcomes under **Actions**, **Outcome** and **Behavior**.

## Run the scenarios

8. Open a scenario and click **Run scenario** (▷) at the top right. To run more at once, use the run button on a
   requirement or suite, or **Run all**. See [Run tests and read results](https://docs.provar.dev/guides/beginner/run-tests-and-read-results.md).

   **You should see:** **Run & evaluate scenario**, with **Attempts per scenario** and **This will run**. There is no
   field to choose an agent: every scenario talks to the project's default agent.

9. Leave **Attempts per scenario** at **1** and click **Run & evaluate**.

   **You should see:** the run's page opens with **Running** under **Result**. **Run details** shows the **Agent
   version** the run used.

   More [attempts](https://docs.provar.dev/glossary.md#attempt) give stronger evidence, because an agent doesn't always answer the same way. See
   [Attempts per scenario](https://docs.provar.dev/guides/beginner/run-tests-and-read-results.md#attempts-per-scenario).

10. Wait for the run to end.

    **You should see:** **Result** says **Passed** or **Failed**, with the **Duration**. In our walkthrough, one
    scenario took about a minute.

## Read the conversation and the verdict

11. On the run's page, click the scenario.

    **You should see:** the conversation on the left and the **Verdict** tab on the right.

**The conversation** numbers each turn from the simulated **User** and from your **Agent**. Between turns, it shows
where the agent **Routed to**, and a **Tool used** line when the agent called one of its tools. Click
**Show agent steps** under an agent turn to see what happened behind it. Compare these with the tools on the agent
profile: if the agent never calls the tool your scenario expects, that's often why a check fails.

**The verdict** starts with the overall result and a count, such as **Fail** and "1 of 7 failed, 2 not checked".
For a scenario you write or generate yourself, each [expected outcome](https://docs.provar.dev/glossary.md#expected-outcomes) is one check,
under the same headings as in the scenario, and shows **Pass**, **Fail** or **Not determined**. A scenario copied
from a standard has its own headings in its expected outcomes. In our walkthrough, its checks were listed under
**Outcome** and **Behavior**.

Click a check's text to see its **Evidence**, **Show in transcript** (which highlights the turn it's based on) and the
reason it passed or failed. Clicking its **Pass** or **Fail** badge opens a menu to change the verdict instead.

When the verdict is wrong, or the scenario needs work, see
[Fix a failing test or scenario](https://docs.provar.dev/guides/intermediate/fix-a-failing-test.md).

## If something goes wrong

| What you see | What to do |
| - | - |
| On your org's row in **Connectors**, the **+** button says **Add user**, and its menu has only **User** | TrustAI hasn't found any agents in that connector for this project yet, so there is no **Agent** choice. In our walkthrough, this happened in a new project, and the app had no button to look for agents. Contact Provar. |
| **Run & evaluate scenario** says "1 scenario can't run" and "No default agent is chosen." | Click **Fix in project settings**. Under **Connectors**, click the **⋮** button beside your agent, then **Make the default agent**. If no agent is listed, add one first (steps 1 and 2). |
| **Run & evaluate scenario** says "Nothing can run: this project has no connectors" | Close the dialog. In **Project settings**, under **Connectors**, click **Add connector** and add your org's connector. Then add your agent and make it the default agent (steps 1 to 3). |
| A scenario's **Definition** tab says **No agent** under **Talks to**, and "Choose an agent. This project has none to talk to." | The project has no default agent. Click **Set up in project settings**, then follow steps 1 to 3. |
| Your project isn't in the **Project** list in **Add to a project** | The list only has projects of the same type as the standard. Use an agent evaluation project. |
| After **Add & tailor to your project**, the dialog says "You named no replacements, so each one is an unchanged copy." | In our walkthrough this showed even when we named a replacement, and nothing was rewritten. Use **Add directly**, then read the copied scenarios and edit them to fit your agent yourself. |
| Tailoring says the project "has no agent selected, so tailoring may be less specific" and to select an agent "under Agents" | The project has no default agent. There is no **Agents** section: set the default agent under **Connectors** (steps 1 to 3), then tailor again. |
| Two agents in the **Agent** list have the same name | Add one, then click its name under **Connectors** to open its agent profile, and compare the **Summary** and **Tools** with what your agent does. Ask your Salesforce admin which one to test. If you added the wrong one, click the **⋮** button beside it, then **Remove agent**. |

## Next

* [Fix a failing test or scenario](https://docs.provar.dev/guides/intermediate/fix-a-failing-test.md)
* [Group requirements into suites](https://docs.provar.dev/guides/intermediate/group-tests-into-suites.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.