sf-ai-agentforce-testing

Tests Salesforce Agentforce agents via CLI test specs and multi-turn Agent Runtime API scenarios.

1|Updated May 7, 2026
One-click install
npx skills add https://github.com/amanpraaj/sf-skill-hub --skill sf-ai-agentforce-testing-amanpraaj
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sf-ai-agentforce-testing
Source: https://github.com/amanpraaj/sf-skill-hub/tree/main/skills/salesforce/sf-ai-agentforce-testing
Command: npx skills add https://github.com/amanpraaj/sf-skill-hub --skill sf-ai-agentforce-testing-amanpraaj

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pyyaml, rich, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve? Validating Agentforce agents after publish is hard: topic routing, action invocation, guardrails, and context preservation all need structured testing, and failures require root-cause analysis before fixes can be applied. This Skill provides a dual-track testing workflow with coverage scoring and automated test-fix loops. ## Core Features & Use Cases - Dual-Track Test Execution: Run multi-turn conversation tests through the Agent Runtime API (Track A) or org-native sf agent test CLI Testing Center specs (Track B), with interactive preview as a quick manual path. - Test Spec Generation & Coverage Analysis: Generate YAML test specs from .agent files, analyze topic selection and action invocation coverage, and score results on a 100-point scale. - Agentic Fix Loop: Classify failures into categories (topic not matched, wrong action, guardrail failure, context loss), delegate fixes to sf-ai-agentscript, re-publish, and re-test up to 3 iterations. - Use Case: After publishing a customer support agent, run multi-turn scenarios to verify it preserves context across turns, escalates on frustration, and invokes the correct Flow actions—then automatically fix and re-test any failures. ## Quick Start Ask the AI to run agent tests for your published Agentforce agent in a target org and report coverage gaps and failures.

Frequently Asked Questions about sf-ai-agentforce-testing

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

FAQPage Schema
How do I run tests for a Salesforce Agentforce agent?▼

Use `sf agent test run --api-name <AgentName> --wait 10 --result-format json` against an org with Agent Testing Center enabled. For multi-turn conversation testing, use the Agent Runtime API with an External Client App for Client Credentials authentication.

How do I test multi-turn conversations with Agentforce agents?▼

Use the Agent Runtime API (api.salesforce.com/einstein/ai-agent/v1) to create a session, send messages with incrementing sequenceId values, and validate context preservation across turns. The CLI Testing Center only supports single-utterance tests.

Does sf agent test work without Agent Testing Center enabled?▼

No, `sf agent test create` and `run` require the Agent Testing Center feature in the org. As a fallback, use `sf agent preview` for interactive testing or the Agent Runtime API, which does not require AiEvaluationDefinition metadata.

Why does my Agent Script agent test only capture the transition action?▼

Single-utterance CLI tests have a one-action-per-reasoning-cycle budget, and the first cycle is consumed by the topic transition (go_<topic>). Use conversationHistory in the test spec to pre-position the agent in the target topic so the business action fires.

What causes silent action failures in Agentforce agent tests?▼

Apex classes using WITH USER_MODE return zero rows without errors when the Einstein Agent User lacks object permissions. Create a Permission Set granting read access to queried objects and assign it to the default_agent_user.