Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.2.5"
".": "0.2.6"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 34
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-e1efa8c7e58d81f5c0242d4ea49ac7637b5d455d10a40f217b1183c229b65dd2.yml
openapi_spec_hash: 8fdf7cace40fb14a765c4e09c2d5bb95
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-4e1c137bb7977db9f224437bef638a51725f001c0453a1adf273cf3b920a7120.yml
openapi_spec_hash: f52a4797cadb597b32615460abec2b18
config_hash: f6ec6016df1ff072b5b60cdf7b438361
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 0.2.6 (2025-08-01)

Full Changelog: [v0.2.5...v0.2.6](https://github.com/scaleapi/agentex-python/compare/v0.2.5...v0.2.6)

### Features

* **api:** add query params to tasks.list ([d4902d5](https://github.com/scaleapi/agentex-python/commit/d4902d52caf82e2f57d1bbf19527cdc1448ed397))
* **client:** support file upload requests ([e004b30](https://github.com/scaleapi/agentex-python/commit/e004b304c22286151330c2200bcb85046a7ac111))

## 0.2.5 (2025-07-30)

Full Changelog: [v0.2.4...v0.2.5](https://github.com/scaleapi/agentex-python/compare/v0.2.4...v0.2.5)
Expand Down
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ from agentex.types import Task, TaskListResponse
Methods:

- <code title="get /tasks/{task_id}">client.tasks.<a href="./src/agentex/resources/tasks.py">retrieve</a>(task_id) -> <a href="./src/agentex/types/task.py">Task</a></code>
- <code title="get /tasks">client.tasks.<a href="./src/agentex/resources/tasks.py">list</a>() -> <a href="./src/agentex/types/task_list_response.py">TaskListResponse</a></code>
- <code title="get /tasks">client.tasks.<a href="./src/agentex/resources/tasks.py">list</a>(\*\*<a href="src/agentex/types/task_list_params.py">params</a>) -> <a href="./src/agentex/types/task_list_response.py">TaskListResponse</a></code>
- <code title="delete /tasks/{task_id}">client.tasks.<a href="./src/agentex/resources/tasks.py">delete</a>(task_id) -> <a href="./src/agentex/types/shared/delete_response.py">DeleteResponse</a></code>
- <code title="delete /tasks/name/{task_name}">client.tasks.<a href="./src/agentex/resources/tasks.py">delete_by_name</a>(task_name) -> <a href="./src/agentex/types/shared/delete_response.py">DeleteResponse</a></code>
- <code title="get /tasks/name/{task_name}">client.tasks.<a href="./src/agentex/resources/tasks.py">retrieve_by_name</a>(task_name) -> <a href="./src/agentex/types/task.py">Task</a></code>
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "agentex-sdk"
version = "0.2.5"
version = "0.2.6"
description = "The official Python library for the agentex API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
5 changes: 4 additions & 1 deletion src/agentex/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,10 @@ def _build_request(
is_body_allowed = options.method.lower() != "get"

if is_body_allowed:
kwargs["json"] = json_data if is_given(json_data) else None
if isinstance(json_data, bytes):
kwargs["content"] = json_data
else:
kwargs["json"] = json_data if is_given(json_data) else None
kwargs["files"] = files
else:
headers.pop("Content-Type", None)
Expand Down
8 changes: 4 additions & 4 deletions src/agentex/_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes:
return file

if is_tuple_t(file):
return (file[0], _read_file_content(file[1]), *file[2:])
return (file[0], read_file_content(file[1]), *file[2:])

raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")


def _read_file_content(file: FileContent) -> HttpxFileContent:
def read_file_content(file: FileContent) -> HttpxFileContent:
if isinstance(file, os.PathLike):
return pathlib.Path(file).read_bytes()
return file
Expand Down Expand Up @@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes:
return file

if is_tuple_t(file):
return (file[0], await _async_read_file_content(file[1]), *file[2:])
return (file[0], await async_read_file_content(file[1]), *file[2:])

raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")


async def _async_read_file_content(file: FileContent) -> HttpxFileContent:
async def async_read_file_content(file: FileContent) -> HttpxFileContent:
if isinstance(file, os.PathLike):
return await anyio.Path(file).read_bytes()

Expand Down
2 changes: 1 addition & 1 deletion src/agentex/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "agentex"
__version__ = "0.2.5" # x-release-please-version
__version__ = "0.2.6" # x-release-please-version
58 changes: 54 additions & 4 deletions src/agentex/resources/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

from __future__ import annotations

from typing import Optional

import httpx

from ..types import task_list_params
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from .._utils import maybe_transform, async_maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
from .._response import (
Expand Down Expand Up @@ -78,18 +82,41 @@ def retrieve(
def list(
self,
*,
agent_id: Optional[str] | NotGiven = NOT_GIVEN,
agent_name: Optional[str] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> TaskListResponse:
"""List all tasks."""
"""
List all tasks.

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
return self._get(
"/tasks",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
{
"agent_id": agent_id,
"agent_name": agent_name,
},
task_list_params.TaskListParams,
),
),
cast_to=TaskListResponse,
)
Expand Down Expand Up @@ -320,18 +347,41 @@ async def retrieve(
async def list(
self,
*,
agent_id: Optional[str] | NotGiven = NOT_GIVEN,
agent_name: Optional[str] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> TaskListResponse:
"""List all tasks."""
"""
List all tasks.

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
return await self._get(
"/tasks",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
{
"agent_id": agent_id,
"agent_name": agent_name,
},
task_list_params.TaskListParams,
),
),
cast_to=TaskListResponse,
)
Expand Down
1 change: 1 addition & 0 deletions src/agentex/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from .agent_rpc_params import AgentRpcParams as AgentRpcParams
from .agent_rpc_result import AgentRpcResult as AgentRpcResult
from .span_list_params import SpanListParams as SpanListParams
from .task_list_params import TaskListParams as TaskListParams
from .agent_list_params import AgentListParams as AgentListParams
from .event_list_params import EventListParams as EventListParams
from .state_list_params import StateListParams as StateListParams
Expand Down
14 changes: 14 additions & 0 deletions src/agentex/types/task_list_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing import Optional
from typing_extensions import TypedDict

__all__ = ["TaskListParams"]


class TaskListParams(TypedDict, total=False):
agent_id: Optional[str]

agent_name: Optional[str]
18 changes: 18 additions & 0 deletions tests/api_resources/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ def test_method_list(self, client: Agentex) -> None:
task = client.tasks.list()
assert_matches_type(TaskListResponse, task, path=["response"])

@pytest.mark.skip()
@parametrize
def test_method_list_with_all_params(self, client: Agentex) -> None:
task = client.tasks.list(
agent_id="agent_id",
agent_name="agent_name",
)
assert_matches_type(TaskListResponse, task, path=["response"])

@pytest.mark.skip()
@parametrize
def test_raw_response_list(self, client: Agentex) -> None:
Expand Down Expand Up @@ -350,6 +359,15 @@ async def test_method_list(self, async_client: AsyncAgentex) -> None:
task = await async_client.tasks.list()
assert_matches_type(TaskListResponse, task, path=["response"])

@pytest.mark.skip()
@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> None:
task = await async_client.tasks.list(
agent_id="agent_id",
agent_name="agent_name",
)
assert_matches_type(TaskListResponse, task, path=["response"])

@pytest.mark.skip()
@parametrize
async def test_raw_response_list(self, async_client: AsyncAgentex) -> None:
Expand Down
Loading