Sub topic 10
Adding the Flow to a Topic in Agent Builder
This chapter assumes you can build an autolaunched flow, know what input and output variables are, and can find your way around Setup and permission sets. You will register the Get_Case_Status flow as an action on a topic so the agent can call it.
What registering does
A flow does nothing for an agent until you attach it to a topic. A topic is a group of related jobs, and an action is one thing the agent can do inside that topic. When you add the flow as an action, Agent Builder reads the flow's input and output variables and builds the action's inputs and outputs from them. The agent's language model then reads the names and descriptions to decide when to call the action and what to pass in.
Check the flow first
Before you open Agent Builder, confirm three things.
- The flow is an autolaunched flow and it is active. Inactive flows do not appear in the list of flows you can pick from.
- Each variable the agent should set is marked Available for input. Each value the agent should read back is marked Available for output.
- Each variable has a description. Agent Builder shows this text as the action's input and output descriptions.
This is what the two variables look like in flow metadata:
<variables>
<name>caseNumber</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>true</isInput>
<isOutput>false</isOutput>
<description>The Case Number of the case to look up, for example 00001026.</description>
</variables>
<variables>
<name>caseStatus</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>false</isInput>
<isOutput>true</isOutput>
<description>The current Status of the case, or a short message if no case was found.</description>
</variables>Add the action to a topic
- In Setup, search for Agents and open your agent in Agent Builder.
- Select the topic that should own the action, or create one. Keep the topic's scope close to what the action does.
- In the topic's This Topic's Actions section, choose New Action.
- For the reference action type, choose Flow, then select
Get_Case_Statusfrom the list. - Enter an action name and the action instructions.
- Review each input and output. Adjust the settings described in the next chapter, then save.
The agent can now call the action, but only from this topic. If another topic needs the same flow, add it there too. Each topic keeps its own action settings.
What you enter
This sketch shows the values for the registration form:
Action name: Get Case Status
Flow: Get_Case_Status (autolaunched flow)
Action instructions: Use this action when the customer asks about the status of an existing case and has given a case number.
Input caseNumber: Collect from the user. Ask for it if it was not provided.
Output caseStatus: Tell the customer the status in plain language.The action instructions say when to use the action. The input line says how to get the value. The output line says what to do with the result.
Common errors
| Symptom | Likely cause | Fix |
|---|---|---|
| Flow is missing from the list | Flow is inactive, or it is not an autolaunched flow | Activate it and check its type |
| Action has no inputs | No variable is marked Available for input | Update the variable, save, and re-add the action |
| Agent never calls the action | Vague instructions, or the request falls outside the topic | Make the instructions specific and check the topic scope |
| Agent asks for the wrong value | Unclear variable name or description | Rename the variable and rewrite the description |
Exercise
You activated a flow, but when you add it to a topic, the action shows no inputs. What do you check first, and why?
Show answer
Check that the input variables are marked Available for input in the flow. Agent Builder builds the action's inputs from those settings, so an unmarked variable is not exposed. Fix the variable, save and activate the flow, then add the action again.
Exercise
The same flow is needed in two topics. Do you register it once for the whole agent?
Show answer
No. Actions belong to a topic, so you add the flow as an action in each topic that needs it. You can write different instructions in each topic to suit its scope.