CreateAgentTask
Creates an Agent batch task for conversation analysis. Application calls support HTTP invocations to complete customer responses.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
sca:CreateAgentTask |
none |
*All Resource
|
None | None |
Request syntax
POST HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| BaseMeAgentId |
integer |
No |
The ID of the business workspace. |
12345 |
| JsonStr |
string |
No |
The complete JSON string information. For details, see the following sections. |
{\"\":\"\"} |
1. Overview
Use case: When calling the createAgentTask operation, serialize the fields of this class into JSON and pass them in. The server routes to different processing pipelines (text/audio) based on inputType, and routes to different instruction processors (key attribute extraction/service inspection/tag classification, etc.) based on instructionType.
2. Top-level field description
| Field | Type | Required | Description |
vid | String | No | The session ID. If not specified, a value is automatically generated using the current timestamp. |
modelType | String | Yes | The large model type. |
agentId | Long | Yes | The Agent configuration ID. |
inputType | String | Yes | The analysis object type. Valid values: audio (speech) and text (text). |
instructionType | String | Yes | The instruction type. Valid values: serviceInspection (service inspection), field (key attribute extraction), tagCategory (tag classification), multiLevelTag (multi-level tag recognition), and customPrompt (custom instruction). |
instructionTypeParam | InstructionTypeParam | Yes | The parameters corresponding to the instruction type. Different instructionType values require different sub-parameters (see §4.1). |
taskParam | TaskParam | Yes | The task data parameters, including text conversation or audio file information (see §3.1). |
3. Detailed description of nested classes.
3.1 TaskParam — Task data parameters
AgentTaskParam.TaskParam carries the input data for the task. Different sub-parameters are used depending on the value of inputType.
| Field | Type | Description |
textParam | TextParam | The text parameters. Used when inputType = "text". |
audioParam | AudioParam | The audio parameters. Used when inputType = "audio". |
callbackUrl | String | The callback notification URL after the task is completed (optional). |
Usage rules:
When
inputType = "text", you must providetextParam.When
inputType = "audio", you must provideaudioParam.textParamandaudioParamare mutually exclusive. Provide only one of them for a single task.
3.2 TextParam — Text parameters
AgentTaskParam.TextParam encapsulates text-type input data.
| Field | Type | Description |
dialogue | List<Dialogue> | The dialogue list. Each entry is a Dialogue object. |
dialogueContent | String | The raw dialogue text string. Provide either this field or dialogue. At least one must be specified. |
Dialogue object structure:
| Field | Type | Required | Description |
role | String | Yes | The speaker role, such as "customer" or "agent". |
words | String | Yes | The dialogue text content. |
identity | String | No | The speaker identity identifier (such as the agent employee ID). |
begin | Long | No | The relative offset of the sentence start time (in milliseconds). |
end | Long | No | The relative offset of the sentence end time (in milliseconds). |
beginTime | Date | No | The absolute start time of the sentence (yyyy-MM-dd HH:mm:ss). |
hourMinSec | String | No | The time in hour:minute:second format (HH:mm:ss). Required for phone call scenarios. |
emotionValue | Integer | No | The emotion energy value (1-10). |
speechRate | Integer | No | The speech rate (words per minute). |
silenceDuration | Integer | No | The silence duration (in seconds). |
3.3 AudioParam — Audio parameters
AgentTaskParam.AudioParam encapsulates audio-type input data.
| Field | Type | Required | Description |
fileUrl | String | Yes | The access URL of the audio file. |
fileName | String | No | The name of the audio file. |
asrVersion | String | No | The ASR (speech-to-text) engine version. |
4. InstructionTypeParam — Detailed description of instruction parameters
AgentManageParam.InstructionTypeParam carries different instruction configuration parameters based on the value of instructionType. Only fill in the sub-parameters corresponding to the current instructionType. Leave the other fields empty.
4.1 FieldsParam — Key attribute extraction (instructionType = "field")
| Field | Type | Required | Description |
nameDescPairList | List<NameDescPair> | Yes | The list of attribute dimensions to extract. |
NameDescPair structure:
| Field | Type | Description |
name | String | The attribute name (required). |
desc | String | The attribute description (optional). |
4.2 ServiceInspectionParam — Service inspection (instructionType = "serviceInspection")
| Field | Type | Required | Description |
sceneName | String | Yes | The inspection scenario name. |
sceneDescription | String | No | The inspection scenario description. |
dimensions | List<Dimension> | Yes | The list of inspection dimensions. |
Dimension structure:
| Field | Type | Description |
dimension | String | The dimension name (required). |
desc | String | The dimension description (optional). |
4.3 TagCategoryParam — Tag classification (instructionType = "tagCategory")
| Field | Type | Required | Description |
nameDescPairList | List<NameDescValueListPair> | Yes | The list of tag classification dimensions. |
NameDescValueListPair structure:
| Field | Type | Description |
name | String | The dimension name. |
desc | String | The dimension description. |
valueList | List<String> | The list of candidate tag values. |
4.4 CustomPrompt — Custom instruction (instructionType = "customPrompt")
| Field | Type | Required | Description |
customPrompt | String | Yes | The user-defined prompt template content. |
4.5 TagTreeLevelParam — Multi-level tag recognition (instructionType = "multiLevelTag")
| Field | Type | Required | Description |
tagIds | List<Long> | No | The list of runtime starting parent tag IDs. The first ID is used as the matched parent tag, and recognition starts from its child nodes level by level (skipping preceding levels). This field also takes effect when agentId is specified. |
tagTreeLevels | List<TagTreeLevelInfoParam> | Yes | The recognition configuration for each level, arranged in hierarchical order. |
TagTreeLevelInfoParam structure:
| Field | Type | Description |
tagTreeIds | List<Long> | The list of candidate tag IDs for this level. A value of -1 indicates that all tags at this level are selected (required). |
prompt | String | The analysis prompt for this level. This prompt is concatenated with tag data and sent to the large model (required). |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| RequestId |
string |
Id of the request |
106C6CA0-282D-4AF7-85F0-D2D24F4CE647 |
| Code |
string |
The result code. A value of 200 indicates success. Any other value indicates failure. You can use this field to determine the cause of failure. |
200 |
| Message |
string |
The error details when the request fails. The value is successful when the request succeeds. |
successful |
| Success |
boolean |
Indicates whether the request was successful. You can use this field to determine whether the request succeeded: true indicates success. false/null indicates failure. |
true |
| Data |
object |
The returned result. |
|
| TaskId |
string |
The task ID. |
7C1DEF5F-2C18-4D36-99C6-8*** |
| Vid |
string |
The session ID. |
6fa76916-3ce6-45d8-ac64-01b7f31*** |
Examples
Success response
JSON format
{
"RequestId": "106C6CA0-282D-4AF7-85F0-D2D24F4CE647",
"Code": "200",
"Message": "successful",
"Success": true,
"Data": {
"TaskId": "7C1DEF5F-2C18-4D36-99C6-8***",
"Vid": "6fa76916-3ce6-45d8-ac64-01b7f31***"
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.