CreateAgentTask

Updated at:

Creates an Agent batch task for conversation analysis. Application calls support HTTP invocations to complete customer responses.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

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

FieldTypeRequiredDescription
vidStringNoThe session ID. If not specified, a value is automatically generated using the current timestamp.
modelTypeStringYesThe large model type.
agentIdLongYesThe Agent configuration ID.
inputTypeStringYesThe analysis object type. Valid values: audio (speech) and text (text).
instructionTypeStringYesThe instruction type. Valid values: serviceInspection (service inspection), field (key attribute extraction), tagCategory (tag classification), multiLevelTag (multi-level tag recognition), and customPrompt (custom instruction).
instructionTypeParamInstructionTypeParamYesThe parameters corresponding to the instruction type. Different instructionType values require different sub-parameters (see §4.1).
taskParamTaskParamYesThe 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.

FieldTypeDescription
textParamTextParamThe text parameters. Used when inputType = "text".
audioParamAudioParamThe audio parameters. Used when inputType = "audio".
callbackUrlStringThe callback notification URL after the task is completed (optional).

Usage rules:

  • When inputType = "text", you must provide textParam.

  • When inputType = "audio", you must provide audioParam.

  • textParam and audioParam are mutually exclusive. Provide only one of them for a single task.

3.2 TextParam — Text parameters

AgentTaskParam.TextParam encapsulates text-type input data.

FieldTypeDescription
dialogueList<Dialogue>The dialogue list. Each entry is a Dialogue object.
dialogueContentStringThe raw dialogue text string. Provide either this field or dialogue. At least one must be specified.

Dialogue object structure:

FieldTypeRequiredDescription
roleStringYesThe speaker role, such as "customer" or "agent".
wordsStringYesThe dialogue text content.
identityStringNoThe speaker identity identifier (such as the agent employee ID).
beginLongNoThe relative offset of the sentence start time (in milliseconds).
endLongNoThe relative offset of the sentence end time (in milliseconds).
beginTimeDateNoThe absolute start time of the sentence (yyyy-MM-dd HH:mm:ss).
hourMinSecStringNoThe time in hour:minute:second format (HH:mm:ss). Required for phone call scenarios.
emotionValueIntegerNoThe emotion energy value (1-10).
speechRateIntegerNoThe speech rate (words per minute).
silenceDurationIntegerNoThe silence duration (in seconds).

3.3 AudioParam — Audio parameters

AgentTaskParam.AudioParam encapsulates audio-type input data.

FieldTypeRequiredDescription
fileUrlStringYesThe access URL of the audio file.
fileNameStringNoThe name of the audio file.
asrVersionStringNoThe 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")

FieldTypeRequiredDescription
nameDescPairListList<NameDescPair>YesThe list of attribute dimensions to extract.

NameDescPair structure:

FieldTypeDescription
nameStringThe attribute name (required).
descStringThe attribute description (optional).

4.2 ServiceInspectionParam — Service inspection (instructionType = "serviceInspection")

FieldTypeRequiredDescription
sceneNameStringYesThe inspection scenario name.
sceneDescriptionStringNoThe inspection scenario description.
dimensionsList<Dimension>YesThe list of inspection dimensions.

Dimension structure:

FieldTypeDescription
dimensionStringThe dimension name (required).
descStringThe dimension description (optional).

4.3 TagCategoryParam — Tag classification (instructionType = "tagCategory")

FieldTypeRequiredDescription
nameDescPairListList<NameDescValueListPair>YesThe list of tag classification dimensions.

NameDescValueListPair structure:

FieldTypeDescription
nameStringThe dimension name.
descStringThe dimension description.
valueListList<String>The list of candidate tag values.

4.4 CustomPrompt — Custom instruction (instructionType = "customPrompt")

FieldTypeRequiredDescription
customPromptStringYesThe user-defined prompt template content.

4.5 TagTreeLevelParam — Multi-level tag recognition (instructionType = "multiLevelTag")

FieldTypeRequiredDescription
tagIdsList<Long>NoThe 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.
tagTreeLevelsList<TagTreeLevelInfoParam>YesThe recognition configuration for each level, arranged in hierarchical order.

TagTreeLevelInfoParam structure:

FieldTypeDescription
tagTreeIdsList<Long>The list of candidate tag IDs for this level. A value of -1 indicates that all tags at this level are selected (required).
promptStringThe 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.