Sub topic 3
Adding a Flow Action to an Agentforce Topic
Assume you understand Salesforce objects, fields, records, Flow Builder, and permission sets. An Agentforce topic defines a customer task, while an action gives the agent a way to perform that task. An autolaunched flow can be registered as a custom action.
Adding the Flow to a Topic in Agent Builder
First, activate the flow and confirm that it has usable input and output variables. In Agent Builder, open the relevant topic, add an action, and choose the flow from the available actions. Review the action’s input and output mappings before saving.
The flow should perform one focused operation. For example, a Get Case Status flow can accept a case number and return the case status. It should not also update contacts, send email, and create tasks unless those operations are part of one clear business task.
Action Instructions and Input Settings
Action instructions tell the agent when the action is appropriate. State the task, required information, and expected response. Input instructions tell the agent how to obtain each input.
For example:
- Action instructions: Use this action when a customer asks for the status of an existing case.
- Input instructions: Collect the case number from the user. Ask for it if it is missing.
- Output instructions: Tell the customer the returned status in plain language.
Descriptions on flow variables matter because the language model uses them when selecting and calling the action. Use precise names and descriptions. Do not expose internal implementation details as customer-facing output.
Testing and Debugging
Use Flow Builder’s debug feature with valid, missing, and invalid case numbers. Confirm that the flow returns the expected output and follows its fault paths. Then use the agent preview to test the complete conversation. Check whether the agent selects the topic, asks for missing input, calls the action once, and explains the result correctly.
Deploying and Versioning
Deploy the flow, its referenced fields, permissions, and action metadata together. Activate the intended flow version in the target environment. Keep a prior working version available so you can roll back by activating it if needed.
Combining Actions
A flow action can call a subflow for shared logic. Use Apex when the operation needs code or an unsupported integration. Use a prompt template when the main task is generating or transforming text. Keep each action’s purpose clear, and compose them only when the agent can distinguish their inputs and results.
Exercise
What should you test in the agent preview that Flow Builder debug cannot verify?
Show answer
Test topic selection, input collection, action selection, conversation wording, and the agent’s handling of the returned output.