google / google/adk-python

Request: More flexible API parameters for session events listing

Aperta
#2,854 1 commento 3 reazioni 1 assegnatario Rivendicata da @DeanChensj Vedi su GitHub
needs review services
Lingua principale
Python
Stelle
21.5k
Fork
4k
Merge medio
1g 14h
PR unite (30g)
37

Descrizione

### Discussed in https://github.com/google/adk-python/discussions/2847

Originally posted by **Artisan2025** September 4, 2025
Current Issue
The current sessions/{session}/events API only supports basic pagination, which creates performance problems when dealing with sessions that have accumulated many events over time.

Current API Limitations
The API currently supports:
pageSize - controls page size
pageToken - for pagination
filter - only timestamp range filtering
Events are returned in ascending order (oldest first), but most use cases need recent events (newest first).

Use Case
When a session has 50,000+ events but we only need the last 10 events, the current API forces us to:
Fetch all 500+ pages of historical data
Load everything into memory
Filter client-side to get the recent events
This is inefficient and doesn't scale well for long-running sessions.
Requested Features
Could the API support more flexible parameters like:
Reverse ordering: order=desc to get newest events first
Result limiting: limit=N to cap the number of results
Smart pagination: When combined with order=desc&limit=10, return only the most recent events without requiring full pagination

Example
Instead of fetching 500 pages:
events
We could have:
10
This would return just the 10 most recent events directly.
Question
Is this type of enhancement possible for the Session Events API? It would significantly improve performance for applications with long-running sessions.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.