ReplyAgentSession
Submits the approval choice or question answer for the current pending interaction.
Operation description
Read
data.sessionId,data.requestId, anddata.optionsfrom thepermission_requestnotification of PromptAgentSession or LoadAgentSession. This operation uses the interaction ID, not the tool invocation ID or the server-side RequestId.When selecting an action, use the
optionIdactually provided in the notification. For Q&A scenarios, you must also write the question key and answer text intoanswers. Do not pass this field for regular tool approvals.accepted=trueonly indicates that the reply has been accepted. Subsequent output is still read through Prompt/Load.falseindicates that the reply is not adopted this time. You should reload the current interaction and not automatically change to approve other requests.
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.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
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ada:ReplyAgentSession |
update |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Jsonrpc |
string |
No |
The JSON-RPC version. Set this parameter to |
2.0 |
| Id |
string |
No |
The client call identifier used to associate the current response. This parameter does not provide idempotence guarantees. |
request-001 |
| Params |
any |
Yes |
The business parameter structure. For core nested fields, see the supplementary description. |
{"sessionId":"0123456789abcdef0123456789abcdef","permissionRequestId":"permission-example","outcome":{"outcome":"selected","optionId":"allow_once"}} |
The call method is POST, and the business parameters are located in formData. The region is determined by the client configuration. Action, Version, identity, and signature are handled by the POP client. The examples only show the business parameters. Params is serialized once as required by the SDK.
| Name | Type | Required | Description | Example |
Params.sessionId | string | Yes | The ID of the session to which the current interaction belongs. | 0123456789abcdef0123456789abcdef |
Params.permissionRequestId | string | Yes | The data.requestId of the current notification. | permission-example |
Params.outcome | any | Yes | The approval choice or cancellation result. | {"outcome":"selected","optionId":"allow_once"} |
Params.outcome.outcome | string | Yes | selected indicates that an action is selected. cancelled indicates that the current interaction is canceled. | selected |
Params.outcome.optionId | string | Conditionally required | Required when outcome=selected. The value is obtained from data.options[].optionId of the current notification. | allow_once |
Params.answers | any | No | The answer object used in Q&A scenarios. For the actual structure, see the following section. | {"0":"Analyze and explain recommendations only. Do not execute code."} |
Embedded structure of Params.answers
The actual type is a key-value object Map<string,string>, not an array or any multi-layer JSON. Preferentially use toolCall._meta.qwenAnswerKeys provided in the notification or the answerKey of the question. If the notification does not provide an answer key, fill in the zero-based index string of the question.
| Name | Type | Required | Description | Example |
Params.answers.<question key> | string | Conditionally required | Fill in this parameter when answering the corresponding question. The key name is subject to the current notification. The answer text of the corresponding question. Multiple-choice answers are still encoded as strings as required by the current interaction. Do not change them to arrays. | Analyze and explain recommendations only. Do not execute code. |
Only reply to interactions that are still valid this time. The IDs, options, and answer keys in the examples must be replaced with actual notification values. Canceling an interaction is not the same operation as calling CancelAgentSession to cancel execution.
Request examples
Common approval choice. The example assumes that the current notification actually provides allow_once:
{
"Jsonrpc": "2.0",
"Id": "request-001",
"Params": {
"sessionId": "0123456789abcdef0123456789abcdef",
"permissionRequestId": "permission-example",
"outcome": {
"outcome": "selected",
"optionId": "allow_once"
}
}
}
Cancel the current interaction. Omit optionId and answers:
{
"Jsonrpc": "2.0",
"Id": "request-001",
"Params": {
"sessionId": "0123456789abcdef0123456789abcdef",
"permissionRequestId": "permission-example",
"outcome": {
"outcome": "cancelled"
}
}
}
Answer a question. The example assumes that the current notification provides the answer key 0 and the action allow_once:
{
"Jsonrpc": "2.0",
"Id": "request-001",
"Params": {
"sessionId": "0123456789abcdef0123456789abcdef",
"permissionRequestId": "question-example",
"outcome": {
"outcome": "selected",
"optionId": "allow_once"
},
"answers": {
"0": "Analyze and explain recommendations only. Do not execute code."
}
}
}
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The ID of the current request, used for troubleshooting. |
0A1B2C3D-4E5F-6789-ABCD-EF0123456789 |
| JsonRpcResponse |
any |
The JSON-RPC response. For core embedded fields, see the supplementary description. |
{"jsonrpc":"2.0","id":"request-001","result":{"accepted":true}} |
| Success |
boolean |
Indicates whether the current API call is successful. This parameter cannot replace the business acceptance result. |
true |
| Name | Type | Description | Example |
JsonRpcResponse.jsonrpc | string | The JSON-RPC version. | 2.0 |
JsonRpcResponse.id | string | The Id of the echo request. | request-001 |
JsonRpcResponse.result | any | The reply acceptance result. | {"accepted":true} |
JsonRpcResponse.result.accepted | boolean | true indicates adopted, and false indicates not adopted. Neither indicates that the subsequent turn is completed. | true |
Situations such as the interaction being processed, unknown, or the session being busy may cause accepted=false. Do not automatically change to other approval decisions based on this.
Sample success responses
{
"RequestId": "0A1B2C3D-4E5F-6789-ABCD-EF0123456789",
"Success": true,
"JsonRpcResponse": {
"jsonrpc": "2.0",
"id": "request-001",
"result": {
"accepted": true
}
}
}
Examples
Success response
JSON format
{
"RequestId": "0A1B2C3D-4E5F-6789-ABCD-EF0123456789",
"JsonRpcResponse": "{\"jsonrpc\":\"2.0\",\"id\":\"request-001\",\"result\":{\"accepted\":true}}",
"Success": true
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter | The specified parameter is invalid. | |
| 401 | Unauthenticated | Authentication required. | |
| 500 | InternalError | Internal server error. | |
| 403 | Forbidden | You are not authorized to perform this operation. | |
| 404 | AgentSession.SessionNotFound | The specified agent session does not exist. | |
| 503 | ServiceUnavailable | The service is not ready or temporarily unavailable. |
See Error CodesError Codes for a complete list.
Release notes
See Release NotesRelease Notes for a complete list.