RespondAgentAction

Updated at:

Responds to pending confirmation actions (approvals) or clarification questions generated during an agent run to allow the agent to continue execution.

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

odps:RespondAgentAction

create

*All Resource

*

None None

Request syntax

POST /api/v1/ai/chat/respond HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

body

object

No

The request body.

conversationId

string

Yes

The conversation ID.

123456789012****#cn-shanghai#1ee04bea-0488-46b6-b85b-827e3cd37e55

actionId

string

Yes

The ID of the action to respond to. This value is obtained from the action_id field of the action event in the ChatSse event stream.

exec:01J5ZKQ8M7N2P4R6T8V0W2X4Y6

decision

string

Yes

The approval decision. This parameter is required for approval actions. Valid values: allow-once (allows the action this time) and deny (rejects the action). The value allow-always is not accepted. This field is ignored for question actions. Use optionIds and freeText to answer questions instead.

allow-once

actionKind

string

No

The action type. Valid values: exec (command execution approval), plugin (plugin operation approval), and question (clarification question). If this parameter is not specified, the type is inferred from the prefix of the actionId.

exec

responseText

string

No

A reserved field. The server does not consume this field.

Supplementary description

agentType

string

No

The agent type. Valid values: MaxAgent (default, MaxCompute intelligent assistant) and DataAgent (data analytics agent).

DataAgent

optionIds

array

No

The list of option IDs for question actions. A maximum of six options are allowed. For single-choice questions, a maximum of one option is allowed. You can specify zero options, but you must provide a non-empty freeText value in this case.

string

No

The option ID, which is obtained from the option list provided in the clarification question event.

opt-1

freeText

string

No

The free-text answer for question actions. The maximum length is 2,048 characters. This parameter is accepted only when the question allows free-text answers.

Analyze the data for the last 30 days

Response elements

Element

Type

Description

Example

object

PopResult

requestId

string

The request ID, which uniquely identifies the request and can be used for troubleshooting and log correlation.

A3F5B7C9-1D2E-4F6A-8B9C-0D1E2F3A4B5C

httpCode

integer

The business status code. This field is not returned if the call is successful. If the call fails, the corresponding HTTP error code is returned, such as 400, 403, 404, or 500.

400

errorCode

string

The error code. This field is not returned if the call is successful. If the call fails, a specific error code is returned to help locate the cause of the error.

InvalidParameter

errorMsg

string

The error message. This field is not returned if the call is successful. If the call fails, a human-readable error description is returned.

The specified parameter is invalid.

data

object

The response result.

success

boolean

Indicates whether the action was successfully responded to.

conversationId

string

The conversation ID.

123456789012****#cn-shanghai#1ee04bea-0488-46b6-b85b-827e3cd37e55

actionId

string

The ID of the responded action.

exec:01J5ZKQ8M7N2P4R6T8V0W2X4Y6

approvalKind

string

The action category. Valid values: exec, plugin, and question.

exec

decision

string

The effective decision. For approval actions, the value is allow-once or deny. For question actions, the value is resolved.

allow-once

runId

string

The agent run ID to which the action belongs. If no run is associated, an empty string is returned.

9f8e7d6c5b4a39281706f5e4d3c2b1a0

response

object

The detailed result of the action processing. If the response fails, this field contains the failure reason. Examples include empty_answer (no answer is provided for a question action) and unsupported_decision (the approval decision is not accepted, and allowedDecisions is returned to list the valid values).

status

string

The action processing status, such as resolved.

resolved

reason

string

The failure reason. For example, empty_answer indicates that no option or text answer was provided for a question action, and unsupported_decision indicates that the approval decision is not within the accepted range.

empty_answer

id

string

The action ID.

exec:01J5ZKQ8M7N2P4R6T8V0W2X4Y6

Examples

Success response

JSON format

{
  "requestId": "A3F5B7C9-1D2E-4F6A-8B9C-0D1E2F3A4B5C",
  "httpCode": 400,
  "errorCode": "InvalidParameter",
  "errorMsg": "The specified parameter is invalid.",
  "data": {
    "success": false,
    "conversationId": "123456789012****#cn-shanghai#1ee04bea-0488-46b6-b85b-827e3cd37e55",
    "actionId": "exec:01J5ZKQ8M7N2P4R6T8V0W2X4Y6",
    "approvalKind": "exec",
    "decision": "allow-once",
    "runId": "9f8e7d6c5b4a39281706f5e4d3c2b1a0",
    "response": {
      "status": "resolved",
      "reason": "empty_answer",
      "id": "exec:01J5ZKQ8M7N2P4R6T8V0W2X4Y6"
    }
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.