---
name: "updatePanelAgentCustomRole"
mode: "api"
versionRequirements:
  - { name: "@tuya-miniapp/cloud-api", version: "1.0.6" }
---

## updatePanelAgentCustomRole

> [VERSION] @tuya-miniapp/cloud-api >= 1.0.6

> 💡 This API depends on cloud capabilities. Configure authorization under Development Settings -> Cloud Capabilities on the Mini App Developer Platform (https://platform.tuya.com/miniapp/).

### Description

Update custom role.

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `params` | `UpdatePanelAgentCustomRoleParams` | Yes | Request body |

### Return Value

Type: `Promise<boolean>`

UpdatePanelAgentCustomRoleResult (see type definitions and minituya response parameters for field meanings)

### Referenced Types

##### `interface` UpdatePanelAgentCustomRoleParams

| Property | Type | Description |
| --- | --- | --- |
| `devId` | `string` | Device ID |
| `roleId` | `string` | Role ID |
| `roleName` | `string` | Role name |
| `roleDesc` | `string` | Role description |
| `roleIntroduce` | `string` | Role description |
| `roleVariables` | `Record<string, any>` | Role variables |
| `roleImgUrl` | `string` | Role image |
| `useLangCode` | `string` | Role language |
| `useTimbreId` | `string` | Role voice (timbre) |
| `useLlmId` | `string` | Role language model |
| `memoryInfo` | `string` | Memory |
| `speed` | `string` | Voice speed |
| `tone` | `string` | Voice tone |
| `needBind` | `string` | Whether binding is required |


### Examples

#### Request example

```typescript
import { updatePanelAgentCustomRole } from '@tuya-miniapp/cloud-api';

const params = {
  devId: 'your_device_id',
  roleId: 'role_custom_12345',
  roleName: 'Smart Assistant Xiaomei v2',
  roleDesc: 'An even more gentle and caring smart assistant',
  roleIntroduce: "I'm Xiaomei, your dedicated smart assistant, now even more attentive!",
  roleVariables: {
    personality: 'very_friendly',
    expertise: 'advanced',
  },
  roleImgUrl: 'https://example.com/new_avatar.jpg',
  useLangCode: 'zh-CN',
  useTimbreId: 'timbre_002',
  useLlmId: '1002',
  memoryInfo: 'The user prefers detailed answers',
  speed: '0.9',
  tone: '0.7',
  needBind: 'true',
};

updatePanelAgentCustomRole(params)
  .then(result => {
    console.log('Update result:', result);
  })
  .catch(error => {
    console.error('Failed to update custom role:', error);
  });
```

#### Response example

```json
true
```
