Overview
A custom variable holds a value for one call, such as what the caller wants. An Update state node placed after a subagent writes to it, so every later step can read what the subagent just learned.
The example below saves the caller's product interest in lead_interest.
Contents
- Create a Custom Variable
-
Update the Variable after the Subagent
- Step 5: Add a step after the subagent
- Step 6: Choose Update state
- Step 7: Click Add update
- Step 8: Pick the variable to update
- Step 9: Choose where the new value comes from
- Step 10: Describe the value and pick its output type
- Step 11: Save the update
- Step 12: Check the row
- Step 13: Say when the subagent is finished
- Step 14: Connect the next step and publish
Create a Custom Variable
There is no "new variable" button. A variable exists as soon as a prompt mentions it by name inside double braces.
Step 1: Open the agent's workflow
Open the agent and choose Workflow in the left menu. Find the subagent node whose result you want to save.
Step 2: Mention the variable in a prompt
Click the subagent and type {{lead_interest}} in its Conversation goal. A name the builder has not seen before becomes a custom variable. The system prompt, first message and Say nodes work the same way.
The Variables button turns red and Publish reads Error until the variable has a test value.
Naming rule: Start with a letter, then use letters, digits or underscores only. Names beginning with
system__are reserved.
Step 3: Open Variables
Click Variables in the top bar. The new variable is listed, highlighted because its test value is empty.
Step 4: Set the type, test value and default
Pick the type with the icon on the left (String, Number, Boolean or List). Enter a test value, used in preview and test chat. Optionally enter a default value, used on live calls when nothing else supplies one.
Update the Variable after the Subagent
The Update state picker only offers variables that already exist, so finish Part 1 first.
Step 5: Add a step after the subagent
Hover over the subagent node and click the + on its bottom edge.
Step 6: Choose Update state
Scroll the list or type "update" in the search box, then pick Update state. The new node is created already connected to the subagent.
Step 7: Click Add update
With the Update state node selected, its panel opens on the right. Click Add update.
Step 8: Pick the variable to update
Open Variable to update and select your variable under Custom Variables.
Step 9: Choose where the new value comes from
Under New value, click the type icon. To capture what the caller told the subagent, choose LLM Evaluation. The other options set a fixed value or copy another variable (see Good to know below).
Value Types
| New value type | What it writes |
|---|---|
| String / Number | A fixed value you type in. |
| True / False / Null | A fixed flag, or clears the variable. |
| Dynamic Variable | A copy of another variable's current value. |
| LLM Evaluation | A value the model extracts from the conversation, cast to the output type you pick. |
Step 10: Describe the value and pick its output type
Describe what to extract, for example "The product the caller said they are interested in". Then open the type chip on the right and choose String, Boolean, Integer or Number.
Easy to miss: The chip shows String before you choose anything, but the workflow reports "Pick the LLM output type" and will not publish until you select a type from the menu.
Step 11: Save the update
Click Add update at the bottom of the panel.
Step 12: Check the row
The update appears as a row and the node now reads "Writes to: lead_interest". Add more rows to set several variables at once. Rows run top to bottom when the call enters the node, so a later row can read what an earlier row set.
Step 13: Say when the subagent is finished
Click the connection between the subagent and Update state. In LLM condition, describe when the conversation should move on. The update runs only once this is true. The Label is just the name shown on the canvas.
Step 14: Connect the next step and publish
Use the + under Update state to add whatever comes next (here, End call). Later steps can read {{lead_interest}} in prompts or test it in an Expression transition. When the button reads Publish rather than Error, click it to send the draft live.
Good to know
-
Test value vs. default
The test value only applies in preview and test chat. On a live call the order is: a value supplied for the call, then the default, then empty. A supplied value always wins, even an empty one. -
Scope
Custom variables last for one call. Update state cannot write to built-in system variables; those are read-only. -
Variable not in the picker?
The picker lists only variables already used on the agent. Mention it in a prompt first (Step 2), then come back.