testing-agentforce

Verify Agentforce agent behavior with smoke and regression tests via sf CLI.

803|289|Updated Nov 7, 2025
One-click install
npx skills add https://github.com/forcedotcom/sf-skills --skill testing-agentforce-forcedotcom
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-agentforce
Source: https://github.com/forcedotcom/sf-skills/tree/main/skills/testing-agentforce
Command: npx skills add https://github.com/forcedotcom/sf-skills --skill testing-agentforce-forcedotcom

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

It solves the problem of verifying that an Agentforce agent reliably routes intents, invokes the right actions, grounds responses, and passes safety expectations before you ship changes.

Core Features & Use Cases

  • Preview-based smoke testing: Run fast, ad-hoc checks with sf agent preview and local trace artifacts to diagnose routing, grounding, safety score, and action visibility.
  • Testing Center batch regression testing: Create and run persistent suites with sf agent test create, sf agent test run, and sf agent test results using a structured YAML spec.
  • Action execution isolation: Directly invoke Flow/Apex actions via REST to test a single action safely and deterministically, then validate end-to-end behavior.
  • Iterative fix loop: Use trace-driven failure diagnosis and targeted edits with a max 3-iteration workflow to converge on passing tests.

Quick Start

Run a Mode B regression suite by creating a test spec YAML (with name, subjectType: AGENT, subjectName, and testCases), then deploy it with sf agent test create and execute it with sf agent test run to get structured results for every test case.

Frequently Asked Questions about testing-agentforce

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run regression testing for Agentforce agents before deploying changes?

Run regression testing by creating a structured YAML test spec and deploying it with `sf agent test create` to verify routing, action invocation, grounding, and safety. Execute the suite using `sf agent test run` to receive structured results for every test case.

What is the best way to diagnose Agentforce routing and grounding failures from preview traces?

Diagnose routing and grounding failures by running `sf agent preview` to generate local trace artifacts. Analyze the trace steps to identify routing issues, grounding errors, safety scores, and action visibility, then apply targeted edits in an iterative fix loop.

Can I isolate and test a single Flow or Apex action invoked by an agent?

Yes, you can directly invoke Flow or Apex actions via REST to test a single action safely and deterministically. This action execution isolation validates the individual action's behavior before validating the full end-to-end agent behavior.

How do I create a batch test suite in Testing Center for an Agentforce agent?

Create a batch test suite by defining a YAML spec with `name`, `subjectType: AGENT`, `subjectName`, and `testCases`. Deploy the spec using the `sf agent test create` CLI command, then execute it with `sf agent test run` to get structured results.

How does safety evaluation work when verifying Agentforce agent behavior?

Safety evaluation works by producing explicit safety verdicts during both ad-hoc preview checks and persistent batch regression suites. The testing process evaluates agent responses against safety expectations to ensure they pass before you ship changes.

What should I do when my Agentforce test suite fails during the iterative fix loop?

When a test suite fails, use trace-driven failure diagnosis from the preview or batch test results to identify the root cause. Apply targeted edits to the agent and rerun tests, converging on passing tests within a maximum 3-iteration workflow.