DeleteAgentSession
Deletes an idle session that is no longer needed.
Operation description
A session cannot be directly deleted while it is being executed or waiting for interaction. You must first call CancelAgentSession and continue reading the original response stream, or resume reading through LoadAgentSession. Delete the session only after confirming that the target turn has ended.
A successful deletion indicates that the session deletion operation is complete, but it does not mean that external operations that have already occurred are rolled back. Deleting a session does not delete the associated agent or assistant.
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:DeleteAgentSession |
delete |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Jsonrpc |
string |
No |
The JSON-RPC protocol version. Set this parameter to |
2.0 |
| Id |
string |
No |
The correlation identifier for this call, which is echoed in the response. This parameter does not provide idempotence guarantees. |
request-001 |
| Params |
any |
Yes |
The business parameter object. For nested fields, refer to the supplementary description of request parameters. |
{"sessionId":"0123456789abcdef0123456789abcdef"} |
The call method is POST, and the business parameters are located in formData. The example shows only the business parameters. Action, Version, signature, and identity information are handled by the POP client. The region is determined by the client configuration. Structure fields are serialized once as required by the SDK.
| Name | Type | Required | Description | Example |
Params.sessionId | string | Yes | The ID of the session to be deleted. | 0123456789abcdef0123456789abcdef |
Request example
{
"Jsonrpc": "2.0",
"Id": "request-001",
"Params": {
"sessionId": "0123456789abcdef0123456789abcdef"
}
}
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The server-side request ID, which is used to troubleshoot this call. |
0A1B2C3D-4E5F-6789-ABCD-EF0123456789 |
| JsonRpcResponse |
any |
The response object. The business result is located in |
{"jsonrpc":"2.0","id":"request-001","result":{"sessionId":"0123456789abcdef0123456789abcdef"}} |
| Success |
boolean |
Indicates whether the operation is successful. Determine the final execution state based on the description of this operation. |
true |
Optional fields may not be returned. Refer to the actual response.
| Name | Type | Description | Example |
JsonRpcResponse.jsonrpc | string | The JSON-RPC protocol version. | 2.0 |
JsonRpcResponse.id | string | The call identifier corresponding to the request Id. | request-001 |
JsonRpcResponse.result | any | The deletion result. | {"sessionId":"0123456789abcdef0123456789abcdef"} |
JsonRpcResponse.result.sessionId | string | The ID of the deleted session. | 0123456789abcdef0123456789abcdef |
If AgentSession.SessionBusy is returned, process the turn that is still being executed or waiting for interaction before retrying the deletion. Retain the original sessionId when the request result is unknown to avoid retrying for other sessions.
Sample success response
{
"RequestId": "0A1B2C3D-4E5F-6789-ABCD-EF0123456789",
"Success": true,
"JsonRpcResponse": {
"jsonrpc": "2.0",
"id": "request-001",
"result": {
"sessionId": "0123456789abcdef0123456789abcdef"
}
}
}
Examples
Success response
JSON format
{
"RequestId": "0A1B2C3D-4E5F-6789-ABCD-EF0123456789",
"JsonRpcResponse": "{\"jsonrpc\":\"2.0\",\"id\":\"request-001\",\"result\":{\"sessionId\":\"0123456789abcdef0123456789abcdef\"}}",
"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. | |
| 409 | AgentSession.SessionBusy | A turn is already running in the agent session. |
See Error CodesError Codes for a complete list.
Release notes
See Release NotesRelease Notes for a complete list.