Custom Variables
Custom Variables
Custom variables are defined by developers and used to access variable data during the runtime of an agent, enabling dynamic logic and responses through variables. Users can quickly reference custom variables in an agent by entering {{. When running, custom variables are automatically replaced with the correct values; if no value is set, they will be empty.
- Custom variables can be assigned by developers. Developers can set temporary variable values via API, Widget, and Iframe.
- Temporary variable values are not stored; values set via API, Widget, or Iframe are only valid for the current conversation.
Creating Custom Variables
- Log in to the GPTBots platform, go to the Agent management page, and click the Agent card to enter the Agent configuration management page.
- Click the "Custom Variables" button in the upper right corner to access the variable management page. Here you can view, edit, and delete existing custom variables.

- Click the "Add Custom Variable" button to open the custom variable creation dialog. Currently, you can create custom variables of types such as string, number, and integer.

- Variable name: Must start with a letter; supports a~z, numbers, and underscores.
- Variable value: The entered value is the default variable value, which will be permanently stored in the agent.
During a conversation, users can set temporary variable values via API, Widget, or Iframe. Temporary variable values are only effective for the current conversation. If the user does not set a temporary variable value, the default variable value will be used.
