GetAgentSessionModel

Updated at:
Copy as MD

Queries the model and thinking level configurations currently used by the session.

Operation description

  • Use the sessionId returned by CreateAgentSession to query the configurations. This operation does not send messages or replay session history.

  • Read the current model from JsonRpcResponse.result.modelId. To modify it, call SetAgentSessionModel.

  • The thinking level is an optional advanced configuration. The supported levels and current values are subject to the actual response of this operation, which may vary across different agents, models, and sessions.

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

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

ada:GetAgentSessionModel

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

Jsonrpc

string

No

The JSON-RPC version. Set the value to 2.0.

2.0

Id

string

No

The client request identifier, which is echoed in the response. It is used to associate this call and does not have idempotent semantics.

request-001

Params

any

Yes

The defined business parameter structure. For core nested fields, see the supplementary description.

{"sessionId":"0123456789abcdef0123456789abcdef"}

The request method is GET or POST, and the business parameters are located in the query. The region is determined by the client configuration. The example shows only the business parameters. Action, Version, identity, and signature are handled by the POP client, and Params is serialized once as required by the client.

NameTypeRequiredDescriptionExample
Params.sessionIdstringYesThe session ID returned by CreateAgentSession.0123456789abcdef0123456789abcdef

Request example

{
  "Jsonrpc": "2.0",
  "Id": "request-001",
  "Params": {
    "sessionId": "0123456789abcdef0123456789abcdef"
  }
}

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the request, which is used for troubleshooting.

0A1B2C3D-4E5F-6789-ABCD-EF0123456789

JsonRpcResponse

any

The defined JSON-RPC response structure. For core nested fields, see the supplementary description.

{"jsonrpc":"2.0","id":"request-001","result":{"modelId":"text-model-example","thinkingLevel":"off","thinkingLevels":["off","low","medium","high"]}}

The Models[].Id in the model catalog is used to submit a selection, while the modelId returned by the session indicates the actual effective configuration. The two may differ. The invoker should save the setting result and verify it against the modelId returned by subsequent GetAgentSessionModel invocations. Do not determine failure solely based on the inequality between the catalog ID and the session ID string, and do not concatenate or remove the provider suffix yourself.

The model configuration is located in JsonRpcResponse.result.

NameTypeDescriptionExample
JsonRpcResponse.jsonrpcstringThe JSON-RPC version. The current value is 2.0.2.0
JsonRpcResponse.idstringThe Id in the echo request.request-001
JsonRpcResponse.resultanyThe current model configuration structure.{"modelId":"text-model-example"}
JsonRpcResponse.result.modelIdstringThe identity of the model actually used by the current session.text-model-example
JsonRpcResponse.result.thinkingLevelstringOptional advanced configuration: the actual effective thinking level. Subject to the actual return value. The client should tolerate the absence of this field.off
JsonRpcResponse.result.thinkingLevelsarray<string>Optional advanced configuration: the thinking level options provided for the current session. An empty array or the absence of this field does not indicate that all levels are supported.["off","low","medium","high"]

The default level in the model catalog may differ from the current level of the session. After setting thinkingLevel=default, the query result may be the actual effective level after restoring the default configurations, rather than the string default.

Sample success responses

The model identifiers in the example are for illustration purposes only. Use the actual queried model identifiers when making calls.

{
  "RequestId": "0A1B2C3D-4E5F-6789-ABCD-EF0123456789",
  "JsonRpcResponse": {
    "jsonrpc": "2.0",
    "id": "request-001",
    "result": {
      "modelId": "text-model-example",
      "thinkingLevel": "off",
      "thinkingLevels": [
        "off",
        "low",
        "medium",
        "high"
      ]
    }
  }
}

Examples

Success response

JSON format

{
  "RequestId": "0A1B2C3D-4E5F-6789-ABCD-EF0123456789",
  "JsonRpcResponse": "{\"jsonrpc\":\"2.0\",\"id\":\"request-001\",\"result\":{\"modelId\":\"text-model-example\",\"thinkingLevel\":\"off\",\"thinkingLevels\":[\"off\",\"low\",\"medium\",\"high\"]}}"
}

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.