Test tools and refine agent behavior
After adding a tool, test whether the agent selects it at the right time, sends the right information, and uses the result correctly. The same basic approach works for connector, Model Context Protocol (MCP), and workflow tools.
Test a tool in Preview
Start a new conversation in Preview, and then submit a request that clearly requires the tool. Open the activity details and check that:
- The agent selects the expected tool.
- The tool receives the expected inputs.
- The tool completes without an authentication or connection error.
- The agent uses the returned information in its response.
Next, submit a request that shouldn't use the tool. This second test helps confirm that the tool's name and description aren't too broad.
Some checks depend on the tool type:
| Tool type | What else to check |
|---|---|
| Connector tool | Fixed values remain unchanged, and the agent gets request-specific values from the conversation or asks the user for them. |
| MCP tool | The agent selects the correct tool from the server and sends the inputs defined by the server. |
| Workflow tool | The workflow receives its required inputs, runs the expected steps, and returns the expected output. |
If a test fails, use the activity details to find the step that needs attention.
Diagnose the observed failure
Use Preview to repeat a prompt and inspect the activity information. Classify the failure before you edit the agent.
| Observed behavior | First component to inspect |
|---|---|
| The response uses an unrelated or outdated source. | Knowledge source content, scope, and description. |
| The response uses the right source but violates a general boundary. | Agent instructions. |
| The wrong external operation runs. | Tool name and description. |
| The right tool runs with a missing or incorrect value. | Tool input description and fill method. |
| A valid task doesn't activate a skill. | Skill description. |
| A skill activates but skips a required step. | Skill instructions. |
Make one focused change, start a new Preview conversation, and rerun the same prompt. Then test a nearby case that should remain unchanged. This comparison shows whether the refinement fixes the target behavior without creating a regression.
Use explicit completion criteria
Define expected behavior before testing. For a recommendation agent, completion criteria might require the response to:
- Cite the applicable policy.
- Use current inventory results.
- Explain how the recommendation meets the user's requirements.
- Avoid recommending an item that is unavailable.
- State what information is missing instead of inventing it.
Wording can vary between generative responses. Evaluate the evidence, the building blocks that the agent selected, and the outcome instead of looking for an exact sentence.