Backend for AIbeginner10 min · 10 steps
Pagination
Return large result sets in bounded pages, by offset or by cursor, in your own APIs and when your tools consume other people's.
heavy workrequestresponsedata
metrics are illustrativeProblemStep 1 of 10
"Give me everything" doesn't scale
GET /tickets returns 40,000 rows: a slow query, a huge response, and a browser that freezes. On the other side, a naive tool that calls ServiceNow reads only the first page and tells the model "you have 50 tickets", or follows next links forever.
Agents add a twist: every page a tool returns lands in the model's context window.
Lesson 18 of 20 in Backend for AI