Sub topic 15
Channels and deployment
This chapter covers where an Agentforce agent runs and how it gets there. It assumes you know the earlier chapters: topics, instructions, actions, the reasoning loop, and testing. You should also know Salesforce Setup, sandboxes, and metadata deployment at a basic level. Menu names and metadata type names change between releases, so check them against your org's Setup and the current documentation.
What a channel is
A channel is the surface where a person and the agent exchange messages. The agent itself does not change from one channel to the next. It still classifies the request into a topic, follows the topic instructions, and runs actions. The channel decides four things:
- How the user's text reaches the agent.
- Who the user is, and whether they are known or anonymous.
- What formatting the reply can use.
- What happens when the agent cannot help.
The same agent can behave differently in different channels. A web chat visitor may be anonymous, so an action that needs a Contact record has no one to look up. A signed-in Experience Cloud user already has a user record the agent can use. Treat the channel as part of the agent's context when you design topics and instructions.
Two broad agent types
Salesforce groups agents by who they serve. The labels in the builder may differ by release, so confirm them in your org.
| Agent type | Who talks to it | Typical channels |
|---|---|---|
| Customer-facing (service) agent | Customers, prospects, site visitors | Messaging for web and in-app, Experience Cloud, WhatsApp, SMS, Facebook Messenger, voice, email |
| Employee-facing agent | Your own staff | Salesforce apps, Slack, and other internal surfaces |
Choose the type before you write topics. Customer-facing agents need stricter scope and clear escalation rules, because the people on the other end are outside your company. Employee agents can assume a signed-in user. They can often use that person's permissions when running actions.
Common channels
The list below covers the usual choices. Availability depends on your licenses and the release.
- Messaging for In-App and Web. A chat window embedded in your website or mobile app. You configure it through an embedded service deployment, which generates a code snippet to paste into your site.
- Experience Cloud sites. The agent appears inside a customer or partner portal. Users are often authenticated, so the agent can work with their records.
- Messaging channels. WhatsApp, SMS, and Facebook Messenger connect through Messaging channel setup. They use the same routing mechanism as web chat.
- Voice. Telephony and Service Cloud Voice can route calls to an agent. Replies are spoken, so long lists and tables make poor answers.
- Email. Suited to longer, asynchronous requests.
- Slack. Mostly used for employee agents, where the agent answers inside a workspace.
- Salesforce apps. An employee agent can sit in a panel inside Lightning apps and work against the record the user is viewing.
- API access. Developers can call an agent from their own application. This is useful when none of the built-in surfaces fit.
How a conversation reaches the agent
For messaging-style channels, routing runs through Omni-Channel. A message arrives on a channel and starts a Messaging Session. An Omni-Channel flow then decides where the session goes. The flow can route to an agent, to a human queue, or to a mix of the two.
Two points follow from this design.
- The agent is not wired to the channel directly. The Omni-Channel flow is the connection, so changing where conversations go means editing the flow, not the agent.
- Escalation also goes through the flow. An escalation topic in the agent hands the session back to the flow, which routes it to a queue or a skill-based human team. If no escalation path exists, the agent has nowhere to send users it cannot help.
Planning the handoff to a human
Write the escalation as a topic, like any other. Its classification description should say when the user needs a person, such as an explicit request, a complaint, or a request outside every other topic's scope. Its instructions should tell the agent what to say before the handoff.
Topic: Escalation
Classification description: Handles requests where the customer asks for a human, is frustrated, or needs something no other topic covers.
Scope: Hand the conversation to a human agent. Does not try to solve the problem itself.
Instructions:
- Tell the customer a human will take over.
- Do not promise a wait time.
Actions: Transfer to HumanTest this topic in every channel you deploy to. Outside business hours, a transfer to a queue with no available staff can leave the customer waiting. Make the Omni-Channel flow check availability and tell the customer when someone will respond.
Identity and permissions per channel
Ask what the agent knows about the user in each channel.
- In an authenticated Experience Cloud site or a Salesforce app, the agent can use the signed-in user's identity.
- On a public website or an SMS number, the user is anonymous until they identify themselves.
- Actions run with the permissions of a specific user or context. Check which one your agent uses, and give that user only the access the agent's actions need.
For anonymous channels, add an instruction that makes the agent verify identity before it discloses account data. Use an action that checks a value such as an order number plus an email address, rather than trusting what the user types. The Einstein Trust Layer from the earlier chapter masks sensitive data sent to the language model, but it does not decide who is allowed to see a record. Access control is your job.
From draft to live: versions and activation
An agent is built in Agentforce Builder, usually in a sandbox or a Developer Edition org first. A published agent has versions. You edit a draft, test it, and then activate it. In current releases only one version is active at a time, and you can roll back by activating an earlier version. Two habits make this safe:
- Test the active version from the channel, not only from the builder's test panel. The test panel does not exercise routing, identity, or channel formatting.
- Change topics and instructions in a new version instead of editing the live one, so you can roll back.
Activating the agent does not publish it to a channel. You also have to connect it, usually by pointing an Omni-Channel flow at it and linking that flow to the channel's deployment.
Moving an agent between orgs
Agents are metadata, so you can move them from a sandbox to production with change sets, the Salesforce CLI, or DevOps Center. An agent depends on other metadata, and a deployment fails or misbehaves if any of it is missing. Typical dependencies include:
- The Apex classes and Flows used as actions.
- Prompt templates.
- Custom objects and fields that the actions read.
- Permission sets that grant access to those objects.
- The Omni-Channel flow, queues, and channel deployment.
The following package.xml is a starting point for retrieving an agent and the pieces it commonly needs. The type names reflect recent API versions, so confirm them with sf project generate manifest or the Metadata Coverage report if a retrieve reports an unknown type. 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>Order_Support_Planner</members>
<name>GenAiPlannerBundle</name>
</types>
<types>
<members>OrderStatusAction</members>
<name>ApexClass</name>
</types>
<version>63.0</version>
</Package>Retrieve it with sf project retrieve start --manifest package.xml --target-org MySandbox, then deploy to the target with sf project deploy start --manifest package.xml --target-org Production. After deploying, activate the version in the target org if the deployment did not do it, and reconnect the channel. Routing configuration and some channel settings are org-specific, so expect to check them by hand.
Pre-launch checks
Work through these checks before switching a channel on.
- Send a request for each topic from the real channel and confirm the topic and action in the trace.
- Send out-of-scope requests and confirm the agent declines or escalates.
- Ask for a human and confirm the handoff reaches a staffed queue.
- Use an anonymous session and try to read another customer's data.
- Review the formatting of replies in that channel, for example links in SMS or long text in voice.
- Confirm the active version is the one you tested.
Common errors
| Symptom | Likely cause |
|---|---|
| Chat window appears but nobody answers | The Omni-Channel flow does not route to the agent, or the agent version is not active |
| Agent works in the builder but fails in production | A dependency such as an Apex class, permission set, or field was not deployed |
| Agent cannot find the customer's record | The channel session is anonymous and the agent has no identity step |
| Escalation leaves the customer waiting | The queue has no available staff and the flow has no fallback |
| Replies look wrong in one channel | The reply uses formatting that the channel does not support |
Exercise
A customer chats with your agent through a public website widget and asks, "Where is my order?" The agent works well in the builder test panel, but in the widget it says it cannot find the customer. Give two possible causes and the change you would make for each.
Show answer
First, the website visitor is anonymous, so the agent has no Contact to look up. Add an instruction and an action that verify identity, for example asking for the order number and checking it with the email address, before it shares order data. Second, a dependency may be missing in the target org, such as the Apex action, a field, or a permission set for the user the action runs as. Deploy the missing metadata, grant the permissions, and re-test from the widget itself. The builder test panel does not exercise channel identity or routing, so it can hide both problems.
Exercise
Why does changing where conversations go usually mean editing the Omni-Channel flow, not the agent, and why does this matter for escalation?
Show answer
The channel connects to the agent through the Omni-Channel flow, so the flow decides whether a session goes to the agent or to a human queue. Escalation also returns to the flow, so the agent needs an escalation topic and the flow needs a staffed queue to receive the handoff. Without both, the agent has no route to a human.