All Products
Search
Document Center

Database Autonomy Service:Chat

Last Updated:May 22, 2026

An asynchronous API to access the large language model capabilities of DAS.

Operation description

Prerequisites:

  • Use the latest version of the Alibaba Cloud SDK or the DAS SDK.

  • When you use an SDK to call the DAS service, you must specify the region as cn-shanghai.

  • You can create offline tasks only for database instances that have DAS Enterprise Edition enabled. For information about the databases and regions that are supported by different versions of DAS Enterprise Edition, see DAS product editions and features.

For more information about using the Chat API with DAS Agent, see Best practices for DAS Agent interaction (integrating with the Chat API).

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

hdm:Chat

get

*All Resource

*

None None

Request syntax

POST /chat HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

Message

string

Yes

The message object.

{"id":"68fe0321-37fe-4c75-a118-b61b33156f6a","role":"user","content":[{"type":"text","text":"hello"}]}

SessionId

string

No

Optional. The session ID, which must be a UUID. If unspecified, a new session is created. To maintain conversational context, use the same session ID for all subsequent requests.

123e4567-e89b-12d3-a456-xxxxxxxxxxxx

AgentId

string

No

Optional. The agent ID. You can use the ID of an agent that is automatically generated when you enable DAS Agent, or the ID of a custom agent. If this parameter is omitted, the default agent is used.

ag-472T0DxtmjIxxxxx

Summary

string

No

Specifies whether to return summary information.

false

Response elements

Element

Type

Description

Example

object

Schema of Response

Type

string

The event type.

TEXT_MESSAGE_CONTENT

MessageId

string

The message ID.

61820b594664275c4429****

Role

string

The role in the conversation.

assistant

Delta

string

The incremental content of the response.

hello

ActivityType

string

Indicates the current activity status of the agent.

waiting_for_agent_thinking

ToolCallId

string

The tool call ID.

call_edf9cdb69e0e4c9796a6a5a6

ToolCallName

string

The name of the tool.

das_api

Content

string

The content of the response.

I see you have several PolarDB instances, and I will query them for you shortly

ParentMessageId

string

The ID of the parent message.

76bee207-31ee-4707-8851-6b9d4da033aa

ThreadId

string

The thread ID.

8e481be1-21d5-4a92-a2fb-fb54be0ab4f6

StepName

string

The name of the execution step.

sub_agent_performance_diagnose_mysql

RunId

string

The run ID.

ed7cb7b1-ddc8-45d7-9ff3-b315726cb5f7

TaskTrackerId

string

The identifier of the callback tool.

das_api

Name

string

The key for the additional information.

summary

Value

any

The value of the additional information.

{"CharCount":393,"End":1777428785996,"RequestId":"BE59AED5-D831-5811-BBAD-590B917B2089","SessionId":"123e4567-e89b-12d3-a456-xxxxxxxxxxxx","Start":1777428707927}

Examples

Success response

JSON format

{
  "Type": "TEXT_MESSAGE_CONTENT",
  "MessageId": "61820b594664275c4429****",
  "Role": "assistant",
  "Delta": "hello",
  "ActivityType": "waiting_for_agent_thinking",
  "ToolCallId": "call_edf9cdb69e0e4c9796a6a5a6",
  "ToolCallName": "das_api",
  "Content": "I see you have several PolarDB instances, and I will query them for you shortly",
  "ParentMessageId": "76bee207-31ee-4707-8851-6b9d4da033aa",
  "ThreadId": "8e481be1-21d5-4a92-a2fb-fb54be0ab4f6",
  "StepName": "sub_agent_performance_diagnose_mysql",
  "RunId": "ed7cb7b1-ddc8-45d7-9ff3-b315726cb5f7",
  "TaskTrackerId": "das_api",
  "Name": "summary",
  "Value": "{\"CharCount\":393,\"End\":1777428785996,\"RequestId\":\"BE59AED5-D831-5811-BBAD-590B917B2089\",\"SessionId\":\"123e4567-e89b-12d3-a456-xxxxxxxxxxxx\",\"Start\":1777428707927}"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParams The request parameters are invalid.
500 Timeout The request processing has failed due to timeout. Request processing failed due to timeout.
403 NoPermission You are not authorized to do this action.
404 InstanceNotFound Requested instance not found. The corresponding instance ID cannot be found.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.