Update Agent Variables

Last Updated on : 2026-02-26 09:17:43download

Based on the device ID, update the AI agent variables.

API address

PUT: /v1.0/cloud/agent/ai/b/devices/{device_id}/agent-variables

Request parameter

Parameter nameTypeINRequiredDescription
device_idStringpathtrueThe ID of the specified device.

Description of body

Parameter nameTypeINRequiredDescription
bind_role_typeIntegerbodyfalseThe type of role to bind. Valid values:
  • 0: Custom role
  • 1: Template-based role
  • 2: Single role (There is no role, and data is at the agent level)
When role_id has a value, this parameter value must be passed.
role_idStringbodyfalseThe ID of the specified role.
variable_mapMapbodytrueMapping relationships between variables.

Return parameter

Parameter nameTypeDescription
variable_keyStringThe key of the specified variable.
variable_valueStringThe value of the specified variable.

Request example

PUT: /v1.0/cloud/agent/ai/b/devices/{device_id}/agent-variables
{
  "device_id": "6c3585ebfe301b40a8u***",
  "variable_map": {
    "custom.familyName": "testFamilyName"
  }
}

Return example

[
    {
        "effective_scope_name": "Role's memory",
        "memory_list": [
            {
                "memory_value": "Playing football, playing basketball, writing code, reading",
                "memory_name": "Hobbies",
                "effective_scope_name": "Role's memory",
                "memory_key": "sys.memoryInterests",
                "effective_scope": 3
            },
            {
                "memory_value": "100 years old",
                "memory_name": "Age",
                "effective_scope_name": "Role's memory",
                "memory_key": "sys.memoryAge",
                "effective_scope": 3
            },
            {
                "memory_value": "July 7",
                "memory_name": "Birthday",
                "effective_scope_name": "Role's memory",
                "memory_key": "sys.memoryBirthday",
                "effective_scope": 3
            },
            {
                "memory_value": "Tuyaya",
                "memory_name": "Name",
                "effective_scope_name": "Role's memory",
                "memory_key": "sys.memoryUserFullName",
                "effective_scope": 3
            }
        ],
        "effective_scope": 3
    }
]

Error code

For more information, see error code.