CreateAgent
Creates an agent.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
sca:CreateAgent |
none |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| BaseMeAgentId |
integer |
No |
The workspace ID. |
123456 |
| JsonStr |
string |
No |
The complete JSON string. For more information, see the following details. |
"" |
Request parameters.
1. Overview
The request parameter object for agent management. It includes the basic attribute configurations and instruction type parameters of an agent.
2. Top-level fields
| Field | Type | Required | Description |
agentName | String | Yes | The name of the agent. |
agentDescription | String | No | The description of the agent. |
modelType | String | Yes | The type of the large language model (LLM). For valid values, see the LLMCodeEnum enumeration. |
inputType | String | Yes | The type of the analysis object. Valid values: text (text), voice (voice), and image (image). |
instructionType | String | Yes | The instruction type code. For valid values, see the AgentInstructionTypeEnum enumeration in the following table. |
instructionTypeParam | InstructionTypeParam | Yes | The detailed configuration parameters for the instruction type. Pass the corresponding sub-object based on the value of instructionType. |
instructionType enumeration values
| code | Description | Corresponding Param |
serviceInspection | Service inspection | serviceInspectionParam |
field | Key attribute extraction | fieldsParam |
tagCategory | Tag classification | tagCategoryParam |
multiLevelTag | Multi-level tag recognition | tagTreeLevelParam |
customPrompt | Custom instruction | customPromptParam |
3. InstructionTypeParam (Instruction type parameters)
instructionTypeParam is the configuration container for various instruction types. Based on the value of instructionType, you only need to pass the corresponding sub-object. Other sub-objects can be null.
| Field | Type | Description |
fieldsParam | FieldsParam | The key attribute extraction configuration. Pass this parameter when instructionType is set to field. |
serviceInspectionParam | ServiceInspectionParam | The service inspection configuration. Pass this parameter when instructionType is set to serviceInspection. |
tagCategoryParam | TagCategoryParam | The tag classification configuration. Pass this parameter when instructionType is set to tagCategory. |
tagTreeLevelParam | TagTreeLevelParam | The multi-level tag analysis configuration. Pass this parameter when instructionType is set to multiLevelTag. |
customPromptParam | CustomPromptParam | The custom instruction configuration. Pass this parameter when instructionType is set to customPrompt. |
3.1 FieldsParam (Key attribute extraction)
| Field | Type | Required | Description |
nameDescPairList | List<NameDescPair> | Yes | The list of key attribute dimensions to be extracted. |
NameDescPair structure:
| Field | Type | Required | Description |
name | String | Yes | The attribute name. |
desc | String | Yes | The attribute description. |
value | String | Yes | The attribute value. |
3.2 ServiceInspectionParam (Service inspection)
| Field | Type | Required | Description |
sceneName | String | Yes | The name of the inspection scenario. |
sceneDescription | String | Yes | The description of the inspection scenario. |
dimensions | List<Dimension> | Yes | The list of inspection dimensions, which define the specific inspection dimensions and their conditions. |
Dimension structure:
| Field | Type | Required | Description |
dimension | String | Yes | The dimension name. The title alias is also accepted during JSON deserialization. |
desc | String | Yes | The dimension description. The content alias is also accepted during JSON deserialization. |
3.3 TagCategoryParam (Tag classification)
| Field | Type | Required | Description |
nameDescPairList | List<NameDescValueListPair> | Yes | The list of tag classification dimensions. Each dimension can contain multiple candidate tag values. |
NameDescValueListPair structure:
| Field | Type | Required | Description |
name | String | Yes | The dimension or classification name. |
desc | String | Yes | The dimension description. |
valueList | List<String> | Yes | The list of candidate tag values under this dimension. |
3.4 TagTreeLevelParam (Multi-level tag recognition)
| Field | Type | Required | Description |
tagIds | List<Long> | Yes | The list of tag IDs passed at runtime. The first ID is used as the matched starting parent tag, and matching continues from its child nodes. |
tagTreeLevels | List<TagTreeLevelInfoParam> | Yes | The prompt configuration list for each level, arranged in hierarchical order. |
TagTreeLevelInfoParam structure:
| Field | Type | Required | Description |
tagTreeIds | List<Long> | Yes | The list of candidate tag IDs for the current level. A value of -1 indicates all tags are selected, which means all tags at this level are matched. |
prompt | String | Yes | The analysis prompt for this level. It is concatenated with the tag data and sent to the large language model for analysis. |
3.5 CustomPromptParam (Custom instruction)
| Field | Type | Required | Description |
customPrompt | String | Yes | The custom prompt instruction content defined by the user. |
nameDescPairList | List<NameDescPair> | No | The list of custom fields, which are used as additional variables referenced in the prompt. |
The NameDescPair structure is the same as that in Section 3.1.
4. Request example
{
"id": 123,
"userGroup": "default",
"aliUid": 1000000001,
"agentName": "Customer service inspection agent",
"agentDescription": "Used for automatic detection of customer service dialogue quality",
"modelType": "qwen-max",
"inputType": "text",
"instructionType": "serviceInspection",
"instructionTypeParam": {
"serviceInspectionParam": {
"sceneName": "After-sales customer service scenario",
"sceneDescription": "Check the service quality of after-sales customer service dialogues",
"dimensions": [
{
"dimension": "Service attitude",
"desc": "Check whether the customer service representative uses polite language",
"includeCondition": "Includes greetings and expressions of gratitude",
"excludeCondition": "Not excluded if there is no obvious inappropriate language"
}
]
}
}
}
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| RequestId |
string |
Id of the request |
106C6CA0-282D-4AF7-85F0-D2D24*** |
| Code |
string |
The result code. A value of 200 indicates success, and other values indicate failure. You can use this field to determine the cause of the failure. |
200 |
| Message |
string |
The error message. This field is returned if an error occurs. |
successful |
| Success |
boolean |
Specifies whether the call was successful. Valid values:
|
true |
| Data |
integer |
The ID of the agent for the task. |
12 |
Examples
Success response
JSON format
{
"RequestId": "106C6CA0-282D-4AF7-85F0-D2D24***",
"Code": "200",
"Message": "successful",
"Success": true,
"Data": 12
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.