Skip to content

feat(agents): follow pagination in agents list - #183

Draft
rwjblue-glean wants to merge 1 commit into
mainfrom
rwjblue/agents-list-pagination-e4fc
Draft

rwjblue-glean wants to merge 1 commit into
mainfrom
rwjblue/agents-list-pagination-e4fc

Conversation

@rwjblue-glean

@rwjblue-glean rwjblue-glean commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

BLUF (stack): Page POST /api/agents/search with opaque cursors so its responses stay bounded.

BLUF (this PR): Make glean agents list follow next_cursor so it prints every agent.

Once agent search pages its results, the endpoint returns at most 100 agents per call. glean agents list calls it once, so anyone who can see more than 100 agents would silently get only the first 100. It now keeps requesting pages while has_more is true, sending back each next_cursor with the same filters, and prints all agents as one response.

Warning

Blocked; does not compile yet. This needs an api-client-go release regenerated from the spec in askscio/scio#336824. The pinned v0.17.3 and the latest release, v0.18.2, both lack PlatformAgentsSearchRequest.Cursor/PageSize and PlatformAgentsSearchResponse.HasMore/NextCursor, so the build fails until go.mod is bumped. That bump belongs in this PR before it leaves draft.

Details

  • The field names are inferred. They match what the generator produced for the same page_size/cursor/has_more/next_cursor shapes on the other paginated Platform endpoints (for example PlatformListAdminAgentsResponse). If the regenerated names differ, only searchAllAgents changes.
  • The spec gives page_size a default of 100, which the generated request serializes, so agents list --dry-run prints {"page_size": 100} instead of {}. The snapshot reflects that.
  • A page with has_more: true and no next_cursor is an error rather than an endless loop.
  • The legacy /rest/api/v1/agents/search fallback is unchanged.

Stack

Spans repositories, in rollout order.

  1. askscio/scio#336824 — page agent search API
  2. askscio/scio#337640 — page inside the backend
  3. docs(changelog): announce paged Search agents responses glean-developer-site#947 — changelog for paged search
  4. 👉 this PR — follow pagination in agents list

Ticket: DEVPLAT-1737

Open in Web Open in Cursor 

POST /api/agents/search is gaining cursor pagination
(askscio/scio#336824): it returns at most 100 agents per page, with
has_more and next_cursor, and accepts a cursor. `glean agents list`
calls the endpoint once, so on deployments with more than 100 visible
agents it would silently print only the first page.

agents list now requests pages until has_more is false, sending each
page's next_cursor back with the original filters, and prints every
agent as one response. A page that reports has_more without a
next_cursor is an error rather than an endless loop.

This depends on an api-client-go release regenerated from that spec.
The pinned v0.17.3 (and the latest, v0.18.2) lack Cursor, PageSize,
HasMore and NextCursor, so this does not compile until the dependency
is bumped. The field names follow the generator's output for the other
paginated Platform endpoints. The regenerated request also carries the
spec's page_size default of 100, which shows up in --dry-run output.

Co-authored-by: Robert Jackson <robert.jackson@glean.com>
@rwjblue-glean rwjblue-glean added the dependencies Pull requests that update a dependency label Dec 2, 2026 — with Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants