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 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

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

FieldTypeDescription
textParamTextParamThe text parameters. Used when inputType = "text".
callbackUrlStringThe callback URL for notification after the task is complete. Optional.

3.2 TextParam — Text parameters

AgentTaskParam.TextParam encapsulates text-type input data.

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

Dialogue object structure:

FieldTypeRequiredDescription
roleStringYesThe speaker role, such as "客户" / "客服".
wordsStringYesThe dialogue text content.
identityStringNoThe speaker identity, such as the agent ID.
beginLongNoThe relative offset of the start time of this sentence, in milliseconds.
endLongNoThe relative offset of the end time of this sentence, in milliseconds.
beginTimeDateNoThe absolute start time of this sentence (yyyy-MM-dd HH:mm:ss).
hourMinSecStringNoThe time in HH:mm:ss format. Required for phone call scenarios.
emotionValueIntegerNoThe emotion energy value (1-10).
speechRateIntegerNoThe speech rate in words per minute.
silenceDurationIntegerNoThe 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")

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 name of the inspection scenario.
sceneDescriptionStringNoThe description of the inspection scenario.
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 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.