ExecuteAgent

Updated at:

Runs an agent.

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

No authorization for this operation. If you encounter issues with this operation, contact technical support.

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

FieldTypeRequiredDescription
vidStringNoThe session ID. If you do not specify this field, the current timestamp is used to automatically generate a session ID.
modelTypeStringYesThe type of the large language model.
agentIdLongYesThe ID of the agent configuration.
inputTypeStringYesThe type of the analysis object. Valid value: text.
instructionTypeStringYesThe instruction type. Valid values: serviceInspection (service quality inspection), field (key attribute extraction), tagCategory (tag classification), and customPrompt (custom instruction).
instructionTypeParamInstructionTypeParamYesThe parameters corresponding to the instruction type. Different instructionType values require different sub-parameters. For more information, see Section 4.1.
taskParamTaskParamYesThe 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.

FieldTypeDescription
textParamTextParamThe text parameters. Used when inputType is set to text.
callbackUrlStringThe 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.

FieldTypeDescription
dialogueList<Dialogue>The dialogue list. Each comment is a Dialogue object.

Dialogue object structure:

FieldTypeRequiredDescription
roleStringYesThe speaker role, such as "Customer" or "Agent".
wordsStringYesThe text content of the dialogue.
identityStringNoThe identity identifier of the speaker, such as the agent ID.
beginLongNoThe relative start time offset of the sentence in milliseconds.
endLongNoThe relative end time offset of the sentence in milliseconds.
beginTimeDateNoThe absolute start time of the sentence in the yyyy-MM-dd HH:mm:ss format.
hourMinSecStringNoThe time in the HH:mm:ss format. This field is required for phone call scenarios.
emotionValueIntegerNoThe emotion energy value. Valid values: 1 to 10.
speechRateIntegerNoThe speech rate in words per minute.
silenceDurationIntegerNoThe 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")

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

NameDescPair structure:

FieldTypeDescription
nameStringThe attribute name. This field is required.
descStringThe attribute description. This field is optional.

4.2 ServiceInspectionParam: Service quality inspection (instructionType = "serviceInspection")

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

Dimension structure:

FieldTypeDescription
dimensionStringThe dimension name. This field is required.
descStringThe dimension description. This field is 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 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.