diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a25d414b..1b77f506 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.6.7" + ".": "0.7.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index da7496f1..8ff7dd44 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 34 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-17022011bf153e3ac9e20d23c5dca8a3072b0e735b47bb391b6e35b00348d5a5.yml -openapi_spec_hash: 0927cdce49a6e6915d6060c2ab43b0d0 -config_hash: 0197f86ba1a4b1b5ce813d0e62138588 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-00b021144c274cce2211ea6c6f90b60b6f88f33a7286a6bf38f4f803ae4c1643.yml +openapi_spec_hash: d48de43356b6d0edc3f7a44b5980f7a0 +config_hash: 32eb65911c08ac84d117cecdf2759869 diff --git a/CHANGELOG.md b/CHANGELOG.md index f0fa5e0e..1bf4d6e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,34 @@ # Changelog +## 0.7.0 (2025-12-09) + +Full Changelog: [v0.6.7...v0.7.0](https://github.com/scaleapi/scale-agentex-python/compare/v0.6.7...v0.7.0) + +### Features + +* **api:** add messages/paginated endpoint ([3e03aff](https://github.com/scaleapi/scale-agentex-python/commit/3e03aff8490e0556cb05052d385156eda8f28107)) +* **api:** add messages/paginated to stainless config ([2473ded](https://github.com/scaleapi/scale-agentex-python/commit/2473ded39274bcd0a16d7314667fcf7f55e829c2)) +* **api:** api update ([f6eccdf](https://github.com/scaleapi/scale-agentex-python/commit/f6eccdf975eaef9b257ef3f20f087f2f2f9b3665)) +* **api:** api update ([41067fb](https://github.com/scaleapi/scale-agentex-python/commit/41067fb79725787e0ceb20dcf16029998bcbca24)) +* **api:** api update ([cdc9c63](https://github.com/scaleapi/scale-agentex-python/commit/cdc9c636be6f26e84772d1d1ef9d47cddcd9dabc)) +* **api:** api update ([413d9c8](https://github.com/scaleapi/scale-agentex-python/commit/413d9c806d918d7c5da3d0249c0f11d4b9f0894e)) +* **api:** api update ([1b4bf7d](https://github.com/scaleapi/scale-agentex-python/commit/1b4bf7d3a11306a50ec0eb9c20764c585d0e98e4)) +* **api:** manual updates ([131e836](https://github.com/scaleapi/scale-agentex-python/commit/131e836b5bda8248f847b00308b6711a1ee84ee0)) + + +### Bug Fixes + +* ensure streams are always closed ([7bb9db8](https://github.com/scaleapi/scale-agentex-python/commit/7bb9db851a213d261e585cd2f156046f05cf85db)) +* **types:** allow pyright to infer TypedDict types within SequenceNotStr ([9cfc9d6](https://github.com/scaleapi/scale-agentex-python/commit/9cfc9d66579a11f3eaf248bafbfddb422e878a58)) + + +### Chores + +* add missing docstrings ([81f1fa9](https://github.com/scaleapi/scale-agentex-python/commit/81f1fa9b3c440d893b8ea8f773ab2592eb333d65)) +* **deps:** mypy 1.18.1 has a regression, pin to 1.17 ([e20aaa4](https://github.com/scaleapi/scale-agentex-python/commit/e20aaa495384f547dd18c8d31496f70b4a37e0dd)) +* **docs:** use environment variables for authentication in code snippets ([a30f6ae](https://github.com/scaleapi/scale-agentex-python/commit/a30f6aebca8de5be72eb7bcf7a3b3ccea28479bc)) +* update lockfile ([a3a2e4f](https://github.com/scaleapi/scale-agentex-python/commit/a3a2e4fbcf6e6e4bcbadab50c6b9236e4514dae2)) + ## 0.6.7 (2025-11-19) Full Changelog: [v0.6.6...v0.6.7](https://github.com/scaleapi/scale-agentex-python/compare/v0.6.6...v0.6.7) diff --git a/README.md b/README.md index 99ba8d54..5941deff 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ pip install agentex-sdk[aiohttp] Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: ```python +import os import asyncio from agentex import DefaultAioHttpClient from agentex import AsyncAgentex @@ -120,7 +121,7 @@ from agentex import AsyncAgentex async def main() -> None: async with AsyncAgentex( - api_key="My API Key", + api_key=os.environ.get("AGENTEX_SDK_API_KEY"), # This is the default and can be omitted http_client=DefaultAioHttpClient(), ) as client: tasks = await client.tasks.list() diff --git a/pyproject.toml b/pyproject.toml index 543c4e59..3eed8b99 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,19 +1,20 @@ [project] name = "agentex-sdk" -version = "0.6.7" +version = "0.7.0" description = "The official Python library for the agentex API" dynamic = ["readme"] license = "Apache-2.0" authors = [ { name = "Agentex", email = "roxanne.farhad@scale.com" }, ] + dependencies = [ "httpx>=0.27.2,<0.28", "pydantic>=2.0.0, <3", - "typing-extensions>=4.10, <5", - "anyio>=3.5.0, <5", - "distro>=1.7.0, <2", - "sniffio", + "typing-extensions>=4.10, <5", + "anyio>=3.5.0, <5", + "distro>=1.7.0, <2", + "sniffio", "typer>=0.16,<0.17", "questionary>=2.0.1,<3", "rich>=13.9.2,<14", @@ -48,6 +49,7 @@ dependencies = [ "claude-agent-sdk>=0.1.0", "anthropic>=0.40.0", ] + requires-python = ">= 3.12,<4" classifiers = [ "Typing :: Typed", @@ -82,7 +84,7 @@ managed = true # version pins are in requirements-dev.lock dev-dependencies = [ "pyright==1.1.399", - "mypy", + "mypy==1.17", "respx", "pytest", "pytest-asyncio", diff --git a/requirements-dev.lock b/requirements-dev.lock index 31ac0a65..1078b30d 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -12,13 +12,13 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.12.8 +aiohttp==3.13.2 # via agentex-sdk # via httpx-aiohttp # via litellm aiosignal==1.3.2 # via aiohttp -annotated-types==0.6.0 +annotated-types==0.7.0 # via pydantic anyio==4.10.0 # via agentex-sdk @@ -74,7 +74,7 @@ decorator==5.2.1 dirty-equals==0.6.0 distlib==0.3.7 # via virtualenv -distro==1.8.0 +distro==1.9.0 # via agentex-sdk # via openai # via scale-gp @@ -90,7 +90,7 @@ fastapi==0.115.14 filelock==3.12.4 # via huggingface-hub # via virtualenv -frozenlist==1.6.2 +frozenlist==1.8.0 # via aiohttp # via aiosignal fsspec==2025.7.0 @@ -175,11 +175,11 @@ mcp==1.12.4 # via openai-agents mdurl==0.1.2 # via markdown-it-py -multidict==6.4.4 +multidict==6.7.0 # via aiohttp # via yarl -mypy==1.14.1 -mypy-extensions==1.0.0 +mypy==1.17.0 +mypy-extensions==1.1.0 # via mypy nest-asyncio==1.6.0 # via ipykernel @@ -204,6 +204,8 @@ packaging==23.2 # via ipykernel # via nox # via pytest +pathspec==0.12.1 + # via mypy parso==0.8.4 # via jedi pexpect==4.9.0 @@ -211,7 +213,7 @@ pexpect==4.9.0 platformdirs==3.11.0 # via jupyter-core # via virtualenv -pluggy==1.5.0 +pluggy==1.6.0 # via pytest prompt-toolkit==3.0.51 # via ipython @@ -325,7 +327,7 @@ shellingham==1.5.4 six==1.16.0 # via kubernetes # via python-dateutil -sniffio==1.3.0 +sniffio==1.3.1 # via agentex-sdk # via anyio # via httpx @@ -371,6 +373,7 @@ types-urllib3==1.26.25.14 # via types-requests typing-extensions==4.12.2 # via agentex-sdk + # via aiosignal # via anyio # via fastapi # via huggingface-hub @@ -389,7 +392,8 @@ typing-extensions==4.12.2 # via temporalio # via typer # via typing-inspection -typing-inspection==0.4.1 + # via virtualenv +typing-inspection==0.4.2 # via pydantic # via pydantic-settings tzdata==2025.2 @@ -414,5 +418,5 @@ wrapt==1.17.3 # via ddtrace yarl==1.20.0 # via aiohttp -zipp==3.17.0 +zipp==3.23.0 # via importlib-metadata diff --git a/requirements.lock b/requirements.lock index b5f77614..79519671 100644 --- a/requirements.lock +++ b/requirements.lock @@ -12,13 +12,13 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.12.8 +aiohttp==3.13.2 # via agentex-sdk # via httpx-aiohttp # via litellm aiosignal==1.3.2 # via aiohttp -annotated-types==0.6.0 +annotated-types==0.7.0 # via pydantic anyio==4.10.0 # via agentex-sdk @@ -200,6 +200,9 @@ prompt-toolkit==3.0.51 propcache==0.3.1 # via aiohttp # via yarl +pydantic==2.12.5 + # via agentex-sdk +pydantic-core==2.41.5 protobuf==5.29.5 # via ddtrace # via temporalio @@ -214,18 +217,6 @@ pyasn1==0.6.1 # via rsa pyasn1-modules==0.4.2 # via google-auth -pydantic==2.11.9 - # via agentex-sdk - # via fastapi - # via litellm - # via mcp - # via openai - # via openai-agents - # via pydantic-settings - # via python-on-whales - # via scale-gp - # via scale-gp-beta -pydantic-core==2.33.2 # via pydantic pydantic-settings==2.10.1 # via mcp @@ -299,7 +290,7 @@ six==1.17.0 # via python-dateutil sniffio==1.3.0 # via agentex-sdk - # via anyio +typing-extensions==4.15.0 # via httpx # via openai # via scale-gp @@ -340,8 +331,8 @@ types-requests==2.31.0.6 # via openai-agents types-urllib3==1.26.25.14 # via types-requests -typing-extensions==4.12.2 # via agentex-sdk + # via aiosignal # via anyio # via fastapi # via huggingface-hub @@ -358,7 +349,7 @@ typing-extensions==4.12.2 # via temporalio # via typer # via typing-inspection -typing-inspection==0.4.1 +typing-inspection==0.4.2 # via pydantic # via pydantic-settings tzdata==2025.2 diff --git a/src/agentex/_streaming.py b/src/agentex/_streaming.py index ed1382cc..bfe61d2a 100644 --- a/src/agentex/_streaming.py +++ b/src/agentex/_streaming.py @@ -54,11 +54,12 @@ def __stream__(self) -> Iterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # As we might not fully consume the response stream, we need to close it explicitly - response.close() + try: + for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + response.close() def __enter__(self) -> Self: return self @@ -117,11 +118,12 @@ async def __stream__(self) -> AsyncIterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - async for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # As we might not fully consume the response stream, we need to close it explicitly - await response.aclose() + try: + async for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + await response.aclose() async def __aenter__(self) -> Self: return self diff --git a/src/agentex/_types.py b/src/agentex/_types.py index e546d27f..e0fccac6 100644 --- a/src/agentex/_types.py +++ b/src/agentex/_types.py @@ -243,6 +243,9 @@ class HttpxSendArgs(TypedDict, total=False): if TYPE_CHECKING: # This works because str.__contains__ does not accept object (either in typeshed or at runtime) # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285 + # + # Note: index() and count() methods are intentionally omitted to allow pyright to properly + # infer TypedDict types when dict literals are used in lists assigned to SequenceNotStr. class SequenceNotStr(Protocol[_T_co]): @overload def __getitem__(self, index: SupportsIndex, /) -> _T_co: ... @@ -251,8 +254,6 @@ def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ... def __contains__(self, value: object, /) -> bool: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T_co]: ... - def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ... - def count(self, value: Any, /) -> int: ... def __reversed__(self) -> Iterator[_T_co]: ... else: # just point this to a normal `Sequence` at runtime to avoid having to special case diff --git a/src/agentex/_version.py b/src/agentex/_version.py index f5647ae4..24f2919e 100644 --- a/src/agentex/_version.py +++ b/src/agentex/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "agentex" -__version__ = "0.6.7" # x-release-please-version +__version__ = "0.7.0" # x-release-please-version diff --git a/src/agentex/resources/agents.py b/src/agentex/resources/agents.py index a479781c..ae6821e7 100644 --- a/src/agentex/resources/agents.py +++ b/src/agentex/resources/agents.py @@ -93,6 +93,8 @@ def list( self, *, limit: int | Omit = omit, + order_by: Optional[str] | Omit = omit, + order_direction: str | Omit = omit, page_number: int | Omit = omit, task_id: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -108,6 +110,10 @@ def list( Args: limit: Limit + order_by: Field to order by + + order_direction: Order direction (asc or desc) + page_number: Page number task_id: Task ID @@ -130,6 +136,8 @@ def list( query=maybe_transform( { "limit": limit, + "order_by": order_by, + "order_direction": order_direction, "page_number": page_number, "task_id": task_id, }, @@ -653,6 +661,8 @@ async def list( self, *, limit: int | Omit = omit, + order_by: Optional[str] | Omit = omit, + order_direction: str | Omit = omit, page_number: int | Omit = omit, task_id: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -668,6 +678,10 @@ async def list( Args: limit: Limit + order_by: Field to order by + + order_direction: Order direction (asc or desc) + page_number: Page number task_id: Task ID @@ -690,6 +704,8 @@ async def list( query=await async_maybe_transform( { "limit": limit, + "order_by": order_by, + "order_direction": order_direction, "page_number": page_number, "task_id": task_id, }, diff --git a/src/agentex/resources/messages/messages.py b/src/agentex/resources/messages/messages.py index 84537bca..401acccb 100644 --- a/src/agentex/resources/messages/messages.py +++ b/src/agentex/resources/messages/messages.py @@ -181,6 +181,8 @@ def list( *, task_id: str, limit: int | Omit = omit, + order_by: Optional[str] | Omit = omit, + order_direction: str | Omit = omit, page_number: int | Omit = omit, # 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. @@ -214,6 +216,8 @@ def list( { "task_id": task_id, "limit": limit, + "order_by": order_by, + "order_direction": order_direction, "page_number": page_number, }, message_list_params.MessageListParams, @@ -370,6 +374,8 @@ async def list( *, task_id: str, limit: int | Omit = omit, + order_by: Optional[str] | Omit = omit, + order_direction: str | Omit = omit, page_number: int | Omit = omit, # 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. @@ -403,6 +409,8 @@ async def list( { "task_id": task_id, "limit": limit, + "order_by": order_by, + "order_direction": order_direction, "page_number": page_number, }, message_list_params.MessageListParams, diff --git a/src/agentex/resources/spans.py b/src/agentex/resources/spans.py index 427ae079..589c2ac6 100644 --- a/src/agentex/resources/spans.py +++ b/src/agentex/resources/spans.py @@ -223,6 +223,8 @@ def list( self, *, limit: int | Omit = omit, + order_by: Optional[str] | Omit = omit, + order_direction: str | Omit = omit, page_number: int | Omit = omit, trace_id: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -254,6 +256,8 @@ def list( query=maybe_transform( { "limit": limit, + "order_by": order_by, + "order_direction": order_direction, "page_number": page_number, "trace_id": trace_id, }, @@ -462,6 +466,8 @@ async def list( self, *, limit: int | Omit = omit, + order_by: Optional[str] | Omit = omit, + order_direction: str | Omit = omit, page_number: int | Omit = omit, trace_id: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -493,6 +499,8 @@ async def list( query=await async_maybe_transform( { "limit": limit, + "order_by": order_by, + "order_direction": order_direction, "page_number": page_number, "trace_id": trace_id, }, diff --git a/src/agentex/resources/states.py b/src/agentex/resources/states.py index 8642317e..a8f3d085 100644 --- a/src/agentex/resources/states.py +++ b/src/agentex/resources/states.py @@ -167,6 +167,8 @@ def list( *, agent_id: Optional[str] | Omit = omit, limit: int | Omit = omit, + order_by: Optional[str] | Omit = omit, + order_direction: str | Omit = omit, page_number: int | Omit = omit, task_id: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -184,6 +186,10 @@ def list( limit: Limit + order_by: Field to order by + + order_direction: Order direction (asc or desc) + page_number: Page number task_id: Task ID @@ -207,6 +213,8 @@ def list( { "agent_id": agent_id, "limit": limit, + "order_by": order_by, + "order_direction": order_direction, "page_number": page_number, "task_id": task_id, }, @@ -393,6 +401,8 @@ async def list( *, agent_id: Optional[str] | Omit = omit, limit: int | Omit = omit, + order_by: Optional[str] | Omit = omit, + order_direction: str | Omit = omit, page_number: int | Omit = omit, task_id: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -410,6 +420,10 @@ async def list( limit: Limit + order_by: Field to order by + + order_direction: Order direction (asc or desc) + page_number: Page number task_id: Task ID @@ -433,6 +447,8 @@ async def list( { "agent_id": agent_id, "limit": limit, + "order_by": order_by, + "order_direction": order_direction, "page_number": page_number, "task_id": task_id, }, diff --git a/src/agentex/resources/tasks.py b/src/agentex/resources/tasks.py index a941c42b..1bf41b7b 100644 --- a/src/agentex/resources/tasks.py +++ b/src/agentex/resources/tasks.py @@ -92,6 +92,8 @@ def list( agent_id: Optional[str] | Omit = omit, agent_name: Optional[str] | Omit = omit, limit: int | Omit = omit, + order_by: Optional[str] | Omit = omit, + order_direction: str | Omit = omit, page_number: int | Omit = omit, relationships: List[Literal["agents"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -125,6 +127,8 @@ def list( "agent_id": agent_id, "agent_name": agent_name, "limit": limit, + "order_by": order_by, + "order_direction": order_direction, "page_number": page_number, "relationships": relationships, }, @@ -377,6 +381,8 @@ async def list( agent_id: Optional[str] | Omit = omit, agent_name: Optional[str] | Omit = omit, limit: int | Omit = omit, + order_by: Optional[str] | Omit = omit, + order_direction: str | Omit = omit, page_number: int | Omit = omit, relationships: List[Literal["agents"]] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -410,6 +416,8 @@ async def list( "agent_id": agent_id, "agent_name": agent_name, "limit": limit, + "order_by": order_by, + "order_direction": order_direction, "page_number": page_number, "relationships": relationships, }, diff --git a/src/agentex/resources/tracker.py b/src/agentex/resources/tracker.py index 516e958f..15906b3f 100644 --- a/src/agentex/resources/tracker.py +++ b/src/agentex/resources/tracker.py @@ -132,6 +132,8 @@ def list( *, agent_id: Optional[str] | Omit = omit, limit: int | Omit = omit, + order_by: Optional[str] | Omit = omit, + order_direction: str | Omit = omit, page_number: int | Omit = omit, task_id: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -149,6 +151,10 @@ def list( limit: Limit + order_by: Field to order by + + order_direction: Order direction (asc or desc) + page_number: Page number task_id: Task ID @@ -172,6 +178,8 @@ def list( { "agent_id": agent_id, "limit": limit, + "order_by": order_by, + "order_direction": order_direction, "page_number": page_number, "task_id": task_id, }, @@ -290,6 +298,8 @@ async def list( *, agent_id: Optional[str] | Omit = omit, limit: int | Omit = omit, + order_by: Optional[str] | Omit = omit, + order_direction: str | Omit = omit, page_number: int | Omit = omit, task_id: Optional[str] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -307,6 +317,10 @@ async def list( limit: Limit + order_by: Field to order by + + order_direction: Order direction (asc or desc) + page_number: Page number task_id: Task ID @@ -330,6 +344,8 @@ async def list( { "agent_id": agent_id, "limit": limit, + "order_by": order_by, + "order_direction": order_direction, "page_number": page_number, "task_id": task_id, }, diff --git a/src/agentex/types/agent_list_params.py b/src/agentex/types/agent_list_params.py index a724de35..084fdfae 100644 --- a/src/agentex/types/agent_list_params.py +++ b/src/agentex/types/agent_list_params.py @@ -12,6 +12,12 @@ class AgentListParams(TypedDict, total=False): limit: int """Limit""" + order_by: Optional[str] + """Field to order by""" + + order_direction: str + """Order direction (asc or desc)""" + page_number: int """Page number""" diff --git a/src/agentex/types/agent_rpc_result.py b/src/agentex/types/agent_rpc_result.py index 63e30a5d..d8a0ead8 100644 --- a/src/agentex/types/agent_rpc_result.py +++ b/src/agentex/types/agent_rpc_result.py @@ -20,6 +20,8 @@ class StreamTaskMessageStart(BaseModel): + """Event for starting a streaming message""" + content: TaskMessageContent index: Optional[int] = None @@ -35,6 +37,8 @@ class StreamTaskMessageStart(BaseModel): class StreamTaskMessageDelta(BaseModel): + """Event for streaming chunks of content""" + delta: Optional[TaskMessageDelta] = None """Delta for text updates""" @@ -51,6 +55,8 @@ class StreamTaskMessageDelta(BaseModel): class StreamTaskMessageFull(BaseModel): + """Event for streaming the full content""" + content: TaskMessageContent index: Optional[int] = None @@ -66,6 +72,8 @@ class StreamTaskMessageFull(BaseModel): class StreamTaskMessageDone(BaseModel): + """Event for indicating the task is done""" + index: Optional[int] = None parent_task_message: Optional[TaskMessage] = None diff --git a/src/agentex/types/data_delta.py b/src/agentex/types/data_delta.py index e30c12e7..5b15838a 100644 --- a/src/agentex/types/data_delta.py +++ b/src/agentex/types/data_delta.py @@ -9,6 +9,8 @@ class DataDelta(BaseModel): + """Delta for data updates""" + data_delta: Optional[str] = None type: Optional[Literal["data"]] = None diff --git a/src/agentex/types/message_list_params.py b/src/agentex/types/message_list_params.py index 977972e3..87027eed 100644 --- a/src/agentex/types/message_list_params.py +++ b/src/agentex/types/message_list_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import Optional from typing_extensions import Required, TypedDict __all__ = ["MessageListParams"] @@ -13,4 +14,8 @@ class MessageListParams(TypedDict, total=False): limit: int + order_by: Optional[str] + + order_direction: str + page_number: int diff --git a/src/agentex/types/reasoning_content_delta.py b/src/agentex/types/reasoning_content_delta.py index ae79ca8a..8a3e2a88 100644 --- a/src/agentex/types/reasoning_content_delta.py +++ b/src/agentex/types/reasoning_content_delta.py @@ -9,6 +9,8 @@ class ReasoningContentDelta(BaseModel): + """Delta for reasoning content updates""" + content_index: int content_delta: Optional[str] = None diff --git a/src/agentex/types/reasoning_summary_delta.py b/src/agentex/types/reasoning_summary_delta.py index 607cbec2..f12a12e3 100644 --- a/src/agentex/types/reasoning_summary_delta.py +++ b/src/agentex/types/reasoning_summary_delta.py @@ -9,6 +9,8 @@ class ReasoningSummaryDelta(BaseModel): + """Delta for reasoning summary updates""" + summary_index: int summary_delta: Optional[str] = None diff --git a/src/agentex/types/span_list_params.py b/src/agentex/types/span_list_params.py index fc9280b0..40d4d651 100644 --- a/src/agentex/types/span_list_params.py +++ b/src/agentex/types/span_list_params.py @@ -11,6 +11,10 @@ class SpanListParams(TypedDict, total=False): limit: int + order_by: Optional[str] + + order_direction: str + page_number: int trace_id: Optional[str] diff --git a/src/agentex/types/state.py b/src/agentex/types/state.py index 2789c7c3..f0d919b7 100644 --- a/src/agentex/types/state.py +++ b/src/agentex/types/state.py @@ -9,6 +9,16 @@ class State(BaseModel): + """Represents a state in the agent system. + + A state is associated uniquely with a task and an agent. + + This entity is used to store states in MongoDB, with each state + associated with a specific task and agent. The combination of task_id and agent_id is globally unique. + + The state is a dictionary of arbitrary data. + """ + id: str """The task state's unique id""" diff --git a/src/agentex/types/state_list_params.py b/src/agentex/types/state_list_params.py index 9a52c152..9cb7d3dc 100644 --- a/src/agentex/types/state_list_params.py +++ b/src/agentex/types/state_list_params.py @@ -15,6 +15,12 @@ class StateListParams(TypedDict, total=False): limit: int """Limit""" + order_by: Optional[str] + """Field to order by""" + + order_direction: str + """Order direction (asc or desc)""" + page_number: int """Page number""" diff --git a/src/agentex/types/task_list_params.py b/src/agentex/types/task_list_params.py index 6c417eb0..e41bf821 100644 --- a/src/agentex/types/task_list_params.py +++ b/src/agentex/types/task_list_params.py @@ -15,6 +15,10 @@ class TaskListParams(TypedDict, total=False): limit: int + order_by: Optional[str] + + order_direction: str + page_number: int relationships: List[Literal["agents"]] diff --git a/src/agentex/types/task_list_response.py b/src/agentex/types/task_list_response.py index 745c9fbe..85f87c0e 100644 --- a/src/agentex/types/task_list_response.py +++ b/src/agentex/types/task_list_response.py @@ -11,6 +11,8 @@ class TaskListResponseItem(BaseModel): + """Task response model with optional related data based on relationships""" + id: str agents: Optional[List[Agent]] = None diff --git a/src/agentex/types/task_message.py b/src/agentex/types/task_message.py index b5938cc8..1f78e925 100644 --- a/src/agentex/types/task_message.py +++ b/src/agentex/types/task_message.py @@ -11,6 +11,12 @@ class TaskMessage(BaseModel): + """Represents a message in the agent system. + + This entity is used to store messages in MongoDB, with each message + associated with a specific task. + """ + content: TaskMessageContent """The content of the message. diff --git a/src/agentex/types/task_message_update.py b/src/agentex/types/task_message_update.py index 13e1e821..05ad128c 100644 --- a/src/agentex/types/task_message_update.py +++ b/src/agentex/types/task_message_update.py @@ -19,6 +19,8 @@ class StreamTaskMessageStart(BaseModel): + """Event for starting a streaming message""" + content: TaskMessageContent index: Optional[int] = None @@ -34,6 +36,8 @@ class StreamTaskMessageStart(BaseModel): class StreamTaskMessageDelta(BaseModel): + """Event for streaming chunks of content""" + delta: Optional[TaskMessageDelta] = None """Delta for text updates""" @@ -50,6 +54,8 @@ class StreamTaskMessageDelta(BaseModel): class StreamTaskMessageFull(BaseModel): + """Event for streaming the full content""" + content: TaskMessageContent index: Optional[int] = None @@ -65,6 +71,8 @@ class StreamTaskMessageFull(BaseModel): class StreamTaskMessageDone(BaseModel): + """Event for indicating the task is done""" + index: Optional[int] = None parent_task_message: Optional[TaskMessage] = None diff --git a/src/agentex/types/task_retrieve_by_name_response.py b/src/agentex/types/task_retrieve_by_name_response.py index 4d8ae95d..1ffc6819 100644 --- a/src/agentex/types/task_retrieve_by_name_response.py +++ b/src/agentex/types/task_retrieve_by_name_response.py @@ -11,6 +11,8 @@ class TaskRetrieveByNameResponse(BaseModel): + """Task response model with optional related data based on relationships""" + id: str agents: Optional[List[Agent]] = None diff --git a/src/agentex/types/task_retrieve_response.py b/src/agentex/types/task_retrieve_response.py index f824b368..5f262946 100644 --- a/src/agentex/types/task_retrieve_response.py +++ b/src/agentex/types/task_retrieve_response.py @@ -11,6 +11,8 @@ class TaskRetrieveResponse(BaseModel): + """Task response model with optional related data based on relationships""" + id: str agents: Optional[List[Agent]] = None diff --git a/src/agentex/types/text_content.py b/src/agentex/types/text_content.py index df8ea167..8c8b77e8 100644 --- a/src/agentex/types/text_content.py +++ b/src/agentex/types/text_content.py @@ -12,6 +12,8 @@ class Attachment(BaseModel): + """Represents a file attachment in messages.""" + file_id: str """The unique ID of the attached file""" diff --git a/src/agentex/types/text_content_param.py b/src/agentex/types/text_content_param.py index 9923a2a8..5415d9c4 100644 --- a/src/agentex/types/text_content_param.py +++ b/src/agentex/types/text_content_param.py @@ -13,6 +13,8 @@ class Attachment(TypedDict, total=False): + """Represents a file attachment in messages.""" + file_id: Required[str] """The unique ID of the attached file""" diff --git a/src/agentex/types/text_delta.py b/src/agentex/types/text_delta.py index 29a60cfd..def7cf91 100644 --- a/src/agentex/types/text_delta.py +++ b/src/agentex/types/text_delta.py @@ -9,6 +9,8 @@ class TextDelta(BaseModel): + """Delta for text updates""" + text_delta: Optional[str] = None type: Optional[Literal["text"]] = None diff --git a/src/agentex/types/tool_request_delta.py b/src/agentex/types/tool_request_delta.py index 7877dfdd..888520f8 100644 --- a/src/agentex/types/tool_request_delta.py +++ b/src/agentex/types/tool_request_delta.py @@ -9,6 +9,8 @@ class ToolRequestDelta(BaseModel): + """Delta for tool request updates""" + name: str tool_call_id: str diff --git a/src/agentex/types/tool_response_delta.py b/src/agentex/types/tool_response_delta.py index 383770db..8c34a16a 100644 --- a/src/agentex/types/tool_response_delta.py +++ b/src/agentex/types/tool_response_delta.py @@ -9,6 +9,8 @@ class ToolResponseDelta(BaseModel): + """Delta for tool response updates""" + name: str tool_call_id: str diff --git a/src/agentex/types/tracker_list_params.py b/src/agentex/types/tracker_list_params.py index e90dbbb4..57234f4a 100644 --- a/src/agentex/types/tracker_list_params.py +++ b/src/agentex/types/tracker_list_params.py @@ -15,6 +15,12 @@ class TrackerListParams(TypedDict, total=False): limit: int """Limit""" + order_by: Optional[str] + """Field to order by""" + + order_direction: str + """Order direction (asc or desc)""" + page_number: int """Page number""" diff --git a/tests/api_resources/test_agents.py b/tests/api_resources/test_agents.py index eec3eaa1..2b078045 100644 --- a/tests/api_resources/test_agents.py +++ b/tests/api_resources/test_agents.py @@ -76,6 +76,8 @@ def test_method_list(self, client: Agentex) -> None: def test_method_list_with_all_params(self, client: Agentex) -> None: agent = client.agents.list( limit=1, + order_by="order_by", + order_direction="order_direction", page_number=1, task_id="task_id", ) @@ -418,6 +420,8 @@ async def test_method_list(self, async_client: AsyncAgentex) -> None: async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> None: agent = await async_client.agents.list( limit=1, + order_by="order_by", + order_direction="order_direction", page_number=1, task_id="task_id", ) diff --git a/tests/api_resources/test_messages.py b/tests/api_resources/test_messages.py index 8a8e57c9..fb5991fa 100644 --- a/tests/api_resources/test_messages.py +++ b/tests/api_resources/test_messages.py @@ -241,6 +241,8 @@ def test_method_list_with_all_params(self, client: Agentex) -> None: message = client.messages.list( task_id="task_id", limit=0, + order_by="order_by", + order_direction="order_direction", page_number=0, ) assert_matches_type(MessageListResponse, message, path=["response"]) @@ -497,6 +499,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> message = await async_client.messages.list( task_id="task_id", limit=0, + order_by="order_by", + order_direction="order_direction", page_number=0, ) assert_matches_type(MessageListResponse, message, path=["response"]) diff --git a/tests/api_resources/test_spans.py b/tests/api_resources/test_spans.py index 9e680966..8bfdb952 100644 --- a/tests/api_resources/test_spans.py +++ b/tests/api_resources/test_spans.py @@ -186,6 +186,8 @@ def test_method_list(self, client: Agentex) -> None: def test_method_list_with_all_params(self, client: Agentex) -> None: span = client.spans.list( limit=0, + order_by="order_by", + order_direction="order_direction", page_number=0, trace_id="trace_id", ) @@ -386,6 +388,8 @@ async def test_method_list(self, async_client: AsyncAgentex) -> None: async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> None: span = await async_client.spans.list( limit=0, + order_by="order_by", + order_direction="order_direction", page_number=0, trace_id="trace_id", ) diff --git a/tests/api_resources/test_states.py b/tests/api_resources/test_states.py index 5ed19e8a..0b319342 100644 --- a/tests/api_resources/test_states.py +++ b/tests/api_resources/test_states.py @@ -166,6 +166,8 @@ def test_method_list_with_all_params(self, client: Agentex) -> None: state = client.states.list( agent_id="agent_id", limit=1, + order_by="order_by", + order_direction="order_direction", page_number=1, task_id="task_id", ) @@ -389,6 +391,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> state = await async_client.states.list( agent_id="agent_id", limit=1, + order_by="order_by", + order_direction="order_direction", page_number=1, task_id="task_id", ) diff --git a/tests/api_resources/test_tasks.py b/tests/api_resources/test_tasks.py index 4f02757f..ce240bad 100644 --- a/tests/api_resources/test_tasks.py +++ b/tests/api_resources/test_tasks.py @@ -87,6 +87,8 @@ def test_method_list_with_all_params(self, client: Agentex) -> None: agent_id="agent_id", agent_name="agent_name", limit=0, + order_by="order_by", + order_direction="order_direction", page_number=0, relationships=["agents"], ) @@ -401,6 +403,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> agent_id="agent_id", agent_name="agent_name", limit=0, + order_by="order_by", + order_direction="order_direction", page_number=0, relationships=["agents"], ) diff --git a/tests/api_resources/test_tracker.py b/tests/api_resources/test_tracker.py index 33e7e25d..ae4a3a91 100644 --- a/tests/api_resources/test_tracker.py +++ b/tests/api_resources/test_tracker.py @@ -125,6 +125,8 @@ def test_method_list_with_all_params(self, client: Agentex) -> None: tracker = client.tracker.list( agent_id="agent_id", limit=1, + order_by="order_by", + order_direction="order_direction", page_number=1, task_id="task_id", ) @@ -265,6 +267,8 @@ async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> tracker = await async_client.tracker.list( agent_id="agent_id", limit=1, + order_by="order_by", + order_direction="order_direction", page_number=1, task_id="task_id", )