CancelAgentChat
Stops the ongoing agent generation in a specified conversation and clears pending confirmation operations.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
odps:CancelAgentChat |
create |
*All Resource
|
None | None |
Request syntax
POST /api/v1/ai/chat/cancel HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| body |
object |
No |
The cancellation request body. |
|
| conversationId |
string |
No |
The ID of the conversation to stop. |
123456789012****#cn-shanghai#1ee04bea-0488-46b6-b85b-827e3cd37e55 |
| agentType |
string |
No |
The agent type. Valid values: MaxAgent (default, MaxCompute intelligent assistant) and DataAgent (data analytics agent). |
DataAgent |
| expectedTurnId |
string |
No |
The ID of the turn to cancel, which can be up to 128 characters in length. If you specify this parameter, only the run corresponding to this turn is canceled. This prevents accidental cancellation of newly initiated turns in the same conversation. If you do not specify this parameter, the current active run is canceled. |
9f8e7d6c5b4a39281706f5e4d3c2b1a0 |
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 identify 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 cancellation result. |
|
| success |
boolean |
Indicates whether the generation is successfully stopped. |
|
| conversationId |
string |
The conversation ID. |
123456789012****#cn-shanghai#1ee04bea-0488-46b6-b85b-827e3cd37e55 |
| openclawCancelled |
string |
Indicates whether the cancellation request is successfully propagated to the agent runtime. |
true |
| runId |
string |
The ID of the canceled agent run. An empty string is returned if no active run is canceled. |
9f8e7d6c5b4a39281706f5e4d3c2b1a0 |
| reason |
string |
The reason for the cancellation failure or why no cancellation occurred. An empty string is returned if the cancellation is successful. If expectedTurnId is specified and the turn has already ended, TURN_ENDED is returned. |
TURN_ENDED |
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",
"openclawCancelled": "true",
"runId": "9f8e7d6c5b4a39281706f5e4d3c2b1a0",
"reason": "TURN_ENDED"
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.