List Events

更新时间: 2026-07-03 19:43:13

Queries session event history with pagination. The returned structure matches the SSE frame data. Supports time window filtering and sorting.

Prerequisites

A session must already be created. For details, see Create Session. {session_id} is in the format sesn_xxx....

Endpoint

GET /sessions/{session_id}/events

The returned structure matches the SSE frame data. For details on event envelope fields, see the Event envelope section in Subscribe to Event SSE Stream.

Query parameters

Parameter

Type

Default

Description

order

string

asc

Sort direction: asc (ascending) | desc (descending)

created_at[gt] / [gte] / [lt] / [lte]

string

Filter by time window, ISO 8601; the four comparison operators can be combined

limit

int

20

Number of items per page, maximum 100

page

string

Omit on the first request; pass next_page from the previous response for subsequent requests

Request example

curl "$AGENTSTUDIO_URL/sessions/sesn_xxx/events?order=asc&limit=100" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY"
for event in client.sessions.events.list(
    "sesn_xxx",
    limit=100,
    order="asc",
):
    print(event.type, event.created_at)
CursorPage<SessionEvent> events = client.sessions().events().list("sesn_xxx",
    SessionEventListParam.builder()
        .limit(100)
        .order("asc")
        .build());
for (SessionEvent ev : events.getData()) {
    System.out.println("[" + ev.getType() + "] " + ev.getCreatedAt());
}

Response

Returns data (an array of event Message objects with the same structure as the SSE frame data field; for details, see Subscribe to Event SSE Stream), next_page (cursor for the next page; not returned or null when there is no more data), and request_id. Message object fields are as follows:

Response fields

Field

Type

Description

data

array<object>

Array of event Message objects, sorted by order

data[].object

string

Always message

data[].id

string

Event ID, prefix msg_ or out_

data[].created_at

string

Event timestamp, ISO 8601

data[].role

string

user | assistant | tool

data[].type

string

Event type, same values as SSE server push events. For details, see Subscribe to Event SSE Stream

data[].content

array<object>

ContentBlock array, same structure as the send side

data[].metadata

object

Event additional information (such as thread_id, call_id, etc.)

next_page

string | null

Cursor for the next page; not returned or null when there is no more data

request_id

string

Unique identifier for this request

上一篇: Send Event 下一篇: Subscribe to Event SSE Stream
阿里云首页 大模型服务平台百炼 相关技术圈