-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Open
Labels
Description
Feature Request
Problem
Currently, get_items(limit=N) only supports truncation — it returns the latest N items. There is no way to paginate through a session's history (e.g., "give me items 20-30"). This makes it impossible to efficiently browse or display conversation history in pages.
Proposed Solution
Add an offset parameter to get_items():
# Page 1: 10 most recent items
page1 = await session.get_items(limit=10, offset=0)
# Page 2: next 10 items
page2 = await session.get_items(limit=10, offset=10)
# Skip recent items, get the rest
older = await session.get_items(offset=5)This is backward compatible — offset defaults to 0, preserving existing behavior.
Motivation
- Building chat UIs with "load more" or infinite scroll
- Exporting conversation history in batches
- Analyzing specific portions of a session without loading the entire history
- Consistent with standard database pagination patterns (
LIMIT/OFFSET)
The existing limit parameter already implies the need for pagination but only provides half the mechanism.
Reactions are currently unavailable