For AI agents and LLMs: a machine-readable index is available at llms.txt. A plain-Markdown version of any documentation page is available by appending .md to its URL.
Skip to main content

How to Test Salesforce Agentforce Voice Agents With TestMu AI

Salesforce Agentforce agents are built in Agent Builder, and with Agentforce Voice they answer calls on a phone number routed to the agent. The TestMu AI Agent Testing Platform tests an Agentforce voice agent as the agent under test (AUT): TestMu AI calls the Agentforce agent from a Phone Caller agent, holds a conversation, and grades the result. Connect the agent's Salesforce org, and TestMu AI also imports the agent's prompt and actions and verifies which tools the agent called during each test call.

To connect one, you need an Agentforce agent with an active version, an External Client App in your Salesforce org with a user it can run as, and a TestMu AI project to hold the agent under test. To place test calls and verify tool calls, you also need Agentforce Voice with a phone number routed to the agent, and Data Cloud with Agentforce session tracing turned on. See Prerequisites.

The Salesforce setup is usually done by your Salesforce admin. Connecting the agent and running the tests are done in TestMu AI by whoever runs the tests. Troubleshooting and a short set of verification queries are at the end.

What does the Agentforce integration add to your tests?​


A call transcript shows what the agent said, not which tools it ran. Once the integration is connected, TestMu AI reads the agent's definition and its session traces from Salesforce.

CapabilityWhat it means for you
Prompt syncThe agent's topics, instructions, and agent script are pulled from Salesforce into the agent's Prompt page, so scenario generation knows what the agent is supposed to do.
Tool catalogThe agent's actions, for example LookupCustomer or GetOrderStatus, appear in the scenario editor, so you can state which tools a scenario expects the agent to call.
Tool call validationAfter each call, TestMu AI fetches what the agent actually did from Salesforce and marks each expected tool as Called or Not Called.

TestMu AI offers this kind of integration for ElevenLabs, Retell, Vapi, and Salesforce Agentforce. For the others, see the ElevenLabs integration, the Retell integration, and the Vapi integration.

Timing to Expect​

EventWhen
Transcript, recording, verdict, and gradingSeconds after each call ends.
Tool callsAbout 6 to 10 minutes after the call ends. Salesforce delivers agent traces to Data Cloud in a single batch, and this delay is on the Salesforce side, not in TestMu AI.
Tool call verification timeoutIf no trace has appeared 35 minutes after the call ended, that call's tool calls are marked unverified. See Troubleshooting.

What do you need before you start?​


In Salesforce​

  • An Agentforce agent built in Agent Builder, with an active (published) version.
  • Agentforce Voice provisioned for the org, with a phone number routed to the agent. Call the number from your own phone first: the agent must answer and hold a conversation.
  • Data Cloud enabled, with Agentforce session tracing turned on. TestMu AI reads the agent's sessions and tool calls from Data Cloud. Without it, tool call validation can never complete.
  • Permission to create an External Client App (typically System Administrator), and a user the app can run as.
note

Provisioning voice, routing the number, and enabling session tracing are Salesforce-side tasks for your Salesforce admin and account team. Follow Salesforce's documentation for your release. This guide covers only what TestMu AI needs from Salesforce.

You can connect before voice is ready. Saving the credentials, the prompt sync, and the tool catalog need only the agent and the External Client App. Placing calls and verifying tool calls also need the agent to be reachable by phone, with session tracing turned on.

In TestMu AI​

  • A project to hold the agent under test.

How do you set up Salesforce for TestMu AI?​


Your Salesforce admin usually completes these steps in Salesforce.

Find the Agent Identifier​

In Agent Builder, check that the agent's status is Active, then note one of the following:

  • The agent's API name (developer name), for example support_agent. This is the recommended option.
  • The agent's record ID, an 18-character ID that begins with 0Xx.

Either one works as the Agentforce Agent ID in TestMu AI. Salesforce record IDs start with a three-character prefix that identifies the object type, and for Agentforce agents that prefix is 0Xx. TestMu AI treats anything else you enter as an API name.

TestMu AI resolves the identifier to the agent's active version. Only that version's prompt and actions are imported.

You can run the integration as an existing administrator, but a dedicated user with only the following access is safer and easier to audit.

AccessUsed for
API EnabledAll TestMu AI access to Salesforce is through the API.
View Setup and ConfigurationReading the agent definition (prompt and actions).
Read on the agent objects (BotDefinition, BotVersion)Resolving the Agent ID to its active version.
Read on VoiceCall (Service Cloud Voice)Tying each phone call to its agent session.
Query access to the Agentforce session tracing objects in Data Cloud: ssot__AiAgentSession__dlm, ssot__AiAgentInteraction__dlm, and ssot__AiAgentInteractionStep__dlmReading the agent's sessions and tool calls.

TestMu AI only ever reads from Salesforce. It never creates, edits, or deletes records, and it does not talk to the agent through the Agent API.

To confirm that this access is in place, run the verification queries as the integration user.

Create the External Client App​

  1. In Salesforce, go to Setup → Quick Find → External Client App Manager → New External Client App.
  2. Enter a name and a contact email for the app, and set Distribution State to Local.
  3. Under the OAuth settings:
    • Enable OAuth. The form requires a callback URL, but this flow does not use it, so any https:// URL works.
    • Select the scopes: at minimum Manage user data via APIs (api), plus the Data Cloud query scope, Perform ANSI SQL queries on Data Cloud data (cdp_query_api).
    • Enable the Client Credentials Flow.
  4. Save the app. Then open the app's Policies and, under the Client Credentials Flow, set Run As to the integration user.
  5. Open the app's Settings → OAuth Settings and reveal the Consumer Key and Consumer Secret.
warning

Treat the consumer secret like a password. Copy it straight into TestMu AI when you connect Agentforce. Do not paste it into chat, tickets, or documents. If it is ever exposed, rotate it on this same screen and save the new secret in TestMu AI.

Collect the Four Values​

Field in TestMu AIWhere it comes fromExample
Your org's My DomainYour org's My Domain URL, without a trailing slash. For a sandbox, use the sandbox My Domain.https://yourorg.my.salesforce.com or https://yourorg--uat.sandbox.my.salesforce.com
Consumer KeyExternal Client App → OAuth SettingsA long alphanumeric string
Consumer SecretExternal Client App → OAuth SettingsHidden
Agentforce Agent IDAgent Builder. See Find the Agent Identifier.support_agent, or an 18-character ID that begins with 0Xx

Only a Salesforce My Domain (https://…my.salesforce.com) is accepted for Your org's My Domain. Login hosts, Lightning hosts, and any other URL are rejected when you save.

How do you connect an Agentforce agent to TestMu AI?​


Complete these steps in TestMu AI.

Create the Phone Caller Agent​

In your project, create a Phone Caller agent, or open an existing one, with the direction Inbound (Bot receives calls). TestMu AI places the calls, and the Agentforce agent answers them.

In the agent's phone number field, enter the phone number routed to the Agentforce agent (see Prerequisites) in international format: a +, then the country code and the number, for example +14155550100. A number in any other form cannot be dialed. TestMu AI dials this number for every scenario.

Connect Agentforce​

  1. Open the agent and go to Voice Integrations.
  2. On the Agentforce tile, "Connect your Salesforce Agentforce agent for voice-call and tool-call testing", enter the four values from Salesforce:
    • Your org's My Domain
    • Consumer Key
    • Consumer Secret
    • Agentforce Agent ID
  3. Select Save.

When you save, TestMu AI confirms the credentials with Salesforce, resolves the Agent ID to the agent's active version, pulls that version's instructions into the Prompt page, and builds the tool catalog from its actions.

A message confirms the result:

MessageWhat it means
Prompt and tools imported from AgentforceThe prompt and the tool catalog were imported.
Existing project prompt kept; Agentforce tools synchronizedThe project already had a prompt, so TestMu AI kept it and synchronized the tools.
Could not sync Agentforce: followed by the reasonA step failed. See Troubleshooting.

TestMu AI stores the credentials encrypted. After you save, the page shows that a key and secret are saved, with the fields reading saved — enter to replace, but never displays them again. To change them, enter new values and select Save.

Check the Synced Prompt​

Open the agent's Prompt page. You should see the agent's topics, their instructions, and the agent script as plain text. Scenario generation uses this prompt to understand the agent.

  • Sync from Agentforce pulls the prompt from Salesforce again, after you confirm. Use it after you change the agent in Agent Builder.
  • Save keeps whatever is in the editor. It does not overwrite your edits with the Salesforce version.

Check the Tool Catalog​

Open any scenario in the agent, or create one, and look for the Agentforce Tools (Optional) section in the scenario editor. It lists the agent's actions as they are named in Salesforce, each with a checkbox.

If the section is empty, the sync found no actions on the active agent version. Confirm that the agent has actions, then save the integration again.

How do you run Agentforce tests and read the results?​


Select the Expected Tools for Each Scenario​

Generate scenarios from the synced prompt, or write them by hand. For each scenario where you want the agent's tool use checked:

  1. Open the scenario and expand Agentforce Tools (Optional).
  2. Select the checkbox for each tool that the scenario expects the agent to call.

Every selected tool is expected: the scenario's tool check passes only if the agent called all of them. Scenarios with no tools selected still run normally, but they do not get a tool call check.

note

If the agent's actions change in Salesforce, save the integration again. Tools that you selected earlier but that no longer exist are listed in a yellow notice in this section. Clear their checkboxes.

Run the Suite​

Run the suite as you would for any other Phone Caller agent. See inbound phone agent testing for scenarios, test suites, and live calls.

When Results Appear​

In the resultsTimingNotes
Transcript, recording, verdict, and gradingAs each call endsIndependent of Salesforce.
Tool Calls tabAbout 6 to 10 minutes after the call endsReads Tool calls are pending until the Salesforce trace batch lands. The page polls for you.

Read the Tool Calls Tab​

SectionWhat it shows
Expected Tool ValidationEach tool you selected on the scenario, with its outcome: Called, Not Called, Pending (still waiting for the trace), or Unverified (the trace never arrived, or TestMu AI could not tell with certainty which session belonged to this call). See Tool Call Statuses.
AUT CorrelationThe AUT call ID: the Salesforce agent session that this call was matched to, in case you want to look it up in Salesforce.
Selected AUT Tool CallsThe agent's actual calls to the tools you selected.
AUT Tool CallsEvery action the agent ran during the call, exactly as Salesforce recorded it: tool name, outcome, input arguments, output, and the time it ran.
tip

A run with zero tool calls is not necessarily an error. If the scenario never gave the agent what it needed, for example the caller refused to provide the account details the agent asked for, the agent correctly did not call its lookup tools, and Not Called on an expected tool is the finding you wanted.

Tool Call Statuses​

What you seeMeaningWhat to do
Tool calls are pendingTestMu AI is waiting for the Salesforce trace batch. This is normal for the first 10 minutes or so after the call ends.Wait.
The tool calls are listedThe call was matched to its Salesforce session, and the trace was fetched.Nothing.
Tool calls are unverifiedEither verification timed out because no trace appeared within 35 minutes of the call ending, or TestMu AI could not tell with certainty which session belonged to this call and chose not to guess. The transcript and grading are unaffected.See Troubleshooting. Rerunning the scenario is usually enough. If every run ends unverified, Data Cloud tracing or the integration user's access is the cause.

How do you troubleshoot the Agentforce integration?​


SymptomLikely causeFix
Saving fails with "Instance URL must be your org's My Domain"The URL is a login or Lightning host, has a path, or is not https.Use https://yourorg.my.salesforce.com, or the sandbox My Domain, with nothing after the host.
Saving fails with "Salesforce rejected the configured consumer key/secret"The Client Credentials Flow is not enabled, there is no Run As user, the key or secret is wrong, or the My Domain is wrong: a production URL for a sandbox org, or the reverse.Recheck Create the External Client App and Collect the Four Values.
Saving fails with "No Agentforce agent found for '…'"The Agent ID is wrong.Use the API name or the 0Xx ID exactly.
Saving or syncing fails with "Could not read the agent's active version (BotVersion query failed)"The integration user lacks read access on BotVersion.Grant read on the agent objects. See Create an Integration User. TestMu AI never guesses which version is live.
Saving or syncing fails with "Agent '…' has no active version"No version of the agent is activated.Activate the version you want tested in Agent Builder, then save or sync again.
Syncing fails with "No GenAiPlannerBundle found for the active version"The active version's definition is missing or cannot be retrieved.Republish the agent in Agent Builder, then sync again.
The prompt sync fails with UNSUPPORTED_API_VERSIONThe org is below API version 65.Agentforce metadata needs API version 65 or newer. Contact Salesforce if your org is older.
The prompt sync fails with a permission errorThe integration user lacks View Setup and Configuration.Grant it. See Create an Integration User.
The Prompt page is empty after a syncThe active agent version has no instructions.Check the agent in Agent Builder, publish it, and sync again.
Tool calls are pending for more than 15 minutes, then unverifiedData Cloud tracing is not turned on. Or the integration user cannot read the session tracing objects or VoiceCall. Or two calls on the same caller number started and ended within about a second of each other, which cannot be told apart in Salesforce's call records, so TestMu AI waits rather than guess.Run the verification queries as the integration user. If they return nothing, turn on Agentforce session tracing or grant the missing access. For near-simultaneous calls, rerun the scenario.
Tool calls are unverified within minutes of the call endingSalesforce linked the call's record to more than one agent session, or another run already holds that session. This is rare.Rerun the scenario. If it repeats for a single call, inspect that call's VoiceCall record and its sessions in Salesforce. See Verification Queries.
The call never connects, or the agent does not answerThe agent's number is not routed to it, or Agentforce Voice is not provisioned.Call the number from a phone. Fix the routing in Salesforce before testing.
A scenario ends with dispatch-failed and no callThe call could not be placed. Most often, the agent's phone number is not in international format (a +, then the country code and the number), or there was a transient telephony error. If TestMu AI itself refused the call, for example because the integration is not active or the selected tools no longer match the connected agent, the scenario shows that message instead.Check the number on the agent. See Create the Phone Caller Agent. Then rerun the scenario.
The agent said something it should not have, for example it named its backend data providerA real defect in the agent's instructions.This is not a TestMu AI problem. Add the guardrail to every topic that can answer, not only the off-topic one.

How does Agentforce tool call validation work?​


You do not need this section to use the integration. It explains the wait and the statuses.

Why tool calls take minutes. Salesforce writes an agent's trace, its turns and tool calls, to Data Cloud in a batch after the session ends, not live. On real calls, the batch lands 6 to 10 minutes after the call. TestMu AI starts looking about five minutes after each call ends and checks every minute until the trace arrives, up to 35 minutes after the call ended. Nothing in TestMu AI can speed this up.

How a call is matched to its session. Salesforce creates a record for every phone call the moment it arrives, and the agent's session points back at that record. After a call ends, TestMu AI finds the record for its own call, with the same caller number, the same called number, and the same start and end times, and follows Salesforce's own link from that record to the session. The match is exact however many scenarios ran at once. If two records cannot be told apart, TestMu AI waits rather than guess.

Why a call can end up unverified. Either the trace never arrived, because session tracing is off or the integration user cannot read it, or TestMu AI could not tell with certainty which session belonged to this call and refused to attribute another call's tool calls to it.

Privacy and access. TestMu AI holds the consumer key and secret encrypted, requests short-lived tokens with them, and performs read-only queries. The session and tool call data that it fetches is stored with the call result, alongside the transcript.

How do you verify Salesforce access with queries?​


Run these queries in the Developer Console → Query Editor, logged in as the integration user, after at least one test call and a 10-minute wait. Each query should return rows.

The agent resolves and has an active version.

SELECT Id, DeveloperName FROM BotDefinition
SELECT BotDefinitionId, VersionNumber, Status FROM BotVersion WHERE Status = 'Active'

Phone calls are being recorded, one row per call.

SELECT Id, CallStartDateTime, CallEndDateTime, FromPhoneNumber, ToPhoneNumber
FROM VoiceCall ORDER BY CallStartDateTime DESC LIMIT 5

Agent sessions are reaching Data Cloud and are linked to their calls.

SELECT ssot__Id__c, ssot__StartTimestamp__c, ssot__RelatedVoiceCallId__c
FROM ssot__AiAgentSession__dlm ORDER BY ssot__StartTimestamp__c DESC LIMIT 5

Tool calls are being traced.

SELECT ssot__Name__c, ssot__StartTimestamp__c, ssot__InputValueText__c,
ssot__OutputValueText__c
FROM ssot__AiAgentInteractionStep__dlm
WHERE ssot__AiAgentInteractionStepType__c = 'ACTION_STEP'
ORDER BY ssot__StartTimestamp__c DESC LIMIT 5

If a query fails or returns nothing, use this table to find the cause.

ResultCause
The BotDefinition or BotVersion query failsThe user cannot see the agent or its versions.
The VoiceCall query returns nothing after a callThe user lacks Service Cloud Voice access.
The session or tool call query returns nothing after 10 minutesData Cloud tracing is not flowing, or the user lacks access to it.

Terminal First Testing With Kane CLI

Natural language browser & mobile app tests right from terminal.

×
Schedule Your Personal Demo
Kane CLI terminal

Help and Support

Related Articles