Paging 3 (Android Jetpack)
Jetpack Paging 3 is the Android standard for loading and displaying paginated data from local databases or network. Built on Kotlin coroutines and Flow — PagingSource defines how to load data (from Room database or REST API), Pager creates a Flow<PagingData<T>>, and LazyPagingItems (Compose) or PagingDataAdapter (RecyclerView) bind the paginated data. Handles loading state (Loading/NotLoading/Error), retry on failure, empty state, and prepend/append loading. RemoteMediator enables local caching of remote data with automatic cache refresh.
Score Breakdown
⚙ Agent Friendliness
🔒 Security
Pagination library — no direct security concerns. Network security provided by underlying HTTP client. Agent data cached in Room is protected by app sandbox. Remote API auth handled by application HTTP interceptors.
⚡ Reliability
Best When
You're displaying large, scrollable lists of agent data from database or network in Android — Paging 3 handles loading state, caching, retry, and scroll-triggered loading automatically.
Avoid When
Your dataset is small enough to load at once, you're building non-list UIs, or you're on a non-Android platform.
Use Cases
- • Load paginated agent conversation history from local Room database using Paging 3 — Room PagingSource automatically integrates with Paging 3 for local agent data browsing
- • Display infinite-scrolling agent search results from REST API using Paging 3 with network PagingSource — append next page automatically as user scrolls
- • Implement offline-first agent content browsing using RemoteMediator — cache remote agent data in Room, serve from local database, refresh when stale
- • Show loading states and error handling for paginated agent data in Compose using LazyPagingItems.loadState — display skeleton loaders, retry buttons, and empty states
- • Browse large agent datasets in RecyclerView using PagingDataAdapter — DiffUtil-powered efficient updates when paged data changes
Not For
- • Small fixed-size datasets — simple LazyColumn/RecyclerView with full data is simpler for <100 items; Paging 3's PagingSource overhead not justified for small datasets
- • Non-Android platforms — Paging 3 is Android-specific; use cursor-based pagination for server-side Kotlin or custom scroll handlers for non-Android Compose
- • Non-list UI patterns — Paging 3 is optimized for list/grid UI; for paginated data without list display (batch processing, background loading), use plain suspend functions
Interface
Authentication
Pagination library — no auth concepts. Network PagingSource uses application's HTTP client with auth headers for agent API calls.
Pricing
Paging 3 is Apache 2.0 licensed, maintained by Google. Free for all use.
Agent Metadata
Known Gotchas
- ⚠ PagingData stream must be collected in coroutine — Pager().flow collects from within coroutineScope; in Compose, collectAsLazyPagingItems() handles collection; in ViewModel, use cachedIn(viewModelScope) to cache across recompositions
- ⚠ cachedIn(viewModelScope) is required for Compose — without cachedIn, PagingData Flow re-triggers network request every recomposition; always cache in ViewModel scope for network paging sources
- ⚠ Room PagingSource auto-invalidates — Room's PagingSource invalidates when the underlying database table changes; new PagingSource is created; this is correct behavior but can cause unexpected refresh cycles during agent data updates
- ⚠ RemoteMediator loading state confusion — RemoteMediator REFRESH runs when first loading and on explicit refresh; PREPEND/APPEND run on scroll; forgetting to check state == LoadState.NotLoading before showing empty state shows empty UI during initial load
- ⚠ Page size vs prefetch distance — pageSize is items per network call; prefetchDistance is items before end of list that triggers next load; setting prefetchDistance too small causes visible loading gaps in agent content feeds; set to 2-3x pageSize
- ⚠ Paging 3 doesn't support bidirectional pagination well — loading in both directions (before and after a specific item) is complex; standard Paging 3 is best for unidirectional scroll (infinite scroll from start to end)
Alternatives
Full Evaluation Report
Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Paging 3 (Android Jetpack).
Scores are editorial opinions as of 2026-03-06.