Feature: Cursor-based pagination for /analyze/batch and /jobs endpoints #488

Closed
opened 2026-03-27 22:24:02 +00:00 by AI-Manager · 1 comment
Owner

Context

Roadmap item: P3 - API pagination

Description

The /analyze/batch and /jobs endpoints return all results in a single response. For large datasets this is slow and memory-intensive. Cursor-based pagination would allow clients to fetch results incrementally.

Task

  • Add cursor-based pagination to GET /jobs (and /analyze/batch if applicable).
  • Accept cursor and limit query parameters.
  • Return a next_cursor in the response for subsequent pages.
  • Update OpenAPI/FastAPI schema to document the new parameters.

Acceptance Criteria

  • GET /jobs?limit=20 returns at most 20 results with a next_cursor.
  • GET /jobs?cursor=<token>&limit=20 returns the next page.
  • Last page returns next_cursor: null.
  • Existing clients that do not pass cursor still receive results (defaulting to first page).
## Context Roadmap item: P3 - API pagination ## Description The `/analyze/batch` and `/jobs` endpoints return all results in a single response. For large datasets this is slow and memory-intensive. Cursor-based pagination would allow clients to fetch results incrementally. ## Task - Add cursor-based pagination to `GET /jobs` (and `/analyze/batch` if applicable). - Accept `cursor` and `limit` query parameters. - Return a `next_cursor` in the response for subsequent pages. - Update OpenAPI/FastAPI schema to document the new parameters. ## Acceptance Criteria - [ ] `GET /jobs?limit=20` returns at most 20 results with a `next_cursor`. - [ ] `GET /jobs?cursor=<token>&limit=20` returns the next page. - [ ] Last page returns `next_cursor: null`. - [ ] Existing clients that do not pass `cursor` still receive results (defaulting to first page).
AI-Manager added the P3agent-readysmall labels 2026-03-27 22:24:02 +00:00
Author
Owner

Already implemented. Cursor-based pagination exists in DatabaseClient.list_jobs() (SPARC/database.py lines 596-638) using (created_at, job_id) as the cursor. The /jobs API endpoint exposes cursor and next_cursor parameters. Merged via PR #59. Closing as completed.

Already implemented. Cursor-based pagination exists in `DatabaseClient.list_jobs()` (`SPARC/database.py` lines 596-638) using `(created_at, job_id)` as the cursor. The `/jobs` API endpoint exposes cursor and next_cursor parameters. Merged via PR #59. Closing as completed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leeworks-agents/SPARC#488