How to Test and Monitor Agentforce Agents (Testing Center Guide)
How to test Agentforce agents with Testing Center, custom scorers, and conversation tests, then monitor them in production with Agent Health Monitoring.
An Agentforce agent that works in a demo tells you almost nothing about how it'll behave on the ten-thousandth conversation. Agents are non-deterministic: the same question can take a different path tomorrow because a prompt changed, a record changed, or the model was updated. That's why "it worked when I tried it" isn't a release criterion.
Salesforce spent 2026 turning agent testing and monitoring into real tooling, built around Agentforce Testing Center. The order matters: test before launch, monitor after launch, then improve with data.
The Agentforce Testing and Observability Toolkit
| Tool | When you use it | Status (as announced) |
|---|---|---|
| Testing Center | Before every release | Available in Agentforce Studio |
| Custom Scorers | Grading quality your way | API GA, UI Beta (Dreamforce 2026) |
| Conversation and Voice Testing | Multi-turn and voice scenarios | Beta (Dreamforce 2026) |
| Agent Health Monitoring | Production, continuously | GA (Dreamforce 2026) |
| A/B Experimentation | Comparing agent variants live | Beta (October 2026) |
| Agent Optimizer | Finding recurring failures | GA (October 2026) |
Users who build and run tests need the Manage Agentforce Testing permission (API name PermissionsAITestingUser).
Agentforce Testing Center: Your Pre-Launch Gate
Testing Center lives in Agentforce Studio as its own tab next to the agent builder and Observability, and it works with agents built in both the legacy and current builders. A test case pairs a user utterance with what should happen: which subagent (topic) the agent picks, which action it calls, and what a good response looks like.
What changed in 2026, per Salesforce:
- AI-generated test cases you can edit inline in a grid, instead of downloading and re-uploading CSV files
- Run history so you can compare results across versions
- A JSON viewer showing scores, pass/fail, the LLM judge's reasoning, and the full execution trace: which subagent was selected, which action ran, its inputs and outputs, and latency per step
The execution trace is the most useful part. When a test fails, you can see whether the agent misunderstood the request (wrong subagent), chose the wrong tool (wrong action), or did the right thing and phrased it badly (response quality). Each one has a different fix.
Build Your First Suite From Real Traffic
Don't start with invented questions. Start with the 20 to 30 most common things real users ask, which you can pull from your existing bot (if you're upgrading an Einstein Bot, its intents are a ready-made list), chat transcripts, or case subjects. For each:
- Write two or three phrasings (formal, casual, and one with a typo)
- Set the expected subagent and action
- Describe what a correct response must include
Then add three categories most teams skip:
- Off-topic requests the agent should decline
- Ambiguous requests where the agent should ask a clarifying question
- Adversarial prompts that try to make the agent ignore its instructions or reveal data
Custom Scorers: Grade What Matters to You
Built-in evaluations check things like topic and action selection. Custom scorers let you define your own criteria in plain language, describe what each score level means, add example responses, and set a pass threshold. Salesforce's example is rating politeness from 0 to 5. Scorer output isn't limited to pass/fail; it can be free text, a number, yes/no, or a category you define.
Good custom scorers are narrow. "Is this response good?" is useless. These work:
- "Does the response include the order number the customer provided?"
- "Does the response promise a refund? (Agents must never promise refunds.)"
- "Is the response under 80 words?"
Conversation and Voice Testing
Single-turn tests miss the failures that happen on turn four: the agent forgets the account it was discussing, or loops between two subagents. Conversation testing simulates full multi-turn conversations using personas such as a frustrated customer, a non-native English speaker, or a distracted user, and scores them on metrics like task resolution (did the agent complete the original request?). It also works for voice agents, and you can play back the generated audio.
Run Agentforce Tests From the Command Line
For teams using source control, tests can run in CI. Test suites deploy to the org as AiEvaluationDefinition metadata. Salesforce's agentforce-test skill (part of its open-source agent skills library) documents this workflow:
# Create the suite in the org from a YAML spec
sf agent test create --json --spec test-spec.yaml --api-name MySuite -o my-org
# Run it and wait for results
sf agent test run --json --api-name MySuite --wait 10 --result-format json -o my-org
These command names match the official Salesforce CLI reference, which also lists sf agent test results, resume, and list. You need a recent CLI: the skill requires version 2.121.7 or later, and older versions don't include the agent commands at all (ours, 2.61.8, returned "Command agent not found"). Run sf update first.
Wire the run into your pipeline so a deployment fails when the suite fails. Salesforce also connects the CLI to DevOps Testing Center so a failing suite can block a deployment.
Agent Health Monitoring: Catch Silent Failures
Testing proves an agent worked on the cases you thought of. Monitoring tells you when it stops working on the ones you didn't.
Agent Health Monitoring is part of the Observability tools in Agentforce Studio. When Salesforce introduced it, the core metrics were:
- Agent error rate: the share of responses that fail, including action and LLM errors
- Average interaction latency: time from request to response
- Escalation rate: the share of sessions handed to a human
At Dreamforce 2026 Salesforce said it now covers 16+ built-in reliability metrics plus custom metrics. You set thresholds, alerts go out by email, and a default 30-minute cooldown keeps one bad hour from flooding your inbox. Alerts link to session traces so you can see exactly which conversations went wrong.
A prerequisite that's easy to miss: monitoring is built on session trace data, and Agentforce Session Tracing is off by default. In our test org, the setting (agentforceSTDMEnabled in AgentforceSessionTracingSettings) was false. Session traces are written to a Data 360 data space, so you need Data 360 provisioned. You turn tracing on under Einstein Audit, Analytics, and Monitoring in Setup, after which data is collected every five minutes. Turn it on before you need it: traces don't exist for conversations that happened while it was off.
What to Alert On First
These thresholds are our suggested starting points, not Salesforce defaults. Tune them to your baseline after a few weeks.
- Escalation rate jumping more than 10 points above your baseline: usually a broken action or a new question type
- Error rate above 2%: almost always an action failing (an expired credential, a changed Flow, a validation rule)
- Latency above your channel's tolerance: voice needs to be much faster than email
A/B Experimentation and Agent Optimizer
Once an agent is stable, improve it with evidence instead of opinion.
A/B Experimentation (Beta) runs agent variants side by side in Agentforce Builder, splitting traffic across cohorts and comparing results in a scorecard. Test one change at a time: a rewritten instruction, a new action, a different subagent split.
Agent Optimizer analyzes production sessions to find and rank recurring failures, and can generate subagents and actions to address them. Treat its suggestions as proposals that go through your test suite like any other change.
A Testing Routine That Holds Up
- Before launch: suite of 50+ cases, including off-topic and adversarial, passing at your agreed threshold
- Every change: run the suite automatically; block release on failure
- Week one live: daily review of escalation and error rate; turn every real failure into a new test case
- Ongoing: alerts on the three core metrics, monthly review of Optimizer findings, one A/B experiment at a time
This is the discipline that separates agents that reach production from the ones that stall. Our analysis of why Agentforce pilots fail and our ROI benchmarks both come back to it: you can't scale what you can't measure.
Frequently Asked Questions
How do I test an Agentforce agent before going live? Build a test suite in Agentforce Testing Center with expected subagents, actions, and responses for real user utterances, then run it on every change. Add conversation tests and custom scorers for quality checks a single turn can't catch.
What is Agentforce Agent Health Monitoring? Always-on monitoring for production agents in Agentforce Studio's Observability tools. It tracks metrics like error rate, latency, and escalation rate, and sends alerts when a metric crosses a threshold you set.
Can I run Agentforce tests from the command line? Yes. The Salesforce CLI's agent test commands create a test suite from a YAML spec and run it, returning JSON results you can use as a CI/CD quality gate. Test suites deploy as AiEvaluationDefinition metadata.
What permission do users need to run Agentforce tests? Users need the Manage Agentforce Testing permission, which appears on permission sets with the API name PermissionsAITestingUser. Grant it through a permission set to the admins and developers who maintain agents.
Keep reading:
📬 Enjoyed this article?
Subscribe to our free weekly digest — AI tools, Salesforce tips, and prompts every week.