ReplyAgentSession

Updated at:

Replies to a pending user interaction in a DataAgent session.

Operation description

Prerequisites

  • Call CreateAgentSession to create a session, and then call PromptAgentSession to establish a Server-Sent Events (SSE) connection to activate the DataAgent daemon. The daemon shares the same lifecycle as the SSE connection and is immediately released when the connection is disconnected.

  • If no active SSE connection exists, this operation cannot complete the reply and returns the error code 5225072769238040781.

  • Complete workflow: CreateAgentSession → PromptAgentSession (SSE) → Wait for the permission_request event → ReplyAgentSession.

Request description

  • This operation is used to reply to a permission_request issued by the DataAgent daemon. You can submit answers to ask_user_question or cancel the current interaction.

  • The PermissionRequestId must be obtained from the SSE event of the original PromptAgentSession (the params.data.requestId where params.kind=permission_request in the _qwen/notify event). Do not construct it manually.

  • The reply result only indicates whether the reply is accepted. Subsequent execution events are still returned through the SSE of the original PromptAgentSession. Do not submit duplicate replies for the same prompt round.

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

dataworks:ReplyAgentSession

none

*All Resource

*

None None

Request syntax

POST  HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

Jsonrpc

string

No

The JSON-RPC protocol version. Fixed to 2.0.

Valid values:

  • 2.0 :

    JSON-RPC 2.0

2.0

Id

string

Yes

The JSON-RPC correlation ID for this reply request. It is returned as-is in the response and is different from PermissionRequestId.

reply-rpc-001

Params

object

Yes

The user interaction reply parameters.

Answers

object

No

The answers to ask_user_question. The key is a 0-based string index of the question, and the value is the answer text. Fill in each question one by one for multiple questions. Omit this parameter for common tool authorization or cancellation.

{"0":"lakehouse_uat"}

string

No

The list of answers.

{"0":"key","1":"value"}

Outcome

object

Yes

The user processing result for the current interaction.

OptionId

string

No

Required and cannot be empty when Outcome is selected. Set this parameter to the optionId of the actual option in the options of the current event. When submitting an answer, the option with kind=allow_once is usually selected. Omit this parameter when Outcome is cancelled.

option-from-event

Outcome

string

Yes

The processing type. Valid values:

  • selected: An option is selected.

  • cancelled: The user explicitly cancels the interaction.

Valid values:

  • cancelled :

    Cancelled.

  • selected :

    Selected.

selected

PermissionRequestId

string

Yes

The ID of the current permission_request. Obtain this value from _qwen/notify.params.data.requestId of the original SSE. It is not ToolCallId, HTTP RequestId, or the current JSON-RPC Id. It cannot be . or ...

permission-001

SessionId

string

Yes

The LSP session ID. Use the SessionId returned when the session is created. It is not the internal session ID of the daemon.

lsp-session-001

Response elements

Element

Type

Description

Example

object

JsonRpcResponse

object

The JSON-RPC response. Returns Result on success and Error on protocol errors.

Error

object

The JSON-RPC fault message. For example, DAEMON_PERMISSION_UNAVAILABLE is returned when the daemon reply feature is not enabled.

Code

integer

The JSON-RPC error code.

-32601

Data

any

The optional additional error information. The content depends on the error type.

{}

ErrorCode

string

The business error code.

DAEMON_PERMISSION_UNAVAILABLE

Message

string

The error message.

DataAgent daemon permission reply is not enabled

Id

string

The JSON-RPC correlation ID for this reply request.

reply-rpc-001

Jsonrpc

string

The JSON-RPC protocol version.

2.0

Result

object

The reply processing result. It only indicates whether the current reply is accepted and does not indicate that the original task execution is completed.

Accepted

boolean

Indicates whether the daemon accepts the current reply. A value of true indicates that the reply is accepted. A value of false indicates that the reply is not accepted, which may be because the request is unknown, already processed, expired, or the session does not exist. You cannot determine the specific cause based on this value.

true

Timestamp

integer

The response time. It is a UNIX timestamp in milliseconds.

1789549200000

RequestId

string

The request ID for this call, which can be used for troubleshooting.

request-001

Examples

Success response

JSON format

{
  "JsonRpcResponse": {
    "Error": {
      "Code": -32601,
      "Data": "{}",
      "ErrorCode": "DAEMON_PERMISSION_UNAVAILABLE",
      "Message": "DataAgent daemon permission reply is not enabled"
    },
    "Id": "reply-rpc-001",
    "Jsonrpc": "2.0",
    "Result": {
      "Accepted": true
    },
    "Timestamp": 1789549200000
  },
  "RequestId": "request-001"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.