DeleteAgentSession

Updated at:

Deletes a specified agent session. This API operation is available only when the canary release feature is enabled. Before calling this operation, ensure that the canary release feature is enabled for the current account and the target region.

Operation description

This API operation is available only when the canary release feature is enabled. Before calling this operation, ensure that the canary release feature is enabled for the current account and the target region.

Verify the target session first. A deleted session cannot be recovered by unarchiving it through ArchiveAgentSession. To temporarily hide a session, use ArchiveAgentSession. To stop the current execution, use CancelAgentSession.

The caller must have access permissions for the current session and the corresponding OpenAPI action permissions. An HTTP 200 status code does not indicate a successful business operation. You must check JsonRpcResponse.Error for errors. The successful result is located in JsonRpcResponse.Result.

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:DeleteAgentSession

delete

*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. Set this parameter to 2.0 when you call the operation.

2.0

Id

string

No

The correlation identifier for the current JSON-RPC request generated by the caller. The identifier is returned as-is in the response. This field is not an idempotency token.

delete-rpc-001

Params

object

Yes

The session operation parameters. Serialize the parameters as a JSON object and submit them as a form field. The SessionId parameter must be included.

SessionId

string

Yes

The ID of the target session. Use the SessionId returned by CreateAgentSession or obtained from ListAgentSessions.

session_example

Response elements

Element

Type

Description

Example

object

The session operation response, which includes the OpenAPI request ID and the JSON-RPC business result.

JsonRpcResponse

object

The JSON-RPC response. Result is returned on success, and Error is returned on protocol errors.

Error

object

The JSON-RPC fault message. This field is not returned on success.

Code

integer

The JSON-RPC error code.

500

Data

any

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

{}

ErrorCode

string

The business error code.

0x4883300000000019

Message

string

The error message.

The session does not exist or the current account does not have access permissions. Return to the session list and select another session

Id

string

The JSON-RPC correlation identifier for the current request. It is passed by the caller and returned as-is.

delete-rpc-001

Jsonrpc

string

The JSON-RPC protocol version.

2.0

Result

any

An empty object is returned on successful deletion. If the deletion fails, check the sibling Error field.

{}

Timestamp

integer

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

1789549200000

RequestId

string

The OpenAPI request ID, which can be used to troubleshoot call failures.

01A0B6E0-E005-1465-B5DE-5CD17677426F

Examples

Success response

JSON format

{
  "JsonRpcResponse": {
    "Error": {
      "Code": 500,
      "Data": "{}",
      "ErrorCode": "0x4883300000000019",
      "Message": "The session does not exist or the current account does not have access permissions. Return to the session list and select another session"
    },
    "Id": "delete-rpc-001",
    "Jsonrpc": "2.0",
    "Result": "{}",
    "Timestamp": 1789549200000
  },
  "RequestId": "01A0B6E0-E005-1465-B5DE-5CD17677426F"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.