Sub topic 6
Writing descriptions the agent can act on
This chapter covers how to write the descriptions on a flow-based action so the agent's language model can decide when to call the action and what to pass in. It assumes you know Flow Builder variables and resources, the basic Salesforce data model, and how to navigate Setup. It builds on the previous chapter, where you marked variables as available for input and output.
Why descriptions matter
An Agentforce agent does not run your flow by reading its elements. It sees a short summary of each action: the action name, the action instructions, and the name, data type, and description of each input and output. The language model uses that summary to answer three questions.
- Is this action the right one for the customer's request?
- What values must I supply, and where do I get them?
- What does the result mean, and how do I tell the customer?
The model never sees your Get Records element or your decision logic. If the summary is vague, the agent picks the wrong action, asks the wrong question, or misreads the result. The flow can be perfect and the agent can still fail.
What the agent reads
Several pieces of text can reach the model. Some come from the flow and some from the registration step.
| Text | Where you set it | What it tells the agent |
|---|---|---|
| Flow label and API name | Flow Builder, when you save the flow | A first hint about the action's purpose |
| Flow description | Flow properties | Background for admins. Check how your org surfaces it in Agent Builder. |
| Variable API name | Variable resource | The name of each input or output |
| Variable description | Variable resource, saved in metadata as `description` | What the value is, its format, and an example |
| Action name and instructions | Agent Builder | When to use the action |
| Input and output instructions | Agent Builder | How to collect or present each value |
This chapter covers the variable descriptions, which live in the flow. The next chapters cover the registration fields. The two should agree. A variable description says what a value is. The action instructions say when to use the action.
Where the description lives
In Flow Builder, open a variable resource and fill in the Description box. In the flow's metadata it appears as the description element. Here are two variables from a case-lookup flow.
<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>Three details matter here.
isInputandisOutputcontrol whether the variable is visible to the caller at all. A variable with both set tofalseis internal, and the agent never sees it.- The input description names the field in business terms ("Case Number") and gives an example of the format.
- The output description covers the failure case too ("or a short message if no case was found"). The agent then knows that a non-status string is possible.
Principles for good descriptions
Say what the value is, in the customer's vocabulary
Use the words a customer or service rep would use. "Case Number" is better than "the Case.CaseNumber field." The model matches the customer's request to your wording, so a description that reads like a database column is harder to match.
Give the format and one example
Models guess when a format is unclear. State the expected shape and show one example.
- Weak:
Date - Better:
The date the customer wants to be contacted, in YYYY-MM-DD format, for example 2026-03-15.
Case numbers are a good test. The number is stored as text with leading zeros. If the description does not say so, the agent may pass 1026 and the Get Records lookup finds nothing. Consider this wording: "Case Number as text, including leading zeros, for example 00001026."
Say whether the value is required
State what happens when the value is missing. For a required input, say so: "Required. Ask the customer if they have not given it." For an optional input, say what the flow does without it: "Optional. If blank, the flow uses the customer's most recent case."
Describe outputs for the customer, not for the flow
An output description should help the agent explain the result. Include the possible values when the set is small.
Status of the case. One of: New, Working, Escalated, Closed. If no case matches, a short message beginning with "No case found".Listing values stops the agent from inventing paraphrases that the customer might mistake for official statuses.
Keep the scope to one idea
Each description covers one variable. Do not use it to describe when the action should run. That belongs in the action instructions. A description that mixes the two makes both harder to maintain.
Avoid internal jargon and abbreviations
Names like vCsNo or recId2 give the model nothing. Use clear API names as well, such as caseNumber. The name and the description are read together, and a clear name makes a short description enough.
A before and after comparison
Here is a poorly described input and a better one.
Name: input1
Description: IDName: caseNumber
Description: The Case Number of the case to look up, as text with leading zeros, for example 00001026. Required. Do not pass the 18-character record ID.The second version also guards against a common error. A customer rarely knows a Salesforce record ID, and an agent that has one from a previous step may pass it by mistake. The last sentence closes that gap.
Common errors
- Empty descriptions. The flow saves without them, and the action may still register. The agent just has less to work with. Treat a missing description as a defect.
- Descriptions that contradict the instructions. If the variable says "case number" and the action instructions say "ticket ID," the agent may ask the customer for the wrong thing. Use one term everywhere.
- Output descriptions that promise more than the flow returns. If the description says the output contains the owner's name but the flow only returns an ID, the agent will either invent a name or report the ID. Keep the description and the flow logic in step.
- Too much text. A paragraph of caveats on one variable dilutes the key point. Aim for one or two sentences. Move policy rules into the action instructions.
- Describing the implementation. "Set by the Get Records element" does not help the agent. Describe the meaning, not the mechanics.
- Forgetting to re-save after edits. Changing a description creates a new flow version. If the action still points at an older version, the agent keeps reading the old text. Check which version is active after any change.
How the pieces connect
The following diagram shows how the text from the flow and the text from the registration step reach the model.
Checking your descriptions
You can review a description without running anything. Read each one as if you had never seen the flow, and answer these questions.
- Could I tell what to ask the customer for?
- Do I know the format, with an example?
- Do I know whether the value is required?
- For an output, do I know the possible values and what failure looks like?
If any answer is no, revise. Later, in the testing chapter, you will confirm the effect in the agent preview. If the agent asks for the wrong value or misreports a result, the description is the first place to look.
Example: tightening a three-input flow
Suppose a flow updates a case's contact preference. The first draft has these inputs.
| API name | Draft description | Problem |
|---|---|---|
| `caseNumber` | Case | Does not say number, format, or required |
| `method` | How to contact | Does not list valid choices |
| `notes` | Notes | Does not say whether the agent should compose it or ask |
A revised set follows.
| API name | Revised description |
|---|---|
| `caseNumber` | The Case Number as text with leading zeros, for example 00001026. Required. |
| `contactMethod` | How the customer wants to be contacted. One of: Email, Phone, SMS. Required. |
| `contactNote` | Optional. A short note, under 200 characters, in the customer's own words about when to contact them. Leave blank if none was given. |
The revisions rename method to contactMethod, list the valid choices, and say who writes the note. If the flow stores contactMethod in a picklist, the listed values must match the picklist exactly, or the update fails.
Exercise
A flow has an input variable named id with the description "ID of the record." Customers give a case number such as 00001026, but the Get Records element filters on CaseNumber. Rewrite the variable's name and description so the agent asks for the right value.
Show answer
Rename the variable to caseNumber and use a description such as: "The Case Number of the case to look up, as text with leading zeros, for example 00001026. Required. Do not pass the 18-character record ID." The name and description now match what the customer knows, give a format and example, state that the value is required, and rule out the record ID.
Exercise
An output variable caseStatus is described as "The status." The flow returns "No case found for that number." when the lookup fails. What is wrong, and how would you fix it?
Show answer
The description does not mention the failure message, so the agent may treat it as an official status or fail to explain it. Rewrite it as: "The current Status of the case. One of: New, Working, Escalated, Closed. If no case matches, a short message beginning with 'No case found'." Now the agent can tell a status from a failure and respond accordingly.