sf-ai-agentforce-testing
jaganpro/sf-skills
Test Salesforce Agentforce agents with multi-turn API and CLI workflows, coverage analysis, and 100-point scoring.
What is sf-ai-agentforce-testing?
Formal testing skill for Agentforce agents after deployment. Use this when validating multi-turn conversations, topic routing, action invocation, guardrails, and escalation behavior. Supports both Agent Runtime API testing (Track A) and CLI Testing Center workflows (Track B).
- Execute multi-turn conversation tests via Agent Runtime API with ECA authentication
- Run CLI Testing Center specs with `sf agent test` commands for org-native validation
- Generate and analyze test specs covering topics, actions, guardrails, and context preservation
- Validate topic routing, action invocation, escalation, and off-topic handling across turns
- Classify test failures into root-cause buckets (topic mismatch, action failure, context loss, etc.)
- Integrate with fix loops: delegate agent authoring to sf-ai-agentscript, data setup to sf-data, and observability to sf-ai-agentforce-observability
How to install sf-ai-agentforce-testing
npx skills add https://github.com/jaganpro/sf-skills --skill sf-ai-agentforce-testing- Agent must be published and activated in target org
- API v66.0+ (Spring '26) and Agentforce enabled in the org
- For Track A (multi-turn API): ECA credentials and Agent Runtime API access configured
- For Track B (CLI Testing Center): org must support Agent Testing Center; standard `sf org login web` auth
- Target org alias configured in Salesforce CLI
How to use sf-ai-agentforce-testing
- 1.Gather required context: agent API name, target org alias, testing goal, and publish/activation state
- 2.Discover the agent in the target org and verify dependencies (Flows, Apex, data)
- 3.Choose testing track: Track A for multi-turn conversation validation, Track B for CLI Testing Center specs
- 4.Plan test coverage: main topics, expected actions, guardrails, escalation, and phrasing variations
- 5.Execute the chosen track using provided scripts under ~/.claude/skills/sf-ai-agentforce-testing/hooks/scripts/
- 6.Classify failures into root-cause buckets and report results with coverage gaps and next steps
- 7.Delegate agent fixes to sf-ai-agentscript, republish/reactivate, and rerun focused tests
Use cases
- Smoke-test a newly published Agentforce agent to verify core topics and actions work
- Run regression tests after agent updates to ensure topic routing and guardrails still function
- Expand test coverage by validating phrasing variations, edge cases, and escalation scenarios
- Reproduce reported bugs by replaying multi-turn conversations and analyzing per-turn failures
- Validate action invocation chains and context preservation across multiple conversation turns
- Salesforce developers testing Agentforce agents post-publish/activate
- QA engineers validating agent behavior and coverage before production
- Platform engineers integrating agent testing into CI/CD pipelines
- Architects analyzing agent test results and planning fix loops
sf-ai-agentforce-testing FAQ
Use sf-ai-agentforce-testing for validating agents after publish/activate. Use sf-ai-agentscript when you need to edit the agent itself (Agent Script logic, topics, actions). Testing comes after authoring.
Track A (multi-turn API) tests conversation continuity, context preservation, and topic re-matching across turns; requires ECA setup. Track B (CLI Testing Center) runs org-native YAML specs with `sf agent test`; simpler but single-utterance focused.
No. ECA is only required for Track A (Agent Runtime API multi-turn testing). Track B (CLI Testing Center) and preview workflows use standard `sf org login web` authentication.
Classify the failure (topic mismatch, action failure, context loss, etc.), then delegate agent fixes to sf-ai-agentscript if needed. Republish/reactivate and rerun focused tests before full regression.
No. Testing must happen after the agent is published and activated. Use preview workflows for manual validation during authoring, then switch to formal testing post-publish.
Full instructions (SKILL.md)
Source of truth, from jaganpro/sf-skills.
name: sf-ai-agentforce-testing description: > Agentforce agent testing with dual-track workflow and 100-point scoring. TRIGGER when: user tests Agentforce agents, runs sf agent test commands, creates test specs, validates topic routing, or analyzes agent test coverage. DO NOT TRIGGER when: Apex unit tests (use sf-testing), building agents (use sf-ai-agentforce), or Agent Script DSL (use sf-ai-agentscript). license: MIT compatibility: "Requires API v66.0+ (Spring '26) and Agentforce enabled org" metadata: version: "2.1.0" author: "Jag Valaiyapathy" scoring: "100 points across 7 categories"
sf-ai-agentforce-testing: Agentforce Test Execution & Coverage Analysis
Use this skill when the user needs formal Agentforce testing: multi-turn conversation validation, CLI Testing Center specs, topic/action coverage analysis, preview checks, or a structured test-fix loop after publish.
When This Skill Owns the Task
Use sf-ai-agentforce-testing when the work involves:
sf agent testworkflows- multi-turn Agent Runtime API testing
- topic routing, action invocation, context preservation, guardrail, or escalation validation
- test-spec generation and coverage analysis
- post-publish / post-activate test-fix loops
Delegate elsewhere when the user is:
- building or editing the agent itself → sf-ai-agentforce or sf-ai-agentscript
- running Apex unit tests → sf-testing
- creating seed data for actions → sf-data
- analyzing session telemetry / STDM traces → sf-ai-agentforce-observability
Core Operating Rules
- Testing comes after deploy / publish / activate.
- Use multi-turn API testing as the primary path when conversation continuity matters.
- Use CLI Testing Center as the secondary path for single-utterance and org-supported test-center workflows.
- Interactive and programmatic CLI preview use standard
sf org login webauthentication; ECA is only required for Agent Runtime API testing, not for live preview. - Fixes to the agent should be delegated to sf-ai-agentscript when Agent Script changes are needed.
- Do not use raw
curlfor OAuth token validation in the ECA flow; use the provided credential tooling.
Script path rule
Use the existing scripts under:
~/.claude/skills/sf-ai-agentforce-testing/hooks/scripts/
These scripts are pre-approved. Do not recreate them.
<a id="phase-0-prerequisites--agent-discovery"></a>
Required Context to Gather First
Ask for or infer:
- agent API name / developer name
- target org alias
- testing goal: smoke test, regression, coverage expansion, or bug reproduction
- whether the agent is already published and activated
- whether the org has Agent Testing Center available
- whether ECA credentials are available for Agent Runtime API testing
Preflight checks:
- discover the agent
- confirm publish / activation state
- verify dependencies (Flows, Apex, data)
- choose testing track
Dual-Track Workflow
Track A — Multi-turn API testing (primary)
Use when you need:
- multi-turn conversation testing
- topic re-matching validation
- context preservation checks
- escalation or action-chain analysis across turns
Requires:
- ECA / auth setup
- agent runtime access
Track B — CLI Testing Center (secondary)
Use when you need:
- org-native
sf agent testworkflows - test spec YAML execution
- quick single-utterance validation
- CLI-centered CI/CD usage where Testing Center is available
Quick manual path
For manual validation without full formal testing, use preview workflows first, then escalate to Track A or B as needed.
Recommended Workflow
1. Discover and verify
- locate the agent in the target org
- confirm it is published and activated
- confirm required actions / Flows / Apex exist
- decide whether Track A or Track B fits the request
2. Plan tests
Cover at least:
- main topics
- expected actions
- guardrails / off-topic handling
- escalation behavior
- phrasing variation
3. Execute the right track
Track A
- validate ECA credentials with the provided tooling
- retrieve metadata needed for scenario generation
- run multi-turn scenarios with the provided Python scripts
- analyze per-turn failures and coverage
Track B
- generate or refine a flat YAML test spec
- run
sf agent testcommands - inspect structured results and verbose action output
4. Classify failures
Typical failure buckets:
- topic not matched
- wrong topic matched
- action not invoked
- wrong action selected
- action invocation failed
- context preservation failure
- guardrail failure
- escalation failure
5. Run fix loop
When failures imply agent-authoring issues:
- delegate fixes to sf-ai-agentscript
- re-publish / re-activate if needed
- re-run focused tests before full regression
Testing Guardrails
Never skip these:
- test only after publish/activate
- include harmful / off-topic / refusal scenarios
- use multiple phrasings per important topic
- clean up sessions after API tests
- keep swarm execution small and controlled
Avoid these anti-patterns:
- testing unpublished agents
- treating one happy-path utterance as coverage
- storing ECA secrets in repo files
- debugging auth with brittle shell-expanded
curlcommands - changing both tests and agent simultaneously without isolating the cause
Output Format
When finishing a run, report in this order:
- Test track used
- What was executed
- Pass/fail summary
- Coverage gaps
- Root-cause themes
- Recommended fix loop / next test step
Suggested shape:
Agent: <name>
Track: Multi-turn API | CLI Testing Center | Preview
Executed: <specs / scenarios / turns>
Result: <passed / partial / failed>
Coverage: <topics, actions, guardrails, context>
Issues: <highest-signal failures>
Next step: <fix, republish, rerun, or expand coverage>
Cross-Skill Integration
| Need | Delegate to | Reason |
|---|---|---|
| fix Agent Script logic | sf-ai-agentscript | authoring and deterministic fix loops |
| create test data | sf-data | action-ready data setup |
| fix Flow-backed actions | sf-flow | Flow repair |
| fix Apex-backed actions | sf-apex | Apex repair |
| set up ECA / OAuth for Agent Runtime API | sf-connected-apps | auth and app configuration |
| analyze session telemetry | sf-ai-agentforce-observability | STDM / trace analysis |
Reference Map
Start here
- references/interview-wizard.md
- references/multi-turn-testing.md
- references/cli-commands.md
- references/test-spec-reference.md
Execution / auth
- references/execution-protocol.md
- references/multi-turn-execution.md
- references/eca-setup-guide.md
- references/credential-convention.md
- references/connected-app-setup.md
Coverage / fix loops
- references/coverage-analysis.md
- references/agentic-fix-loops.md
- references/results-scoring.md
- references/known-issues.md
Advanced / specialized
- references/agentscript-agents.md
- references/agentscript-testing-patterns.md
- references/cli-testing-details.md
- references/deep-conversation-history-patterns.md
- references/swarm-execution.md
- references/trace-analysis.md
- references/agent-api-reference.md
Templates / assets
Score Guide
| Score | Meaning |
|---|---|
| 90+ | production-ready test confidence |
| 80–89 | strong coverage with minor gaps |
| 70–79 | acceptable but coverage expansion recommended |
| 60–69 | partial validation only |
| < 60 | insufficient confidence; block release |
Related skills
More from jaganpro/sf-skills and the wider catalog.

sf-ai-agentscript
Code-first DSL for deterministic Salesforce Agentforce agents with FSM-based routing and slot filling.

sf-apex
Generate and review production Salesforce Apex code with 150-point quality scoring.

sf-connected-apps
Salesforce OAuth and Connected Apps configuration with security hardening and ECA/legacy support.

sf-data
Salesforce data CRUD, bulk import/export, and test data generation with CLI-first workflows.

sf-datacloud
>

sf-datacloud-act
>