Sub topic 9
Mapping Action Inputs and Outputs
This chapter assumes you have already added a prompt template to a topic as an action, and that you know what a merge field is. Here you will learn how the agent fills the template's inputs, and how it uses the template's output.
What mapping means
A prompt template action has two sides.
- Inputs are the values the template needs, such as a
Caserecord. In Agent Builder, each template input appears as an action input. - Output is the text the template generates. The agent receives it as the action's result.
Mapping is the work of deciding where each input value comes from, and what the agent does with the output.
Inputs
In the example template from this tutorial, the input is Input:Case, an object input of type Case. The template reads fields from it through merge fields such as {!$Input:Case.Subject}.
For each action input, the agent can get its value in one of two ways.
- Slot filling from the conversation. The agent asks the user, or reads the value from what the user already said. For example, the user gives a case number.
- A variable. The value comes from context the agent already holds, such as a record the user has open or a value set by an earlier action.
Pick the setting that matches how the value is known. In Agent Builder, an input that the agent should collect from the user is marked as one the agent asks for. An input that your flow already knows should come from a variable, so the user is not asked twice.
Record inputs need an identifier
A record input cannot be filled from free text such as "the broken router case". The action needs a record ID, or a value that resolves to one. This is why the topic instruction in this tutorial says to ask for the case number first. If the identifier is missing, the template receives an empty record. The output then says that the details are unknown, which is what the template's rule asks for.
Output
The output of a prompt template action is a single block of generated text. The agent can handle it in two ways, and your topic instructions decide which.
| Handling | Topic instruction wording | Use when |
|---|---|---|
| Pass through | "Return the action's output to the user without rewriting the facts." | The template already has the final wording and format. |
| Use as context | "Use the summary to answer the user's question." | The agent should answer a narrower question from the text. |
Pass-through keeps the result close to what you tested in Prompt Builder. Use-as-context lets the agent rephrase, which can drift from the template's rules. For hand-off summaries, prefer pass-through.
Use clear names and descriptions
The agent decides whether and how to call an action from its name and description, and from the descriptions of its inputs. Write them as plain statements.
Action name: Summarize Case
Action description: Creates a short factual summary of one support case.
Input description (Case): The case to summarize. Requires the case record ID.
Output description: A summary of at most five sentences.Vague descriptions such as "Handles cases" make the agent skip the action or pass the wrong value.
Common errors
- The agent never asks for the case number. The topic instructions do not say to collect it, and the input description does not say that an ID is required.
- The summary says everything is unknown. The record input was empty or pointed at the wrong record. Check the value passed in the Agent Builder preview.
- The agent rewrites the summary and adds a promise. The instruction allowed the output to be used as context. Switch to pass-through wording.
- An input name changed in the template. If you rename or add an input in a new template version, open the action and check that its inputs still match.
Exercise
A user says "Summarize the case about the router outage." The agent calls the Summarize Case action, and the summary says every field is unknown. What is the likely cause, and how do you fix it?
Show answer
The action's Case input was empty, because a record input needs a record ID and the user gave only a description. Fix it by adding a topic instruction to ask for the case number when it is missing, and by stating in the input description that the case record ID is required.