Skip to content

feat: enhance API responses with pagination support and model updates#152

Open
Joffref wants to merge 1 commit into
mainfrom
majoffre/update-sdk-version
Open

feat: enhance API responses with pagination support and model updates#152
Joffref wants to merge 1 commit into
mainfrom
majoffre/update-sdk-version

Conversation

@Joffref
Copy link
Copy Markdown
Contributor

@Joffref Joffref commented May 28, 2026

  • Updated the API methods for listing agents, sandboxes, drives, functions, jobs, and job executions to support cursor-based pagination.
  • Refactored response parsing to return structured lists (e.g., AgentList, SandboxList, DriveList, FunctionList, JobList, JobExecutionList) instead of raw arrays.
  • Added new parameters for cursor, limit, sort, and anchor to improve query flexibility and response handling.
  • Updated documentation to reflect changes in response structure and pagination capabilities.

This change improves the API's usability and aligns with the latest versioning standards.


Note

Adds cursor-based pagination to all list endpoints (agents, sandboxes, drives, functions, jobs, job executions). Return types change from list[T] to structured TList objects containing data and meta fields. New query parameters cursor, limit, sort, q, and anchor are threaded through all four call variants (sync_detailed, sync, asyncio_detailed, asyncio). The code is auto-generated from an OpenAPI spec.

Written by Mendral for commit 7ad944f.

- Updated the API methods for listing agents, sandboxes, drives, functions, jobs, and job executions to support cursor-based pagination.
- Refactored response parsing to return structured lists (e.g., AgentList, SandboxList, DriveList, FunctionList, JobList, JobExecutionList) instead of raw arrays.
- Added new parameters for cursor, limit, sort, and anchor to improve query flexibility and response handling.
- Updated documentation to reflect changes in response structure and pagination capabilities.

This change improves the API's usability and aligns with the latest versioning standards.
Copy link
Copy Markdown
Contributor

@mendral-app mendral-app Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs attention — 1 issue in 1 file

AgentList.from_dict (and all sibling *List.from_dict methods) returns None when src_dict is falsy. A 200 response with an empty JSON object {} silently produces None from _parse_response, making it indistinguishable from a non-200 error path. More critically, the docstring explicitly states older API versions return a bare array — passing that array (even a non-empty one like [{...}]) to from_dict causes AttributeError on d.pop("data", UNSET) since lists don't support dict-style .pop. The pagination logic itself is correct; the model guard is the problem.

Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.

<assessment>
`AgentList.from_dict` (and all sibling `*List.from_dict` methods) returns `None` when `src_dict` is falsy. A 200 response with an empty JSON object `{}` silently produces `None` from `_parse_response`, making it indistinguishable from a non-200 error path. More critically, the docstring explicitly states older API versions return a bare array — passing that array (even a non-empty one like `[{...}]`) to `from_dict` causes `AttributeError` on `d.pop("data", UNSET)` since lists don't support dict-style `.pop`. The pagination logic itself is correct; the model guard is the problem.
</assessment>

<file name="src/blaxel/core/client/models/agent_list.py">
<issue location="src/blaxel/core/client/models/agent_list.py:63">
`from_dict` returns `None` for any falsy input, including an empty dict `{}` or a bare array from pre-2026-04-28 API versions. A 200 response with an empty body silently becomes `None`, and a bare-array response (which the docstring says older servers return) triggers an `AttributeError` on `d.pop()` for non-empty arrays.
</issue>
</file>

Tag @mendral-app with feedback or questions. View session

Comment on lines +63 to +65
if not src_dict:
return None
d = src_dict.copy()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bug (P1): from_dict returns None for any falsy input, including an empty dict {} or a bare array from pre-2026-04-28 API versions. A 200 response with an empty body silently becomes None, and a bare-array response (which the docstring says older servers return) triggers an AttributeError on d.pop() for non-empty arrays.

Suggested change
Suggested change
if not src_dict:
return None
d = src_dict.copy()
if src_dict is None:
return None
if not isinstance(src_dict, dict):
raise ValueError(f"Expected a dict, got {type(src_dict).__name__}")
d = src_dict.copy()
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/blaxel/core/client/models/agent_list.py, line 63:

<issue>
`from_dict` returns `None` for any falsy input, including an empty dict `{}` or a bare array from pre-2026-04-28 API versions. A 200 response with an empty body silently becomes `None`, and a bare-array response (which the docstring says older servers return) triggers an `AttributeError` on `d.pop()` for non-empty arrays.
</issue>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant