CreateYaoChiAgentConfirm
Confirms or rejects a pending operation in an Alibaba Cloud ApsaraDB agent session.
Operation description
This operation responds to operation confirmation requests initiated by the ApsaraDB AI assistant during a session. It is not used to create sessions.
Call flow
Initiate a chat with the ApsaraDB AI assistant, save the session ID for the current round, and continuously read the chat response stream.
After receiving an event where toolName is humanConfirm in ui_function_call, read the pending confirmation ID from argsText.confirmation_id. Use the session ID of the event for SessionId. Do not use call_id or query_id in place of ConfirmationId.
Display the pending operation and its parameters to the user, and commit this request within the confirmation time limit. Approved=true indicates that you agree to continue the execution. Approved=false indicates that the current tool call is canceled, but the entire session is not shut down. Omit ToolArgs in the current version.
Keep the original chat response stream open and continue reading subsequent responses or errors until the response for the current round ends. You can also call DescribeYaoChiAgentChatRecords to query saved session messages later.
Limits
You must use the same caller identity and session ID that were used to initiate the confirmation request.
The default confirmation timeout is 120 seconds, subject to the server configuration. The tool call is automatically canceled after a timeout. A late approval cannot be used to resume the canceled execution.
Do not shut down the original chat stream before you commit the confirmation, and do not initiate a new chat round to resume the tool call. Disconnecting the original chat stream may cause the current task to be canceled.
Commit a decision for the same ConfirmationId only once. Do not use historical confirmation cards as replayable requests. If the confirmation record is invalid or cleared, the request may return Forbidden.Confirm when you commit it.
This operation only processes UUID confirmation identifiers in humanConfirm events and is not used for interruption recovery in other interaction protocols.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
hdm:CreateYaoChiAgentConfirm |
get |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ConfirmationId |
string |
Yes |
The unique identifier of the pending operation. Use the confirmation_id returned by the operation confirmation event in the ApsaraDB agent session. Do not generate it yourself. The value is a 36-character UUID with hyphens, in the format of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. |
123e4567-e89b-42d3-a456-426614174000 |
| Approved |
boolean |
Yes |
Specifies whether to approve the execution of the pending operation. Valid values:
This parameter is required. A rejection is also a valid confirmation response and does not indicate an API call failure. |
true |
| SessionId |
string |
Yes |
The session ID of the ApsaraDB agent session to which the pending operation belongs. It must be the same as the SessionId used when creating the session and initiating the chat, and must correspond to the session to which the ConfirmationId belongs. The format is a 36-character UUID with hyphens. |
a1b2c3d4-e5f6-4789-abcd-0123456789ab |
| ToolArgs |
string |
No |
The custom parameters of the tool. The example shows the parameter structure of the tool for modifying instance descriptions. The instance ID and description are desensitized and provided only for format reference. The current version does not support modifying tool parameters through this operation. Omit this parameter in actual calls and do not pass an empty string or a JSON string. When approving the execution, the original tool parameters generated by the assistant are used. |
{"db-instance-id":"rm-bp1xxxxxxxxxxxxxx","db-instance-description":"example-description","region":"cn-hangzhou"} |
Parameter constraints
ConfirmationId, SessionId, and Approved are required.
ConfirmationId and SessionId must be 36-character UUIDs with hyphens. The examples are provided only to demonstrate the format. In actual calls, use the ConfirmationId returned by the confirmation event and the actual SessionId used for the corresponding session.
The caller identity is determined by request authentication. You cannot specify other user identities through request parameters.
The current version does not support ToolArgs. Omit this parameter. Passing an empty string or a JSON string may cause the request to fail.
The approved field in the confirmation event is a string display status, not the boolean Approved parameter of this operation. Explicitly pass true or false.
Approval example
The following is an example of business parameters. Common request parameters are passed according to the OpenAPI call specifications.
{
"ConfirmationId": "123e4567-e89b-42d3-a456-426614174000",
"Approved": true,
"SessionId": "a1b2c3d4-e5f6-4789-abcd-0123456789ab"
}
To reject the execution, set Approved to false and still pass the original ConfirmationId and SessionId.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| RequestId |
string |
The unique identifier of the request, used for troubleshooting and log tracing. |
B6D17591-B48B-4D31-9CD6-9B9796B23456 |
| Status |
string |
The status string. The example value success refers to the outer success status of the downstream confirmation callback response and is provided only for format demonstration. It does not mean that the Status field of the current operation actually returns this value. In the current version, this field may be empty or not returned. Do not rely on this field to determine whether the execution is approved or whether the tool is executed successfully. |
success |
| ConfirmationId |
string |
The operation identifier for the submitted confirmation, which is the same as the ConfirmationId request parameter. |
123e4567-e89b-42d3-a456-426614174000 |
| Approved |
boolean |
The confirmation decision submitted in this request, which is the same as the Approved request parameter. A value of true indicates that the execution is approved, and false indicates that the execution is rejected. It does not indicate whether the tool operation is executed successfully. |
true |
| ToolArgsReceived |
boolean |
Specifies whether custom tool parameters are received. A value of true indicates that non-null parameters are provided, and false indicates that no parameters are provided. It does not indicate whether the parameters are applied or whether the tool is executed successfully. In the current version, omit the ToolArgs request parameter, and this field normally returns false. |
false |
A successful API call only indicates that the service has processed the confirmation callback. It does not indicate that the tool execution is completed or successful. Approved echoes the decision of the current request and is not the tool execution status. The echo of a repeated or late request does not prove that the decision actually takes effect. Continue reading the subsequent processing results in the original chat stream.
Currently, Status has no valid status values and may be empty or not returned. There are no reliable success, accepted, or confirmed enumerations. In current calls, omit ToolArgs, and ToolArgsReceived is normally false.
Success response example
{
"RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B23456",
"ConfirmationId": "123e4567-e89b-42d3-a456-426614174000",
"Approved": true,
"ToolArgsReceived": false
}
Rejecting the execution is also a successful confirmation callback, which returns Approved=false. The example omits the unassigned Status.
Common errors
| HTTP status code | Error code | Description |
| 400 | InvalidParameters.Format | A required parameter is missing, or the UUID format or parameter type is invalid. Check the returned message and request parameters. |
| 403 | Forbidden.Confirm | The current caller identity or session does not match the confirmation request, or the confirmation record does not exist, is invalid, or has been cleared. |
| 503 | ServiceUnavailable | The service is unavailable or the request processing fails. Passing a ToolArgs string in the current version may also trigger this error. Omit this parameter. |
A confirmation timeout is reflected as a cancellation result in the original chat stream and is not an independent 408 error code for this operation.
Examples
Success response
JSON format
{
"RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B23456",
"Status": "success",
"ConfirmationId": "123e4567-e89b-42d3-a456-426614174000",
"Approved": true,
"ToolArgsReceived": false
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.