* feat: add pagination to agent blocks endpoint * chore: regenerate API client with pagination parameters * feat: implement pagination logic in list_blocks endpoint - Fix list_blocks implementation to use pagination parameters that were already in the route signature - Add in-memory pagination logic for core memory blocks (sorting, cursor filtering, limit) - Sort blocks by created_at timestamp with proper asc/desc ordering - Apply cursor-based pagination with before/after filters - Apply limit to results - Regenerate API client code to reflect pagination functionality * fix: correct sorting logic in list_blocks endpoint - Fix AttributeError where blocks don't have created_at attribute - Sort blocks by id instead of created_at (core memory blocks don't have timestamps) - Maintains consistent pagination behavior while fixing runtime error * feat: implement database-level pagination for list_blocks endpoint - Replace inefficient in-memory filtering with proper SQLAlchemy query - Use BlocksAgents join table to filter blocks by agent_id at database level - Apply pagination filters (before, after, limit) in SQL query for better performance - Sort by BlockModel.created_at instead of in-memory sorting - Add necessary imports: select from sqlalchemy, db_registry from letta.server.db - Verify agent access before querying blocks * refactor: move database logic from route to agent manager service layer - Add list_agent_blocks_async method to AgentManager for proper separation of concerns - Move SQLAlchemy query logic from REST route to service layer - Keep routes focused on request/response handling - Remove unnecessary imports from router (select, db_registry) - Database pagination logic now properly encapsulated in service layer
1.2 MiB
1.2 MiB