LoadAgentSession

更新时间:
复制 MD 格式

Loads the message history of an existing session and returns it as an SSE stream. If the session does not exist, the server sends a JSONRPCResponse.error with a code of 400 through the SSE stream. The Content-Type is text/event-stream. Use this operation to restore session context.

Operation description

Request

  • This operation retrieves session details and streams the Agent response using Server-Sent Events (SSE).

  • If the target session does not exist, the operation returns an error frame with an error code of 400.

  • The response includes information about the Agent's request processing, such as message chunks, thought processes, and tool call status updates.

  • The stopReason field indicates why the Agent stops the current turn. Possible values include reaching the maximum turn limit or being canceled.

  • The returned content conforms to the Agent Client Protocol (ACP). For more information, see https://agentclientprotocol.com.

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

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

POST  HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

Jsonrpc

string

No

The JSON-RPC version. The value must be 2.0.

2.0

Id

string

No

The client-generated request ID, which is returned in the response.

4as3dasf654a

Params

object

No

Business parameters.

SessionId

string

No

The ID of the target session. If the session does not exist, an SSE error frame is returned.

sess_0f12abc34

Meta

object

No

DataWorks-specific extended parameters for ACP.

IsReload

boolean

No

Specifies whether to use resumable transfer. If the SSE stream is interrupted due to issues like an unstable network connection, you can set this parameter to true to re-fetch the stream data from the point of failure.

true or false

BeginLogOffset

integer

No

In a resumable transfer scenario, this specifies the offset from which to resume fetching the SSE output.

10000

Response elements

Element

Type

Description

Example

object

RequestId

string

The unique request ID generated for this request.

0D41C608-0C60-5EB0-B986-1460909CF642

Timestamp

integer

The timestamp.

1769479322828

Jsonrpc

string

The JSON-RPC version. The value is 2.0.

2.0

Id

string

The client-generated request ID, returned from the request.

676303114031776

Result

any

The result object of the SSE frame. This field is present when the operation is successful.

{"stopReason":"end_turn"}

Error

any

The error object of the SSE frame. This field is present when an error occurs.

{"code": 400, "errorCode": "0x50000000001", "message": "not exist session", "data": null}

Method

string

The method of the SSE frame.

session/update

Params

any

The parameters of the SSE frame.

{"sessionId":"af4f5ef8-e8f5-481c-ad1f-94886c6c0aed","update":{"sessionUpdate":"agent_message_chunk","content":{"type":"text","text":"hello world"}}}

Examples

Success response

JSON format

{
  "RequestId": "0D41C608-0C60-5EB0-B986-1460909CF642",
  "Timestamp": 1769479322828,
  "Jsonrpc": "2.0",
  "Id": "676303114031776",
  "Result": "{\"stopReason\":\"end_turn\"}",
  "Error": "{\"code\": 400, \"errorCode\": \"0x50000000001\", \"message\": \"not exist session\", \"data\": null}",
  "Method": "session/update",
  "Params": "{\"sessionId\":\"af4f5ef8-e8f5-481c-ad1f-94886c6c0aed\",\"update\":{\"sessionUpdate\":\"agent_message_chunk\",\"content\":{\"type\":\"text\",\"text\":\"hello world\"}}}"
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.