Sub topic 6
Service Agents: Customer-Facing Support
This chapter assumes you know basic Salesforce concepts (objects, records, permission sets), have read the earlier chapters on topics, instructions, and actions, and have a general idea of what a large language model does.
What a service agent is
A service agent is an Agentforce agent that talks to your customers, not your staff. It answers questions, looks up records, and completes simple support tasks on channels such as a website chat window. Its audience is external, so the design priorities are different from an internal assistant. You must assume the person is unauthenticated or only lightly verified, and you must limit what the agent can see and say.
How it is built
A service agent uses the same parts as any agent:
- Topics group the jobs the agent can handle, such as order status or returns.
- Instructions tell the agent in natural language how to behave inside a topic.
- Actions are the things the agent can do, such as run a Flow or call an Apex invocable method.
The reasoning engine reads the customer's message, picks the best-matching topic by its classification description, and then chooses actions according to that topic's instructions.
Identity and access
A service agent does not run as the customer. It runs as a dedicated agent user, an automated user record that you create and assign permission sets to. Whatever that user can access is the most the agent can ever reveal. Give it the narrowest permissions that support its topics.
This is why the Apex action in your code should use with sharing. The query then respects the agent user's record access instead of returning everything in the org.
A worked topic
The following topic handles one customer question and sets clear limits:
Topic: Order Status
Classification description: Customer asks where an order is or what state it is in.
Scope: Look up the status of a single order using the Get Order Status action.
Instructions:
- Ask for the order number if the customer has not given one.
- Call the Get Order Status action with that order number.
- Report only the status returned by the action.
- If the action returns 'Order not found', ask the customer to check the number once, then offer to connect them with a human agent.
- Do not discuss refunds or cancellations in this topic.Each instruction does a specific job. The first collects the required input. The second names the action. The third prevents the agent from inventing details. The fourth defines a fallback, and the last sets a boundary.
The diagram below shows the request flow.
Common errors
- Vague classification descriptions. Two topics with overlapping descriptions make topic selection unreliable. Write each description to describe one customer intent.
- Missing boundaries. If instructions do not say what is out of scope, the agent may try to answer anyway. State limits explicitly.
- Over-permissioned agent user. A broad permission set turns a prompt mistake into a data exposure.
- No escalation path. Customers will ask things the agent cannot handle. Always give a route to a human.
Key points
| Concern | Service agent approach |
|---|---|
| Audience | Customers, external |
| Identity | Dedicated agent user |
| Access limit | Agent user permission sets and sharing |
| Failure handling | Escalate to a human agent |
Exercise
A service agent returns order details for orders that belong to other customers. Name two places you would check to find the cause.
Show answer
Check the agent user's permission sets and sharing access, since they define the most data the agent can see. Check the Apex action to confirm it uses with sharing and filters on the verified customer's data, not only the order number the customer typed.