Chat

Updated at:

Provides an asynchronous logic interface for DAS large language model capabilities.

Operation description

Before you begin:

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

  • When you use the SDK to call DAS, set the region to cn-shanghai.

  • Only database instances with DAS Enterprise Edition enabled support creating offline tasks. For the databases and regions supported by each edition of DAS Enterprise Edition, see DAS editions and supported features.

For more methods and examples of using the Chat API to interact with DAS Agent, see Best practices for DAS Agent interaction (Chat API integration).

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

No

The message.

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

SessionId

string

No

Optional. The session ID, which is a UUID string. If not specified, a new session is created by default. Keep the same session ID for contextual conversations.

123e4567-e89b-12d3-a456-xxxxxxxxxxxx

AgentId

string

No

Optional. The agent ID used for the service. You can specify the agent generated after enabling DAS Agent or a manually created agent. If not specified, the default agent is used.

ag-472T0DxtmjIxxxxx

Summary

string

No

Specifies whether to output summary information.

false

Resume

string

No

The user interaction feedback.

[{"metadata":{"a2uiClientDataModel":{"decided":true,"interaction":{"request":{"allowFreeText":true,"question":"question?","options":[{"label":"162 items","value":"162"},{"label":"242 items","value":"242"},{"label":"243 items","value":"243"},{"label":"486 items","value":"486"}]},"kind":"choice","interruptId":"5857955e-4856-4ab3-969e-f8b4c484bda4","status":"pending"},"free_text":""},"a2uiAction":{"name":"das_interaction_response","context":{"value":"162"},"surfaceId":"render-choice-7c03eb4f927f42ff8c30b30a2cc0797d","sourceComponentId":"opts-0","timestamp":"2026-09-15T06:54:15.556Z"}},"payload":{"value":"162"},"interruptId":"5857955e-4856-4ab3-969e-f8b4c484bda4","status":"resolved"}]

ForwardedProps

string

No

The forwarded properties.

{"enableInteractiveTools":true}

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 conversation role ID.

assistant

Delta

string

Indicates whether the content is incremental.

hello

ActivityType

string

The heartbeat.

waiting_for_agent_thinking

ToolCallId

string

The tool calling invoke ID.

call_edf9cdb69e0e4c9796a6a5a6

ToolCallName

string

The tool name.

das_api

Content

string

The response content.

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

ParentMessageId

string

The parent message ID.

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

ThreadId

string

The thread ID.

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

StepName

string

The execution step name.

sub_agent_performance_diagnose_mysql

RunId

string

The run ID.

ed7cb7b1-ddc8-45d7-9ff3-b315726cb5f7

TaskTrackerId

string

The callback tool class.

das_api

Name

string

The extension key.

summary

Value

any

The extension value.

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

ToolCallError

string

The fault that occurred during the tool calling invoke.

error

OriginatingToolCallId

string

The originating ID of the tool call.

ag-xxxx

AgentId

string

The agent ID.

agent-7f9c2a81

ParentAgentId

string

The parent agent ID.

agent-3a6f1c92

Label

string

The display name of the child agent for STEP_STARTED.

SQL performance diagnostics

Kind

string

The step type for STEP_STARTED, such as task.

task

StepStatus

string

The step status for STEP_FINISHED, such as completed.

completed

Timestamp

integer

The event timestamp.

1767225600000

Message

string

[HdmApiClient] instance is not managed by the agent

[HdmApiClient] instance is not managed by the agent

Code

string

direct_skill_rejected

direct_skill_rejected

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}",
  "ToolCallError": "error",
  "OriginatingToolCallId": "ag-xxxx",
  "AgentId": "agent-7f9c2a81",
  "ParentAgentId": " agent-3a6f1c92",
  "Label": "SQL performance diagnostics",
  "Kind": "task",
  "StepStatus": "completed",
  "Timestamp": 1767225600000,
  "Message": "[HdmApiClient] instance is not managed by the agent",
  "Code": "direct_skill_rejected"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParams The request parameters are invalid. 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. You do not have the permission to perform this operation.
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.