LoadAgentSession
Loads the historical messages of an existing agent session and returns them by using Server-Sent Events (SSE) for page refreshes and history recovery after exceptions.
Operation description
Request description
This operation recovers the details of a specified session and returns the agent response in a streaming manner by using Server-Sent Events (SSE).
If the target session does not exist, an error frame with the error code 400 is returned.
The response includes processing information about how the agent handles the request, such as message chunks, thinking process, and tool invocation status updates.
The
stopReasonfield indicates the reason why the agent stops the current conversation turn. Valid values include but are not limited to reaching the maximum number of turns and being canceled.The returned content complies with the open source Agent Client Protocol (ACP) specification. For more information, see https://agentclientprotocol.com.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dataworks:LoadAgentSession |
none |
*All Resource
|
None | None |
Request syntax
POST HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Jsonrpc |
string |
No |
The JSON-RPC version. The value is fixed to 2.0. |
2.0 |
| Id |
string |
No |
The ID passed by the requester. The value is returned as is. |
4as3dasf654a |
| Params |
object |
No |
The business parameters. |
|
| Meta |
object |
No |
The ACP extension parameters of DataWorks. |
|
| BeginLogOffset |
integer |
No |
Pulls the subsequent SSE output from the specified position in a resumable transfer scenario. |
10000 |
| IsReload |
boolean |
No |
Specifies whether this is a resumable transfer scenario. In scenarios where the SSE stream is unstable, such as network instability that causes the SSE connection to drop midway, you can use this flag to pull the SSE response data again from the breakpoint. |
true |
| SessionId |
string |
No |
The ID of the target session. If the session does not exist, an SSE error frame is returned. |
sess_0f12abc34 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Error |
any |
The error message in the SSE frame information. The returned content complies with the open source Agent Client Protocol (ACP) specification. For more information, see https://agentclientprotocol.com/protocol/prompt-turn. |
{"code": 400, "errorCode": "0x50000000001", "message": "not exist session", "data": null} |
| Id |
string |
The ID passed by the requester. The value is returned as is. |
676303114031776 |
| Jsonrpc |
string |
The JSON-RPC version. The value is fixed to 2.0. |
2.0 |
| Method |
string |
The method of the SSE. The returned content complies with the open source Agent Client Protocol (ACP) specification. For more information, see https://agentclientprotocol.com/protocol/prompt-turn. |
session/update |
| Params |
any |
The parameters of the SSE. The returned content complies with the open source Agent Client Protocol (ACP) specification. For more information, see https://agentclientprotocol.com/protocol/prompt-turn. |
{"sessionId":"af4f5ef8-e8f5-481c-ad1f-94886c6c0aed","update":{"sessionUpdate":"agent_message_chunk","content":{"type":"text","text":"hello world"}}} |
| RequestId |
string |
Id of the request |
0D41C608-0C60-5EB0-B986-1460909CF642 |
| Result |
any |
The result set of the SSE frame. The returned content complies with the open source Agent Client Protocol (ACP) specification. For more information, see https://agentclientprotocol.com/protocol/prompt-turn. |
{"stopReason":"end_turn"} |
| Timestamp |
integer |
The timestamp. |
1769479322828 |
Examples
Success response
JSON format
{
"Error": "{\"code\": 400, \"errorCode\": \"0x50000000001\", \"message\": \"not exist session\", \"data\": null}",
"Id": "676303114031776",
"Jsonrpc": "2.0",
"Method": "session/update",
"Params": "{\"sessionId\":\"af4f5ef8-e8f5-481c-ad1f-94886c6c0aed\",\"update\":{\"sessionUpdate\":\"agent_message_chunk\",\"content\":{\"type\":\"text\",\"text\":\"hello world\"}}}",
"RequestId": "0D41C608-0C60-5EB0-B986-1460909CF642",
"Result": "{\"stopReason\":\"end_turn\"}",
"Timestamp": 1769479322828
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.