ExecuteAgent
Runs an agent.
Try it now
Test
RAM authorization
Request syntax
POST HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| BaseMeAgentId |
integer |
No |
The ID of the workspace. |
123456 |
| JsonStr |
string |
No |
The complete JSON string. For more information, see the following details. |
"" |
| Stream |
boolean |
No |
Specifies whether to enable Server-Sent Events (SSE) responses. Default value: false. |
false |
1. Overview
Scenarios: When you call the ExecuteAgent operation, serialize the fields of this class into a JSON string and pass it in the request. The server routes the request to different instruction processors (such as key attribute extraction, service quality inspection, and tag classification) based on the instructionType.
2. Top-level fields
| Field | Type | Required | Description |
vid | String | No | The session ID. If you do not specify this field, the current timestamp is used to automatically generate a session ID. |
modelType | String | Yes | The type of the large language model. |
agentId | Long | Yes | The ID of the agent configuration. |
inputType | String | Yes | The type of the analysis object. Valid value: text. |
instructionType | String | Yes | The instruction type. Valid values: serviceInspection (service quality inspection), field (key attribute extraction), tagCategory (tag classification), and customPrompt (custom instruction). |
instructionTypeParam | InstructionTypeParam | Yes | The parameters corresponding to the instruction type. Different instructionType values require different sub-parameters. For more information, see Section 4.1. |
taskParam | TaskParam | Yes | The task data parameters, which include the text dialogue or audio file information. For more information, see Section 3.1. |
3. Nested classes.
3.1 TaskParam: Task data parameters
AgentTaskParam.TaskParam contains the input data for the current task. Different sub-parameters are used based on the inputType.
| Field | Type | Description |
textParam | TextParam | The text parameters. Used when inputType is set to text. |
callbackUrl | String | The callback URL for task completion notifications. This field is optional. |
3.2 TextParam: Text parameters
AgentTaskParam.TextParam encapsulates the input data of the text type.
| Field | Type | Description |
dialogue | List<Dialogue> | The dialogue list. Each comment is a Dialogue object. |
Dialogue object structure:
| Field | Type | Required | Description |
role | String | Yes | The speaker role, such as "Customer" or "Agent". |
words | String | Yes | The text content of the dialogue. |
identity | String | No | The identity identifier of the speaker, such as the agent ID. |
begin | Long | No | The relative start time offset of the sentence in milliseconds. |
end | Long | No | The relative end time offset of the sentence in milliseconds. |
beginTime | Date | No | The absolute start time of the sentence in the yyyy-MM-dd HH:mm:ss format. |
hourMinSec | String | No | The time in the HH:mm:ss format. This field is required for phone call scenarios. |
emotionValue | Integer | No | The emotion energy value. Valid values: 1 to 10. |
speechRate | Integer | No | The speech rate in words per minute. |
silenceDuration | Integer | No | The silence duration in seconds. |
4. InstructionTypeParam: Instruction parameters
AgentManageParam.InstructionTypeParam contains different instruction configuration parameters based on the instructionType. You only need to specify the sub-parameters that correspond to the current instructionType and leave 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 be extracted. |
NameDescPair structure:
| Field | Type | Description |
name | String | The attribute name. This field is required. |
desc | String | The attribute description. This field is optional. |
4.2 ServiceInspectionParam: Service quality inspection (instructionType = "serviceInspection")
| Field | Type | Required | Description |
sceneName | String | Yes | The name of the quality inspection scenario. |
sceneDescription | String | No | The description of the quality inspection scenario. |
dimensions | List<Dimension> | Yes | The list of quality inspection dimensions. |
Dimension structure:
| Field | Type | Description |
dimension | String | The dimension name. This field is required. |
desc | String | The dimension description. This field is 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 content of the custom prompt template. |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| RequestId |
string |
Id of the request |
F190ADE9-619A-447D-84E3-7E241A5C428E |
| Code |
string |
The status code. A value of 200 indicates that the request is successful. |
200 |
| Message |
string |
The error message returned when an error occurs. |
successful |
| Success |
boolean |
Indicates whether the request is successful. You can use this field to determine the request result. true indicates success. false or null indicates failure. |
true |
| Data |
object |
The returned data. |
|
| LlmRequestId |
string |
The request ID returned by the large language model service. |
106C6CA0-282D-4AF7-85F0-D2D24*** |
| FinishReason |
string |
The reason why the generation finished. For streaming output, this field is null during generation. If the generation stops due to a stop token, the value is stop. |
stop |
| Text |
string |
The result returned by the large language model. |
This conversation appears to be a discussion between a customer service representative and a customer about a service or product, but the specific content is difficult to understand clearly because the language in the conversation is relatively fragmented and abstract |
| InputTokens |
integer |
The number of input tokens. |
100 |
| OutputTokens |
integer |
The number of output tokens. |
200 |
| TotalTokens |
integer |
The total number of tokens. |
300 |
| TyxmTurboCount |
string |
The number of times the turbo model is used. |
1 |
| TyxmPlusCount |
string |
The number of times the plus model is used. |
1 |
Examples
Success response
JSON format
{
"RequestId": "F190ADE9-619A-447D-84E3-7E241A5C428E",
"Code": "200",
"Message": "successful",
"Success": true,
"Data": {
"LlmRequestId": "106C6CA0-282D-4AF7-85F0-D2D24***",
"FinishReason": "stop",
"Text": "这段对话似乎是客服与客户之间关于一个服务或产品的讨论,但具体内容难以明确理解,因为对话中的言语比较零散和抽象。",
"InputTokens": 100,
"OutputTokens": 200,
"TotalTokens": 300,
"TyxmTurboCount": "1",
"TyxmPlusCount": "1"
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParam | Invalid Param %s . | Illegal parameter |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.