tencent cloud

Tencent Cloud Agent Development Platform

DokumentasiTencent Cloud Agent Development Platform

Chat API Documentation (WebSocket)

Download
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-07-15 17:00:32
WebSocket is a connection-oriented, full-duplex channel. Before establishing a connection, you need to obtain a token from the server. Using this token, you can establish a WebSocket connection with the server. The token is only valid during connection establishment and is discarded once the connection is successfully established.
Access Process Diagram:




1. Obtain the Token to establish a WebSocket connection

1.1 Calling Method

Call the GetWsToken API via the Tencent Cloud SDK to obtain a Token. Refer to the GetWsToken documentation for details.
Attention:
The obtained Token is only valid for a single session connection and will expire. Please establish a persistent connection promptly after obtaining the Token. If you need to establish other connections, you must reacquire a new Token.

1.2 How to Obtain AppKey

In the Application Management page, locate your application in the running state (must be published first), click Call, and a "Call Information" window will pop up.



In the Call Information window, you can see the AppKey. Click Copy to copy it.



2. Establish a WebSocket connection using the Token

Request URL: wss://wss.lke.tencentcloud.com/adp/v2/chat/conn/?language=zh-CN&EIO=4&transport=websocket
Protocol: Socket.IO v4 (Reference Documentation)

2.1 Establish a connection

After the WebSocket connection is successfully established, the server response packet is as follows:
0{"sid":"xxx","upgrades":[],"pingInterval":25000,"pingTimeout":5000}

2.2 Pass the token for authentication

Pass through Socket.IO's auth message passing.
After establishing the connection and receiving the server response packet, send the Token for authentication. The format of the Token to be sent is as follows:
40{"token":"xx-xx-xx-xx-xx"}

2.3 heartbeat packet processing

The heartbeat packet sent by the server is as follows ("2" is the content of the heartbeat packet):
2
At this point, the client needs to respond ("3" is the content that needs to be responded to):
3
Attention:
Socket.IO v4 has heartbeat packets that must be handled; otherwise, the connection will be disconnected by the server.


3. WebSocket Supported Events

The Socket.IO event format is as follows. Pay attention to its structure during implementation. It is recommended to use the standard Client provided by Socket.IO whenever possible.
42["Type",{event body}]

Example:
42["request",{dialogue request event body, see the data structures of the following different events}]

3.1 Dialogue Request Event

Event name: request
Event direction: frontend > backend
Attention:
Before a request event is sent, the application must be deployed first.
When a user sends a message (dialogue request event), the server returns a request acknowledgment event to confirm that the message has been received by the server, and correspondingly updates the Message ID, timestamp, and message desensitization.
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type is fixed as request.
Request
Yes
Request information.
Request
request information data structure:
Name
Type
Required or Not
Description
RequestId
String
No
Request ID, used to identify a request (for message correlation, it is recommended to use a different RequestId for each request).
To facilitate problem troubleshooting, it is recommended to be mandatory.
Parameter length: 32-64 characters.
Validation rule: ^[a-zA-Z0-9_-]{32,64}$, which can generally be generated using a uuid.
uuid example: 1b9c0b03-dc83-47ac-8394-b366e3ea67ef
ConversationId
String
Yes
Session ID, used to identify a session (provided by an external system, it is recommended that different user end sessions pass in different ConversationId, otherwise the message records of different users under the same application will be mixed up).
Parameter length: 32-64 characters.
Validation rule: ^[a-zA-Z0-9_-]{32,64}$, which can generally be generated using a uuid.
uuid example: 1b9c0b03-dc83-47ac-8394-b366e3ea67ef
Contents
Array of Content
Yes
List of message content information.
StreamingThrottle
Number
No
Streaming response frequency control: Controls the frequency of application response packets. This value indicates how many characters the application accumulates before a packet is returned to the caller. A smaller value results in more frequent packet returns (smoother experience but higher traffic overhead). When no value is provided or the value is 0, it defaults to the system configuration.
Default value: 5
Recommended maximum value: 100
Attention:
This setting does not accelerate the output time of large models either; it only changes the frequency of returning response packets to the caller. Therefore, if set too high, there may be no response packets for an extended period.
SystemRole
String
No
Role instruction (prompt). When it is left blank, the default setting in the application configuration is used; when it is filled, the current value is used.
Maximum value limit: Varies for different models. See the RoleLenLimit of the ListModel API.
Incremental
Boolean
No
Controls whether the text content of the response is returned as a text.delta event or a text.replace event. Default: false.
Attention:
When Incremental is true, text content is not entirely returned as text incremental events. The ADP backend returns a text replacement event when it detects a need to modify content that has already been returned.
SearchNetwork
String
No
Whether to enable online search. Valid values:
Empty string: Follow the application configuration.
enable: Enable online search
disable: Disable online search
Attention:
The value field is meaningless when online search is not enabled in application configuration.
ModelName
String
No
Support for passing a specified model during the conversation. Different model names can be passed under the same session_id to maintain contextual continuity.
Attention:
Ensure sufficient PU resources are available in your account to avoid errors during usage.
Stream
String
No
Whether to enable streaming transmission. Valid values:
Empty string: Follow the application configuration.
enable: Streaming
disable: Non-streaming
WorkflowStatus
String
No
Whether to enable workflow. Valid values:
Empty string: Follow the application configuration (The page has no entry point for configuring the workflow switch, and it is enabled by default).
enable: workflow
disable: workflow

Example:
[
"request",
{
"Type": "request",
"Request": {
"RequestId": "62bcA7Vknu-8384773123",
"ConversationId": "9a260889-5f6b-49db-ac49-e81148c98bcd",
"Contents": [{
"Type": "text",
"Text": "Generate a small cat picture for me"
}],
"Incremental": true
}
}
]

3.2 Request Confirmation Event

Event name: request_ack
Event direction: backend > frontend
Attention:
If a request event sent is intercepted due to security audit or because the request exceeds the concurrency limit, the backend will not return a request acknowledgment event but will return an error event.
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as request_ack.
RequestAck
Yes
Request acknowledgment information.
Example:
[
"request_ack",
{
"Type": "request_ack",
"RequestAck": {
"Role": "user",
"RecordId": "p9G_20251220_225838_112_Pr4FhDcR",
"ConversationId": "9a260889-5f6b-49db-ac49-e81148c98bcd",
"Status": "success",
"StatusDesc": "Request successful",
"Messages": [
{
"Type": "question",
"MessageId": "rpl_p9G_20251220_225838_112_Pr4FhDcR",
"Name": "question",
"Title": "User Question",
"Icon": "",
"Status": "success",
"StatusDesc": "",
"Contents": [
{
"Type": "text",
"Text": "Generate a small cat picture for me"
}
],
"ExtraInfo": {
"Elapsed": "0",
"StartTime": "1766242718000"
}
}
],
"ExtraInfo": {
"RequestId": "62bcA7Vknu-8384773123",
"TraceId": "77fc0a9ce9ba9f3b511ac28ad05b5bab / p9G_20251220_225838_112_Pr4FhDcR",
"Elapsed": "0",
"StartTime": "1766242718000",
"IsFromSelf": true,
"IsLlmGenerated": false,
"CanRating": false,
"CanFeedback": false,
"ReplyMethod": 0,
"FromName": "",
"FromAvatar": "",
"HasRead": false
}
}
}
]

3.3 Response to Event Creation

Event name: response.created
Event direction: backend > frontend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as response.created.
Response
Yes
Response information.
Example:
[
"response.created",
{
"Type": "response.created",
"Response": {
"Role": "assistant",
"RecordId": "09b_20251220_225838_205_QOy26o1I",
"RelatedRecordId": "p9G_20251220_225838_112_Pr4FhDcR",
"ConversationId": "9a260889-5f6b-49db-ac49-e81148c98bcd",
"Status": "processing",
"StatusDesc": "",
"ExtraInfo": {
"RequestId": "62bcA7Vknu-8384773123",
"TraceId": "77fc0a9ce9ba9f3b511ac28ad05b5bab / 09b_20251220_225838_205_QOy26o1I",
"Elapsed": "613",
"StartTime": "1766242718110",
"IsFromSelf": false,
"IsLlmGenerated": false,
"CanRating": false,
"CanFeedback": false,
"ReplyMethod": 0,
"FromName": "",
"FromAvatar": "",
"HasRead": false
}
}
}
]

3.4 Response processing event

Event name: response.processing
Event direction: backend > frontend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as response.processing.
Response
Yes
Response information.
Example:
[
"response.processing",
{
"Type": "response.processing",
"Response": {
"Role": "assistant",
"RecordId": "09b_20251220_225838_205_QOy26o1I",
"RelatedRecordId": "p9G_20251220_225838_112_Pr4FhDcR",
"ConversationId": "9a260889-5f6b-49db-ac49-e81148c98bcd",
"Status": "processing",
"StatusDesc": "Invoke reasoning model",
"ExtraInfo": {
"RequestId": "62bcA7Vknu-8384773123",
"TraceId": "77fc0a9ce9ba9f3b511ac28ad05b5bab / 09b_20251220_225838_205_QOy26o1I",
"Elapsed": "3592",
"StartTime": "1766242718110",
"IsFromSelf": false,
"IsLlmGenerated": false,
"CanRating": false,
"CanFeedback": false,
"ReplyMethod": 0,
"FromName": "",
"FromAvatar": "",
"HasRead": false
}
}
}
]

3.5 Message Addition Event

Event name: message.added
Event direction: backend > frontend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as message.added.
Message
Yes
Message information.
Example:
[
"message.added",
{
"Type": "message.added",
"Message": {
"Type": "thought",
"MessageId": "prc_09b_20251220_225838_205_QOy26o1I_0",
"Name": "thought",
"Title": "Reasoning",
"Icon": "https://lke-realtime-1251316161.cos.ap-guangzhou.myqcloud.com/icon/thinking.png",
"Status": "processing",
"StatusDesc": "Reasoning in progress",
"ExtraInfo": {
"Elapsed": "1785",
"StartTime": "1766242718724",
"AgentName": "TT Expert Intelligent Agent - Mo Jiao - prod"
"AgentIcon": "https://qidian-qbot-1251316161.cos.ap-guangzhou.myqcloud.com/public/1864611313395171328/1937770498688842432/image/KxWmEzYIEKTUASYsrNmK-1939497567585093952.png"
}
}
}
]

3.6 Message Processing Event

Event name: message.processing
Event direction: backend > frontend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as message.processing.
MessageId
String
Yes
Message ID in progress.
Message
Yes
Message status information.
Example:
[
"message.processing",
{
"Type": "message.processing",
"MessageId": "prc_09b_20251220_225838_205_QOy26o1I_0",
"Message": {
"Type": "thought",
"MessageId": "prc_09b_20251220_225838_205_QOy26o1I_0",
"Name": "thought",
"Title": "Reasoning",
"Icon": "https://lke-realtime-1251316161.cos.ap-guangzhou.myqcloud.com/icon/thinking.png",
"Status": "processing",
"StatusDesc": "Reasoning in progress",
"ExtraInfo": {
"Elapsed": "1887",
"StartTime": "1766242718724"
}
}
}
]

3.7 Content Addition Event

Event name: content.added
Event direction: backend > frontend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as content.added.
MessageId
String
Yes
Message ID corresponding to the content-added message.
ContentIndex
Number
Yes
Serial number of added content.
Content
Yes
Content information.
Example:
[
"content.added",
{
"Type": "content.added",
"MessageId": "prc_09b_20251220_225838_205_QOy26o1I_0",
"ContentIndex": 0,
"Content": {
"Type": "text",
"Text": "Current"
}
}
]

3.8 Text Content Incremental Event

Event name: text.delta
Event direction: backend > frontend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as text.delta.
MessageId
String
Yes
Message ID corresponding to the text-added message.
ContentIndex
Number
Yes
Serial number of added text content.
Text
String
Yes
Added text content.
Example:
[
"text.delta",
{
"Type": "text.delta",
"MessageId": "prc_09b_20251220_225838_205_QOy26o1I_0",
"ContentIndex": 0,
"Text": "Task"
}
]

3.9 Text Content Replacement Event

Event name: text.replace
Event direction: backend > frontend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as text.replace.
MessageId
String
Yes
Message ID corresponding to the replaced-text message.
ContentIndex
Number
Yes
Serial number of replaced text content.
Text
String
Yes
Replaced text content.
Example:
[
"text.replace",
{
"Type": "text.replace",
"MessageId": "prc_09b_20251220_225838_205_QOy26o1I_0",
"ContentIndex": 0,
"Text": "The current task is to generate for the user"
}
]

3.10 Message Processing Completed Event

Event name: message.done
Event direction: backend > frontend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as message.done.
MessageId
String
Yes
Processed Message ID.
Message
Yes
Processed message information.
Example:
[
"message.done",
{
"Type": "message.done",
"MessageId": "prc_09b_20251220_225838_205_QOy26o1I_0",
"Message": {
"Type": "thought",
"MessageId": "prc_09b_20251220_225838_205_QOy26o1I_0",
"Name": "thought",
"Title": "Reasoning",
"Icon": "https://lke-realtime-1251316161.cos.ap-guangzhou.myqcloud.com/icon/thinking.png",
"Status": "success",
"StatusDesc": "Reasoning completed",
"Contents": [
{
"Type": "text",
"Text": "The current task is to generate a small cat picture for the user. This does not directly involve image creation within my professional capabilities, but I have the ability to invoke the text-to-image tool to fulfill this requirement. The task is clear and should not ask the user for more information; directly execute the text-to-image process."
}
],
"ExtraInfo": {
"Elapsed": "2679",
"StartTime": "1766242718724",
"AgentName": "TT Expert Intelligent Agent - Mo Jiao - prod"
"AgentIcon": "https://qidian-qbot-1251316161.cos.ap-guangzhou.myqcloud.com/public/1864611313395171328/1937770498688842432/image/KxWmEzYIEKTUASYsrNmK-1939497567585093952.png"
}
}
}
]

3.11 Respond to completion events

Event name: response.completed
Event direction: backend > frontend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type is fixed as response.completed.
Response
Yes
Processed complete response content.
Example:
[
"response.completed",
{
"Type": "response.completed",
"Response": {
"Role": "assistant",
"RecordId": "09b_20251220_225838_205_QOy26o1I",
"RelatedRecordId": "p9G_20251220_225838_112_Pr4FhDcR",
"ConversationId": "9a260889-5f6b-49db-ac49-e81148c98bcd",
"Status": "success",
"StatusDesc": "Invoke reasoning model",
"Messages": [
{
"Type": "thought",
"MessageId": "prc_09b_20251220_225838_205_QOy26o1I_0",
"Name": "thought",
"Title": "Reasoning",
"Icon": "https://lke-realtime-1251316161.cos.ap-guangzhou.myqcloud.com/icon/thinking.png",
"Status": "success",
"StatusDesc": "Reasoning completed",
"Contents": [
{
"Type": "text",
"Text": "The current task is to generate a small cat picture for the user. This does not directly involve Image Creation within my professional capabilities, but I can invoke the text-to-image tool to fulfill this requirement. The task is clear and should not require additional user information; proceed directly with text-to-image execution."
}
],
"ExtraInfo": {
"Elapsed": "2679",
"StartTime": "1766242718724",
"AgentName": "TT Expert Intelligent Agent - Mo Jiao - prod"
"AgentIcon": "https://qidian-qbot-1251316161.cos.ap-guangzhou.myqcloud.com/public/1864611313395171328/1937770498688842432/image/KxWmEzYIEKTUASYsrNmK-1939497567585093952.png"
}
},
{
"Type": "tool_call",
"MessageId": "prc_09b_20251220_225838_205_QOy26o1I_1",
"Name": "Text-to-Image",
"Title": "Tool Execution",
"Icon": "https://qidian-qbot-1251316161.cos.ap-guangzhou.myqcloud.com/public/workflow-tool.svg",
"Status": "success",
"StatusDesc": "Tool Execution completed",
"Contents": [
{
"Type": "json_text",
"Text": "{\\"code\\":0,\\"msg\\":\\"ok\\",\\"output\\":\\"{\\\\\\"img_url\\\\\\":\\\\\\"https://edu-aigc-1307578727.cos.ap-guangzhou.tencentcos.cn/ai-image/2025-12-20/0df7d8d44ec94c3b87a87f132b421bb8.png\\\\\\",\\\\\\"request_id\\\\\\":\\\\\\"9dacdd61-485d-421d-8bd9-79449b85a1c2\\\\\\"}\\",\\"response\\":\\"\\"}"
}
],
"ExtraInfo": {
"Elapsed": "5231",
"StartTime": "1766242721713",
"ToolName": "Workflow/Text-to-Image",
"ToolIcon": "https://qidian-qbot-1251316161.cos.ap-guangzhou.myqcloud.com/public/workflow-tool.svg"
}
},
{
"Type": "thought",
"MessageId": "prc_09b_20251220_225838_205_QOy26o1I_2",
"Name": "thought",
"Title": "Reasoning",
"Icon": "https://lke-realtime-1251316161.cos.ap-guangzhou.myqcloud.com/icon/thinking.png",
"Status": "success",
"StatusDesc": "Reasoning completed",
"Contents": [
{
"Type": "text",
"Text": "I have used the text-to-image tool to generate a small cat picture and obtained the returned link. Next, I should directly display the image to the user, conclude with natural language, and then end the task."
}
],
"ExtraInfo": {
"Elapsed": "2190",
"StartTime": "1766242727002",
"AgentName": "TT Expert Intelligent Agent - Mo Jiao - prod"
"AgentIcon": "https://qidian-qbot-1251316161.cos.ap-guangzhou.myqcloud.com/public/1864611313395171328/1937770498688842432/image/KxWmEzYIEKTUASYsrNmK-1939497567585093952.png"
}
},
{
"Type": "reply",
"MessageId": "rpl_09b_20251220_225838_205_QOy26o1I",
"Name": "reply",
"Title": "",
"Icon": "",
"Status": "success",
"StatusDesc": "Reply completed",
"Contents": [
{
"Type": "text",
"Text": "Okay, together we conceived a warm and simple scene, presenting a cute little cat with soft colors, in a leisurely pose, embodying the charm of nature and life. Please see—\\n\\n![Cute Little Cat](https://edu-aigc-1307578727.cos.ap-guangzhou.tencentcos.cn/ai-image/2025-12-20/0df7d8d44ec94c3b87a87f132b421bb8.png)\\n\\nIn design, we often say that 'objects carry meaning, interest, and morality.' In fact, small animals can also become gentle companions and sources of inspiration in life. I hope this image brings you a moment of relaxation and joy."
}
],
"ExtraInfo": {
"Elapsed": "1549",
"StartTime": "1766242729698"
}
}
],
"Procedures": [
{
"Name": "thinking_model",
"Title": "Invoke reasoning model"
"Status": "success",
"IntentCate": "",
"ResourceStatus": 0,
"StatInfos": [
{
"InputTokens": 2884,
"OutputTokens": 86,
"TotalTokens": 2970,
"ModelName": "100021406304-OpenAI/ouFPaKKL"
}
],
"Type": "agent",
"Agent": {
"ModelName": "100021406304-OpenAI/ouFPaKKL",
"Input": "",
"Output": "[{\\"id\\":\\"call_af6a8234f2180102\\",\\"type\\":\\"function\\",\\"function\\":{\\"name\\":\\"Text-to-Image\\",\\"arguments\\":\\"{\\\\\\"prompt\\\\\\":\\\\\\"a cute little cat, with soft fur, in a leisurely pose, in a warm and simple scene, embodying the charm of nature and life\\\\\\"}\\"},\\"index\\":0}]\\n",
"Content": "",
"RewriteQuery": ""
}
},
{
"Name": "tool_call",
"Title": "Invoke Text-to-Image"
"Status": "success",
"IntentCate": "",
"ResourceStatus": 0,
"Type": "agent",
"Agent": {
"ModelName": "",
"Input": "{\\"name\\":\\"Text-to-Image\\",\\"arguments\\":\\"{\\\\\\"prompt\\\\\\":\\\\\\"a cute little cat, with soft fur, in a leisurely pose, in a warm and simple scene, embodying the charm of nature and life\\\\\\"}\\"}\\n",
"Output": "{\\"code\\":0,\\"msg\\":\\"ok\\",\\"output\\":\\"{\\\\\\"img_url\\\\\\":\\\\\\"https://edu-aigc-1307578727.cos.ap-guangzhou.tencentcos.cn/ai-image/2025-12-20/0df7d8d44ec94c3b87a87f132b421bb8.png\\\\\\",\\\\\\"request_id\\\\\\":\\\\\\"9dacdd61-485d-421d-8bd9-79449b85a1c2\\\\\\"}\\",\\"response\\":\\"\\"}",
"Content": "",
"RewriteQuery": ""
}
},
{
"Name": "thinking_model",
"Title": "Invoke reasoning model"
"Status": "success",
"IntentCate": "",
"ResourceStatus": 0,
"StatInfos": [
{
"InputTokens": 3072,
"OutputTokens": 168,
"TotalTokens": 3240,
"ModelName": "100021406304-OpenAI/ouFPaKKL"
}
],
"Type": "agent",
"Agent": {
"ModelName": "100021406304-OpenAI/ouFPaKKL",
"Input": "",
"Output": "[{\\"id\\":\\"call_fa9caa370c1d7aad\\",\\"type\\":\\"function\\",\\"function\\":{\\"name\\":\\"task_done\\",\\"arguments\\":\\"{\\\\\\"success\\\\\\": true, \\\\\\"final_response\\\\\\": \\\\\\"Okay, together we conceived a warm and simple scene, presenting a cute little cat with soft colors, in a leisurely pose, embodying the charm of nature and life. Please see—\\\\\\\\n\\\\\\\\n![Cute Little Cat](https://edu-aigc-1307578727.cos.ap-guangzhou.tencentcos.cn/ai-image/2025-12-20/0df7d8d44ec94c3b87a87f132b421bb8.png)\\\\\\\\n\\\\\\\\nIn design, we often say that 'objects carry meaning, interest, and morality.' In fact, small animals can also become gentle companions and sources of inspiration in life. I hope this image brings you a moment of relaxation and joy.\\\\\\"}\\"},\\"index\\":0}]\\n",
"Content": "",
"RewriteQuery": ""
}
}
],
"StatInfo": {
"InputTokens": 5956,
"OutputTokens": 254,
"TotalTokens": 6210,
"TotalCost": "13137"
},
"ExtraInfo": {
"RequestId": "62bcA7Vknu-8384773123",
"TraceId": "77fc0a9ce9ba9f3b511ac28ad05b5bab / 09b_20251220_225838_205_QOy26o1I",
"Elapsed": "13142",
"StartTime": "1766242718110",
"IsFromSelf": false,
"IsLlmGenerated": true,
"CanRating": true,
"CanFeedback": false,
"ReplyMethod": 18,
"FromName": "Expert Intelligent Agent Test",
"FromAvatar": "https://qidian-qbot-1251316161.cos.ap-guangzhou.myqcloud.com/public/1864611313395171328/1937770498688842432/image/KxWmEzYIEKTUASYsrNmK-1939497567585093952.png",
"HasRead": false
}
}
}
]

3.12 Badge Added Event

Event name: quote_info.added
Event direction: backend > frontend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as quote_info.added.
MessageId
String
Yes
The message ID corresponding to the message with added superscript.
ContentIndex
Number
Yes
The number of the added superscript content.
QuoteInfo
Yes
superscript information.
Example:
[
"quote_info.added",
{
"Type": "quote_info.added",
"MessageId": "rpl_Uty_20251223_003736_015_GV5QLEq4",
"ContentIndex": 0,
"QuoteInfo": {
"Position": 240,
"Index": 1
}
}
]

3.13 Citation Addition Event

Event name: reference.added
Event direction: backend > frontend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as reference.added.
MessageId
String
Yes
The message ID corresponding to the message with added citation content.
ContentIndex
Number
Yes
The number of the added citation content.
Reference
Yes
citation information.
Example:
[
"reference.added",
{
"Type": "reference.added",
"MessageId": "rpl_Uty_20251223_003736_015_GV5QLEq4",
"ContentIndex": 0,
"Reference": {
"Index": 1,
"Name": "Shenzhen University News - Shenzhen University",
"Type": 4,
"WebSearchRefer": {
"Url": "http://www.szu.edu.cn/index/sdxw.htm"
}
}
}
]

3.14 Error Event

Event name: error
Event direction: backend > frontend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as error.
Error
Yes
Error message.
Example:
[
"error",
{
"Type": "error",
"Error": {
"Code": 460501,
"Message": "I cannot answer this question. You can try asking me other questions.",
"RequestId": "A9EhrrijXs-5778188698",
"TraceId": "fda66d6df4cc43128ca76852cca66191",
"Elapsed": "165",
"StartTime": "1766421936159"
}
}
]

3.15 Like/Dislike event

Event name: rating
Event direction: frontend > backend, backend > frontend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as rating.
Rating
Yes
Like/Dislike information.
Example:
[
"rating",
{
"Type": "rating",
"Rating": {
"RequestId": "",
"RecordId": "09b_20251220_225838_205_QOy26o1I",
"Score": 2,
"Reasons": [
"Did not complete the task",
"Duplicate content output"
],
"TraceId": "cee10b07ef4a475f8cf86e1ee6206ac9",
"FeedbackContent": "Other"
}
}
]

3.16 Stop event generation

Event name: stop_generation
Event direction: frontend > backend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as stop_generation.
StopGeneration
Yes
Stop generating information.
Example:
[
"stop_generation",
{
"Type": "stop_generation",
"StopGeneration": {
"RecordId": "wie_20251220_232620_332_SFx4EfUp"
}
}
]

3.17 Reconnection event

Event name: reconnect
Event direction: frontend > backend, backend > frontend
Data structure:
Name
Type
Required or Not
Description
Type
String
Yes
Event type, fixed as reconnect.
Reconnect
Yes
Reconnect information.
Example:
[
"reconnect",
{
"Reconnect": {
"RequestId": "62bcA7Vknu-8384773123",
"RecordId": "fbY_20260126_171924_631_xPxGogj7"
}
}
]

4. Public data structure

Content

Data structure of message content information:
Name
Type
Required or Not
Description
Type
String
Yes
Message content type:
text: text
image: image
file: file
custom_variables: Custom input parameter information
widget_action: widget action information
Text
String
No
Text content.
Image
No
Image information.
File
No
File information.
CustomVariables
Map[String]String
No
Custom variables.
WidgetAction
No
Widget action information.
QuoteInfos
Array of QuoteInfo
No
Reference information (Optional).
References
Array of Reference
No
Reference information (Optional).
OptionCards
Array of String
No
Tab information (Optional).
CustomParams
Array of String
No
User-defined business parameter information (Optional).
Sandbox
No
Sandbox information.
WebSearch
No
Web search content.
FileCollection
No
File collection information.
RelatedRecordId
String
No
Associated RecordId.
Widget
No
Widget information.

Image

Data structure of image information:
Name
Type
Required or Not
Description
Url
String
Yes
File URL.
Attention:
Use a file link uploaded to ADP (refer to Offline Document Upload), or a publicly accessible file link.

FileInfo

Data structure of file information:
Name
Type
Required or Not
Description
FileName
String
Yes
Document name.
FileSize
String
Yes
File size.
FileUrl
String
Yes
File URL.
Attention:
Use a file link uploaded to ADP (refer to Offline Document Upload), or a publicly accessible file link.
FileType
String
Yes
File type.
DocId
String
No
doc_id returned by the real-time document parsing API.
Attention:
When file-based conversations in standard mode are used, this field is required.

Widget

Widget information
Name
Type
Required or Not
Description
WidgetId
String
Yes
Widget configuration ID.
WidgetRunId
String
Yes
Widget instance ID.
State
String
Yes
Widget status data, used for fallback display.
Position
Number
No
Widget position.
View
String
Yes
JSON format Widget information.
Attention:
Rendering Widget information can be achieved using Tencent's cross-framework UI component SDK developed based on the Web Components standard.
SDK Documentation: ADP-Widget SDK

WidgetAction

Widget action information data structure:
Name
Type
Required or Not
Description
WidgetId
String
Yes
Widget configuration ID.
WidgetRunId
String
Yes
Widget instance ID.
ActionType
String
Yes
Widget action.
Payload
String
Yes
Widget action submitted data.

QuoteInfo

Reference source index
Name
Type
Required or Not
Description
Position
Number
Yes
Reference source location.
Index
Number
Yes
Reference source index order.

Reference

Reference information
Name
Type
Required or Not
Description
Index
Number
Yes
Reference source index ID.
Type
Number
Yes
Reference source type.
1: Q&A
2: Document fragment
4: Online retrieved content
5: Knowledge Graph
Name
String
Yes
Reference source name.
DocRefer
No
Document fragment reference information.
QaRefer
No
Q&A reference information.
WebSearchRefer
No
Online retrieved content reference information.
GraphRAGRefer
No
Knowledge Graph reference information.

GraphRAGRefer

Knowledge Graph reference information.
Name
Type
Required or Not
Description
ReferenceId
String
Yes
Knowledge Graph reference ID. This field corresponds to the ReferBizIds field in DescribeRefer.
KnowledgeId
String
Yes
Knowledge Graph business ID in the knowledge base.
KnowledgeName
String
No
Name of the knowledge base where the Knowledge Graph is located.

DocRefer

Document fragment reference information.
Name
Type
Required or Not
Description
ReferenceId
String
Yes
Document fragment reference ID. This field corresponds to the ReferBizIds field in DescribeRefer.
DocId
String
Yes
Document business ID.
DocName
String
Yes
Document name.
KnowledgeId
String
Yes
Business ID of the knowledge base where the document is located.
KnowledgeName
String
No
Name of the knowledge base where the document is located.
Url
String
Yes
Document access address.

QaRefer

Q&A reference information.
Name
Type
Required or Not
Description
ReferenceId
String
Yes
Document fragment reference ID. This field corresponds to the ReferBizIds field in DescribeRefer.
QaId
String
Yes
Q&A business ID.
KnowledgeId
String
Yes
Business ID of the knowledge base where the Q&A is located.
KnowledgeName
String
No
Name of the knowledge base where the Q&A is located.

WebSearchRefer

Online search content reference information.
Name
Type
Required or Not
Description
Url
String
Yes
Web page URL.

Sandbox

Sandbox information content.
Name
Type
Required or Not
Description
Url
String
No
Sandbox URL.
DisplayUrl
String
No
Browser-accessible sandbox URL.
Content
String
No
Sandbox output content.

WebSearch

Web search content
Name
Type
Required or Not
Description
Content
String
Yes
Web search results in JSON-formatted string.

FileCollection

File collection information.
Name
Type
Required or Not
Description
MaxFileCount
Number
Yes
Maximum number of upload files.
SupportedFileTypes
Array of String
Yes
Supported upload file types.

Record


Name
Type
Required or Not
Description
Role
String
Yes
Role type.
user: Represents that the content of this message is sent by the user.
assistant: Represents that the content of this message is sent by the Intelligent Agent.
RecordId
String
Yes
Current record ID.
RelatedRecordId
String
No
Associated record ID.
ConversationId
String
Yes
Unique identifier for the session.
Status
String
Yes
Current status, such as "processing".
StatusDesc
String
Yes
Status description.
Messages
Array of Message
No
Message list containing multiple message objects.
Procedures
Array of Procedure
No
Processing list containing multiple process objects.
StatInfo
No
Statistics.
ExtraInfo
No
Extended information.

RecordExtraInfo

Message record extended information.
Name
Type
Required or Not
Description
RequestId
String
Yes
Request ID, used to identify a request (for message correlation, it is recommended to use a different RequestId for each request).
TraceId
String
Yes
Link ID.
Elapsed
Number
Yes
Event duration in milliseconds.
StartTime
Number
Yes
Event start time in milliseconds.
IsFromSelf
Boolean
Yes
Whether the message is sent from the client.
IsLlmGenerated
Boolean
No
Whether the content is model-generated.
CanRating
Boolean
No
Whether the message record can be evaluated.
CanFeedback
Boolean
No
Whether the message record can provide feedback.
Attention:
This field may return null, indicating that no valid value can be obtained. Example value: false
ReplyMethod
Number
No
Reply method:
1: Large model reply
2: Unknown question response
3: Refused question response
4: Sensitive response
5: Priority response for adopted question-answer pairs
6: Welcome words response
7: Concurrent connections limit exceeded response
8: Global intervention knowledge
9: Task flow response
10: Task flow answer
11: Search engine response
12: Knowledge-polished response
13: Image understanding response
14: Real-time document response
15: Clarification confirmation response
16: Workflow response
17: Workflow execution completed.
18: Intelligent Agent response
19: Multi-intent response

Message

Message details
Name
Type
Required or Not
Description
Type
String
Yes
Message type.
Reply: Reply to message
Thought: Thought message
tool_call: Tool call message
task_execution: Task execution message
recommendation: Recommended questions
notice: Intermediate prompt message
MessageId
String
Yes
Unique identifier for the message.
Name
String
Yes
Message name.
Title
String
Yes
Message title.
Icon
String
No
Icon URL.
Status
String
Yes
Message status, such as "success".
StatusDesc
String
No
Status description, such as "Reasoning completed".
Contents
Array of Content
No
Content array containing multiple content objects.
ExtraInfo
No
Extended information.

MessageExtraInfo

Message additional information.
Name
Type
Required or Not
Description
Elapsed
Number
Yes
Message duration.
StartTime
Number
Yes
Message start time.
AgentName
String
No
Intelligent Agent name for output message.
AgentIcon
String
No
Intelligent Agent icon for output message.
ParentMessageId
String
No
Parent message ID.

Procedure

Processing details.
Name
Type
Required or Not
Description
Name
String
Yes
Process name.
Title
String
Yes
Process title.
Status
String
Yes
Process status, such as "success".
IntentCate
String
No
Intent classification.
ResourceStatus
Number
No
Billing resource status.
1: Available
2: Unavailable
Type
String
Yes
Process type, such as "agent".
Knowledge
No
Knowledge base execution details.
Workflow
No
Workflow execution details.
Agent
No
Intelligent Agent execution details.
StatInfos
Array of StatInfo
No
Model statistics.

Knowledge

Knowledge base execution details.
Name
Type
Required or Not
Description
Content
String
Yes
Search Query.
System
String
No
System Prompt.
RewriteQuery
String
No
Rewritten Query.
CustomVariables
Array of String
No
Custom parameters.
Histories
Array of History
No
Multi-round history information.
Outputs
No
Knowledge base search output.

History

Historical information.
Name
Type
Required or Not
Description
Assistant
String
No
Intelligent Agent output.
User
String
No
User input.

KnowledgeOutput

Knowledge base search output information.
Name
Type
Required or Not
Description
Type
Number
Yes
Data type.
1: Q&A
2: Document fragment
Content
String
Yes
Knowledge content.

WorkflowProcedure

Workflow invocation details
Name
Type
Required or Not
Description
WorkflowId
String
Yes
Workflow ID.
WorkflowName
String
Yes
Workflow name.
WorkflowReleaseTime
String
Yes
Workflow release time, Unix timestamp.
WorkflowRunId
String
Yes
Workflow run ID.
Content
String
Yes
Workflow input information.
Outputs
Array of String
Yes
Multiple bubbles output.
OptionCardIndex
No
Tab index.
OptionCards
Array of String
No
Tab.
RunNodes
Array of RunNode
Yes
Workflow node information.

OptionCardIndex

Tab index information
Name
Type
Required or Not
Description
RecordId
String
Yes
Message unique identifier.
Index
Number
Yes
Tab index.

RunNode

Workflow node information
Name
Type
Required or Not
Description
Elapsed
String
Yes
Node invocation time.
NodeId
String
Yes
Node ID.
NodeName
String
Yes
Node name.
NodeType
Number
Yes
Node type.
Status
Number
Yes
Node execution status.
Input
String
No
Node input.
InputRef
String
No
Link to the full content of the node input.
Output
String
No
Node output.
OutputRef
String
No
Link to the full content of the node output.
TaskOutput
String
No
Task output.
TaskOutputRef
String
No
Link to the full content of the task raw output.
Reply
String
No
Current node reply content.
FailCode
String
No
Error code corresponding to the exception information.
FailMessage
String
No
Exception information.
BelongNodeId
String
No
ID of the referencing node when the node's workflow is referenced.
IsCurrent
Boolean
No
Current traversed nodes.
StatInfos
Array of StatInfo
No
Large model statistics.

Agent

Intelligent Agent execution details.
Name
Type
Required or Not
Description
Input
String
No
Tools and large model input information, in json format.
Output
String
No
Tools and large model output information, in json format.
ModelName
String
No
Model name.
Content
String
Yes
Search Query.
System
String
No
System Prompt.
RewriteQuery
String
No
Rewritten Query.
CustomVariables
Array of String
No
Custom parameters.

StatInfo

Statistics
Name
Type
Required or Not
Description
Elapsed
Number
No
Response time.
StartTime
Number
No
Response start time.
InputTokens
Number
No
Input token total number.
OutputTokens
Number
No
Output total number of tokens.
TotalTokens
Number
No
total number of tokens.
ModelName
String
No
Model name in use.
FirstTokenCost
Number
No
Model first token time.
TotalCost
Number
No
Model total time.

Error

Error Message
Name
Type
Required or Not
Description
Code
Number
Yes
Error Code.
Message
String
Yes
Returned message.
RequestId
String
Yes
Incorrectly associated RequestId.
TraceId
String
Yes
Incorrect TraceId.
Elapsed
Number
No
Request time (ms).
StartTime
Number
No
Request start time (ms timestamp).

Rating

Like/Dislike Information
Name
Type
Required or Not
Description
RequestId
String
Yes
Request ID, used to identify a request (used for message correlation, it is recommended to use a different request_id for each request).
RecordId
String
Yes
Message ID.
Score
String
Yes
Score:
1: Like
2: Dislike
3: Unlike
4: Undislike
Reasons
Array of String
No
Selected reasons (user feedback content, multiple allowed)
TraceId
String
No
TraceId of the message.
FeedbackContent
String
No
User feedback content.

StopGeneration

Stop generating information.
Name
Type
Required or Not
Description
RequestId
String
Yes
Request ID, used to identify a request (used for message correlation, it is recommended to use a different request_id for each request).
RecordId
String
Yes
Message ID for which generation needs to be stopped.

Reconnect

Reconnect information
Name
Type
Required or Not
Description
RequestId
String
Yes
Request ID, used to identify a request (used for message correlation, it is recommended to use a different request_id for each request).
RecordId
String
Yes
Message ID that requires reconnection to continue receiving.

5. Error Code

Error Code
Error Message
400
Request parameter error. Please refer to the access documentation.
460001
Token validation failed.
460002
Event handler does not exist.
460004
Application does not exist.
460006
The message is not found or lacks operation permissions.
460007
Session creation failed.
460008
Prompt rendering failed.
460009
Guest user does not exist.
460010
The session is not found or lacks operation permissions.
460011
Exceeded the application-configured model QPM concurrency limit.
460020
Model request timeout.
460021
Knowledge base not published.
460022
Guest creation failed.
460023
Like/Dislike operation failed.
460024
Invalid Tag.
460025
Image Analysis failed.
460031
Exceeded the application QPS concurrency limit.
460032
The application model balance is insufficient.
460033
Application not found or lacks operation permissions.
460034
Input too long.
460035
Computing input too long, has been stopped.
460036
Workflow node preview parameter exception.
460037
Search resources exhausted, call failed.
460038
The request from this AppId exhibits abnormal behavior, and the call failed.
4505004
AppKey is invalid. Please verify that the AppKey source corresponds to the sending event.


Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan