Sub topic 15
Activating, Deploying, and Monitoring Agents
An agent that passes testing is still not live. You have to activate it, connect it to a channel, move it between orgs, and watch how it behaves with real users. This chapter covers that last stretch of the lifecycle for both service agents and employee agents.
It assumes you have read the earlier chapters on topics, actions, agent identity, channels, escalation, and testing. You should also know what a sandbox, a change set, and a permission set are.
Activation, deployment, and monitoring are separate steps
The three terms are easy to blur, so this chapter keeps them apart:
| Step | What it does | Who is affected |
|---|---|---|
| Activation | Makes an agent version available to run | The agent itself |
| Deployment | Connects the active agent to a place where users reach it, or moves the agent's metadata between orgs | Channels, or target orgs |
| Monitoring | Reviews conversations, outcomes, and errors after launch | You, as the builder |
An active agent with no channel connected is reachable by nobody. A deployed channel that points at an inactive agent produces no useful answers. Check both.
Activating an agent
Each agent has versions. A version holds a snapshot of the topics, instructions, and actions. Activating a version tells Salesforce that this snapshot is the one users should reach.
Before you activate, check these items:
- The agent user (for a service agent) exists and has the permission sets its actions need. An employee agent has no agent user. It runs as the person using it, so check that the intended employees hold the permissions the actions require.
- Every action's backing Flow or Apex class is active and deployed in the org.
- Test conversations cover the happy path, out-of-scope requests, and the escalation path.
- Any knowledge or data library the agent grounds on is populated and indexed.
If a version is active, Salesforce generally does not let you change it in place. Depending on your release, you either deactivate it first or create a new version and work there while the old one stays live. Prefer the new-version approach when your org offers it, because deactivating a customer-facing service agent leaves customers with no agent until you reactivate.
Activation is not an access grant. A service agent can still only do what its agent user's permissions allow, and an employee agent can only do what the current user's permissions allow.
Deploying to channels
Once the agent is active, you attach it to the places where users reach it. The options differ by agent type.
- Service agents usually go to customer-facing channels. Examples are an Experience Cloud site or website chat through Messaging for In-App and Web, other messaging channels such as SMS or WhatsApp, and voice.
- Employee agents usually go to internal surfaces. Examples are the Salesforce mobile app, Lightning Experience, and Slack.
Each surface has its own setup. A messaging channel needs a messaging channel record and a routing configuration. A web embed needs an embedded deployment with allowed domains. Slack needs the app installed and users connected. The details change between releases, so use the current Salesforce documentation for the exact setup screens.
Two settings matter more than the rest:
- The escalation route. A service agent that hands off to a human needs an Omni-Channel flow, a queue, and available agents on that channel. Test the handoff in the deployed channel, not only in the builder preview. If nobody is staffed, the customer reaches a dead end.
- Allowed domains and visibility. An embedded chat that is deployed to the wrong domain, or visible to the wrong audience, exposes a service agent in places you did not intend.
Moving an agent between orgs
You will normally build in a sandbox and then promote to production. An agent is a set of metadata components, so you deploy it the same way you deploy other metadata.
The components usually include the agent definition (Bot and BotVersion), its planner and topics, its actions, and anything those actions call. Exact type names depend on your API version. In recent versions the topic and action definitions are GenAiPlannerBundle, GenAiPlugin, and GenAiFunction, and prompt templates are PromptTemplate. The Apex classes, Flows, and permission sets that the agent needs are separate components.
Here is a manifest that bundles those pieces. Replace the member names with your own.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Order_Support_Agent</members>
<name>Bot</name>
</types>
<types>
<members>Order_Support_Agent.v1</members>
<name>BotVersion</name>
</types>
<types>
<members>GetOrderStatusAction</members>
<name>ApexClass</name>
</types>
<types>
<members>GetOrderStatusActionTest</members>
<name>ApexClass</name>
</types>
<types>
<members>Order_Agent_Access</members>
<name>PermissionSet</name>
</types>
<version>62.0</version>
</Package>Deploy it with the Salesforce CLI and run local tests, which production requires for Apex:
sf project deploy start \
--manifest manifest/package.xml \
--target-org my-production-org \
--test-level RunLocalTestsSome things do not travel with the metadata:
- The agent user. A service agent's user is a user record. Create it in each target org and assign the permission sets there. The deployment does not do this for you.
- Channel connections. Messaging channels, embedded deployments, and Slack installations are configured per org. Expect to repeat that setup.
- Knowledge content and data. Articles, files, and records that ground the agent are data. Load them into the target org separately.
- Activation state. A deployed version may arrive inactive. Activate it in production deliberately, after you check it.
Monitoring after launch
Testing shows you what the agent does with the conversations you thought of. Monitoring shows you what it does with the ones you did not. Plan for it from the start.
You can usually review these signals, through Agentforce analytics and observability tools and the data they store. The names and layout of these tools change between releases.
- Conversation volume and outcomes. How many sessions ran, how many ended without a human, and how many escalated.
- Topic and action usage. Which topics the reasoning engine selected and which actions it called. A topic that never fires may have a poor classification description. An action that is called often and fails often points to a Flow or Apex problem.
- Session traces. A step-by-step record of a conversation: the topic chosen, the instructions applied, the actions called with their inputs and outputs, and the final response. Use traces to find out why a particular answer was wrong.
- User feedback. Thumbs up or down, where the surface supports it.
- Trust Layer and audit data. Records of masked data, toxicity checks, and prompt and response history, where your org has audit storage enabled.
Different problems show up in different places:
| Symptom | Likely cause | Where to look |
|---|---|---|
| Agent picks the wrong topic | Overlapping classification descriptions | Session trace, topic selection step |
| Agent answers but with wrong facts | Weak or stale grounding data | Retrieved knowledge in the trace |
| Action fails for some users only | Permission gaps on the running user or agent user | Action error in the trace, then the permission sets |
| Many escalations to a human | Missing topic or action for common requests | Escalation reasons, then conversation samples |
| Customers abandon the chat after a handoff | No staffed Omni-Channel queue | Omni-Channel supervisor view |
Changing a live agent safely
Treat the agent like production software. Change it in a sandbox, replay the conversations that exposed the problem, and add them to your test set. Then promote a new version and watch the same metrics you used to find the problem. Make one kind of change at a time, such as instruction wording or a new action, so you can tell which change moved the numbers.
Keep the previous version available. If a new version behaves worse, reactivating the old one is the quickest rollback.
Exercise
Your team deployed a service agent's metadata to production with a change set, and the agent is active. Customers on the website report that nothing responds. The agent worked in the sandbox. Name three things to check, and explain why the deployment did not carry them.
Show answer
Check that the agent user exists in production and has the needed permission sets, that the messaging channel or embedded deployment is configured and points at the agent, and that Omni-Channel routing and the knowledge data exist there. Also check that the correct version is activated. The agent user is a user record and the channel connections are per-org configuration, so metadata deployment does not move them. Knowledge is data, and activation state is set deliberately in each org.