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 business workspace. |
123456 |
| JsonStr |
string |
No |
The complete JSON string. For more information, see the following detailed description. |
"" |
| Stream |
boolean |
No |
Specifies whether to enable Server-Sent Events (SSE) responses. Set to true to enable SSE responses. Default value: false. |
false |
1. Overview
Scenarios: When you invoke the ExecuteAgent operation, serialize the fields of this class into JSON and pass them in. The server routes to different instruction processors (key attribute extraction, service inspection, tag classification, and others) based on the instructionType value.
2. Top-level field description
| Field | Type | Required | Description |
vid | String | No | The session ID. If not specified, a value is automatically generated based on the current timestamp. |
modelType | String | Yes | The large language model type. |
agentId | Long | Yes | The agent configuration ID. |
inputType | String | Yes | The type of the analysis object. Valid values: text |
instructionType | String | Yes | The instruction type. Valid values: serviceInspection: service inspection. field: key attribute extraction. tagCategory: tag classification. customPrompt: custom instruction. |
instructionTypeParam | InstructionTypeParam | Yes | The parameters corresponding to the instruction type. Different instructionType values require different sub-parameters. For more information, see §4.1. |
taskParam | TaskParam | Yes | The task data parameters, which contain text dialogue or audio file information. For more information, see §3.1. |
3. Detailed description of nested classes.
3.1 TaskParam — Task data parameters
AgentTaskParam.TaskParam carries the input data for the current task. Different sub-parameters are used based on the inputType value.
| Field | Type | Description |
textParam | TextParam | The text parameters. Used when inputType = "text". |
callbackUrl | String | The callback URL for notification after the task is complete. Optional. |
3.2 TextParam — Text parameters
AgentTaskParam.TextParam encapsulates text-type input data.
| 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 "客户" / "客服". |
words | String | Yes | The dialogue text content. |
identity | String | No | The speaker identity, such as the agent ID. |
begin | Long | No | The relative offset of the start time of this sentence, in milliseconds. |
end | Long | No | The relative offset of the end time of this sentence, in milliseconds. |
beginTime | Date | No | The absolute start time of this sentence (yyyy-MM-dd HH:mm:ss). |
hourMinSec | String | No | The time in HH:mm:ss format. Required for phone call scenarios. |
emotionValue | Integer | No | The emotion energy value (1-10). |
speechRate | Integer | No | The speech rate in words per minute. |
silenceDuration | Integer | No | The silence duration in seconds. |
4. InstructionTypeParam — Detailed description of instruction parameters
AgentManageParam.InstructionTypeParam carries different instruction configuration parameters based on the instructionType value. You only need to specify 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 name of the inspection scenario. |
sceneDescription | String | No | The description of the inspection scenario. |
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 custom prompt template content. |
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 success. |
200 |
| Message |
string |
The error message returned when an error occurs. |
successful |
| Success |
boolean |
Indicates whether the request was successful. The caller can use this field to determine whether the request was successful. Valid values: true: The request was successful. false/null: The request failed. |
true |
| Data |
object |
The returned result. |
|
| LlmRequestId |
string |
The request ID returned by the large language model service. |
106C6CA0-282D-4AF7-85F0-D2D24*** |
| FinishReason |
string |
If streaming output is used, this value is null during generation. When generation is complete, the value is stop if the generation ended due to a stop token. |
stop |
| Text |
string |
The result returned by the large language model. |
这段对话似乎是客服与客户之间关于一个服务或产品的讨论,但具体内容难以明确理解,因为对话中的言语比较零散和抽象。 |
| 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 was used. |
1 |
| TyxmPlusCount |
string |
The number of times the plus model was 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.