diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7cf293aab..d6cc9ffb3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,14 @@ name: CI on: push: - branches-ignore: - - 'generated' - - 'codegen/**' - - 'integrated/**' - - 'stl-preview-head/**' - - 'stl-preview-base/**' + branches: + - '**' + - '!integrated/**' + - '!stl-preview-head/**' + - '!stl-preview-base/**' + - '!generated' + - '!codegen/**' + - 'codegen/stl/**' pull_request: branches-ignore: - 'stl-preview-head/**' @@ -17,7 +19,7 @@ jobs: timeout-minutes: 10 name: lint runs-on: ${{ github.repository == 'stainless-sdks/agentex-sdk-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - uses: actions/checkout@v6 @@ -36,7 +38,7 @@ jobs: run: ./scripts/lint build: - if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') timeout-minutes: 10 name: build permissions: @@ -61,14 +63,18 @@ jobs: run: rye build - name: Get GitHub OIDC Token - if: github.repository == 'stainless-sdks/agentex-sdk-python' + if: |- + github.repository == 'stainless-sdks/agentex-sdk-python' && + !startsWith(github.ref, 'refs/heads/stl/') id: github-oidc uses: actions/github-script@v8 with: script: core.setOutput('github_token', await core.getIDToken()); - name: Upload tarball - if: github.repository == 'stainless-sdks/agentex-sdk-python' + if: |- + github.repository == 'stainless-sdks/agentex-sdk-python' && + !startsWith(github.ref, 'refs/heads/stl/') env: URL: https://pkg.stainless.com/s AUTH: ${{ steps.github-oidc.outputs.github_token }} diff --git a/.gitignore b/.gitignore index 6398505af..8d1280062 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .prism.log +.stdy.log _dev __pycache__ diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 871c1ad9e..bfa837fbf 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.9.5" + ".": "0.9.6" } diff --git a/.stats.yml b/.stats.yml index b62e4e62b..8ebd3262a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 35 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-c9b5ca9e03141b62fa981944af1c880cd4562f0b697ed5f110c0e0e754f455ba.yml -openapi_spec_hash: 9ed347fceac28248d2a0acb49c4eb356 -config_hash: 32eb65911c08ac84d117cecdf2759869 +configured_endpoints: 45 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/sgp%2Fagentex-sdk-484a34db630cbb844d4496b9eada50771ded02db3f8ef71ec5316ce14d5470e4.yml +openapi_spec_hash: aba2cc1906c8b07dc66f3b290d6d176f +config_hash: fb079ef7936611b032568661b8165f19 diff --git a/CHANGELOG.md b/CHANGELOG.md index bf3556280..27f0a0c1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,42 @@ # Changelog +## 0.9.6 (2026-03-30) + +Full Changelog: [v0.9.5...v0.9.6](https://github.com/scaleapi/scale-agentex-python/compare/v0.9.5...v0.9.6) + +### Features + +* **api:** add task state update methods ([d699e24](https://github.com/scaleapi/scale-agentex-python/commit/d699e245d6c8f28034370ea6a654e11a3b78dc20)) +* **api:** keep backwards compatible models ([3ec2a1e](https://github.com/scaleapi/scale-agentex-python/commit/3ec2a1e9987cd69fbcfeee8a8a6449b6825a1d49)) +* **api:** use DeploymentHistory instead of DeploymentHistoryRetrieveResponse ([4c63d9c](https://github.com/scaleapi/scale-agentex-python/commit/4c63d9c340e56d7f602f77f2f1fb33b005577402)) +* **internal:** implement indices array format for query and form serialization ([3bf3db1](https://github.com/scaleapi/scale-agentex-python/commit/3bf3db1f692b44ceb5f4ea39cb8c4fd0f81c01ee)) + + +### Bug Fixes + +* **deps:** bump minimum typing-extensions version ([fd76bc9](https://github.com/scaleapi/scale-agentex-python/commit/fd76bc994dca633c4966967c132323985eafa642)) +* **pydantic:** do not pass `by_alias` unless set ([235636b](https://github.com/scaleapi/scale-agentex-python/commit/235636b424dd4595f1510a87e6b79f3b2e103c97)) +* sanitize endpoint path params ([e6472be](https://github.com/scaleapi/scale-agentex-python/commit/e6472bea7d34a72d070079441b359bef25e87830)) + + +### Chores + +* **ci:** skip lint on metadata-only changes ([f4d5053](https://github.com/scaleapi/scale-agentex-python/commit/f4d5053766e5864338229218f2402d60f431d1fa)) +* **ci:** skip uploading artifacts on stainless-internal branches ([45e7622](https://github.com/scaleapi/scale-agentex-python/commit/45e76227d8b0d5d1c2f398e9945b71eb5953e791)) +* format all `api.md` files ([e67fa69](https://github.com/scaleapi/scale-agentex-python/commit/e67fa69c072f462ea86ecd67b888afa5f97cc7cc)) +* **internal:** add request options to SSE classes ([b788da0](https://github.com/scaleapi/scale-agentex-python/commit/b788da0d1b9fb6100dffb4a99b761ddcb7f0160e)) +* **internal:** bump dependencies ([95112dd](https://github.com/scaleapi/scale-agentex-python/commit/95112dd25a3bf8a49bd1080bfddefd403e64cfcb)) +* **internal:** fix lint error on Python 3.14 ([cb99db1](https://github.com/scaleapi/scale-agentex-python/commit/cb99db1857e373c3dc47d4f5ff6861d06b0ddce4)) +* **internal:** make `test_proxy_environment_variables` more resilient ([7bfaa75](https://github.com/scaleapi/scale-agentex-python/commit/7bfaa75be00bf8f11030f42a3dc6fdcd980c5823)) +* **internal:** make `test_proxy_environment_variables` more resilient to env ([fd1a06e](https://github.com/scaleapi/scale-agentex-python/commit/fd1a06e212cf1a314ac7c61e4d51879401e120f9)) +* **internal:** remove mock server code ([3a5ae0f](https://github.com/scaleapi/scale-agentex-python/commit/3a5ae0f0451610ae56284307d4c2bee1ac2964c1)) +* **internal:** tweak CI branches ([2e74af0](https://github.com/scaleapi/scale-agentex-python/commit/2e74af08e3e2dd4179550e9dd1cf22881195ac91)) +* **internal:** update gitignore ([aba7c4f](https://github.com/scaleapi/scale-agentex-python/commit/aba7c4f8264fdad515a4926884f855c2d87aa910)) +* **internal:** version bump ([1ef69ed](https://github.com/scaleapi/scale-agentex-python/commit/1ef69ed5415d3112055a8040eccfb6eca452e532)) +* **internal:** version bump ([1132255](https://github.com/scaleapi/scale-agentex-python/commit/1132255a0cd7aec1daed38e4110cd6bac53f930a)) +* **internal:** version bump ([60e5402](https://github.com/scaleapi/scale-agentex-python/commit/60e5402c4502957aee7848ab3cdcbfb41503a8ae)) +* update mock server docs ([8c5c6d3](https://github.com/scaleapi/scale-agentex-python/commit/8c5c6d38214b13f645f6fbd75efbbb8116458589)) + ## 0.9.5 (2026-03-24) Full Changelog: [v0.9.4...v0.9.5](https://github.com/scaleapi/scale-agentex-python/compare/v0.9.4...v0.9.5) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d0efe0472..867cd143b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -85,13 +85,6 @@ $ pip install ./path-to-wheel-file.whl ## Running tests -Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. - -```sh -# you will need npm installed -$ npx prism mock path/to/your/openapi.yml -``` - ```sh $ ./scripts/test ``` diff --git a/api.md b/api.md index f70f9b194..3b091ec88 100644 --- a/api.md +++ b/api.md @@ -43,7 +43,13 @@ Methods: Types: ```python -from agentex.types import Task, TaskRetrieveResponse, TaskListResponse, TaskRetrieveByNameResponse +from agentex.types import ( + Task, + TaskRetrieveResponse, + TaskListResponse, + TaskQueryWorkflowResponse, + TaskRetrieveByNameResponse, +) ``` Methods: @@ -51,10 +57,18 @@ Methods: - client.tasks.retrieve(task_id, \*\*params) -> TaskRetrieveResponse - client.tasks.list(\*\*params) -> TaskListResponse - client.tasks.delete(task_id) -> DeleteResponse +- client.tasks.cancel(task_id, \*\*params) -> Task +- client.tasks.complete(task_id, \*\*params) -> Task - client.tasks.delete_by_name(task_name) -> DeleteResponse +- client.tasks.fail(task_id, \*\*params) -> Task +- client.tasks.query_workflow(query_name, \*, task_id) -> TaskQueryWorkflowResponse - client.tasks.retrieve_by_name(task_name, \*\*params) -> TaskRetrieveByNameResponse - client.tasks.stream_events(task_id) -> object - client.tasks.stream_events_by_name(task_name) -> object +- client.tasks.terminate(task_id, \*\*params) -> Task +- client.tasks.timeout(task_id, \*\*params) -> Task +- client.tasks.update_by_id(task_id, \*\*params) -> Task +- client.tasks.update_by_name(task_name, \*\*params) -> Task # Messages diff --git a/pyproject.toml b/pyproject.toml index 13bededf5..e0cde6550 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "agentex-sdk" -version = "0.9.5" +version = "0.9.6" description = "The official Python library for the agentex API" dynamic = ["readme"] license = "Apache-2.0" @@ -11,7 +11,7 @@ authors = [ dependencies = [ "httpx>=0.27.2,<0.28", "pydantic>=2.0.0, <3", - "typing-extensions>=4.10, <5", + "typing-extensions>=4.14, <5", "anyio>=3.5.0, <5", "distro>=1.7.0, <2", "sniffio", @@ -110,7 +110,7 @@ format = { chain = [ # run formatting again to fix any inconsistencies when imports are stripped "format:ruff", ]} -"format:docs" = "python scripts/utils/ruffen-docs.py README.md api.md" +"format:docs" = "bash -c 'python scripts/utils/ruffen-docs.py README.md $(find . -type f -name api.md)'" "format:ruff" = "ruff format" "lint" = { chain = [ diff --git a/requirements-dev.lock b/requirements-dev.lock index 1078b30de..240c3f622 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -12,16 +12,20 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.13.2 +aiohttp==3.13.3 # via agentex-sdk # via httpx-aiohttp # via litellm -aiosignal==1.3.2 +aiosignal==1.4.0 # via aiohttp annotated-types==0.7.0 # via pydantic -anyio==4.10.0 +anthropic==0.86.0 # via agentex-sdk +anyio==4.12.1 + # via agentex-sdk + # via anthropic + # via claude-agent-sdk # via httpx # via mcp # via openai @@ -32,108 +36,126 @@ anyio==4.10.0 # via watchfiles appnope==0.1.4 # via ipykernel -argcomplete==3.1.2 +argcomplete==3.6.3 # via nox -asttokens==3.0.0 +asttokens==3.0.1 # via stack-data -attrs==25.3.0 +attrs==25.4.0 # via aiohttp # via jsonschema + # via nox # via referencing bytecode==0.17.0 # via ddtrace -cachetools==5.5.2 - # via google-auth -certifi==2023.7.22 +certifi==2026.1.4 # via httpcore # via httpx # via kubernetes # via requests -charset-normalizer==3.4.3 +cffi==2.0.0 + # via cryptography +charset-normalizer==3.4.6 # via requests -click==8.2.1 +claude-agent-sdk==0.1.52 + # via agentex-sdk +click==8.3.1 # via litellm # via typer # via uvicorn -cloudpickle==3.1.1 +cloudpickle==3.1.2 # via agentex-sdk colorama==0.4.6 # via griffe -colorlog==6.7.0 +colorlog==6.10.1 # via nox comm==0.2.3 # via ipykernel +cryptography==46.0.6 + # via google-auth + # via pyjwt datadog==0.52.1 # via agentex-sdk -ddtrace==3.15.0 +ddtrace==4.6.4 # via agentex-sdk -debugpy==1.8.16 +debugpy==1.8.20 # via ipykernel decorator==5.2.1 # via ipython -dirty-equals==0.6.0 -distlib==0.3.7 +dependency-groups==1.3.1 + # via nox +dirty-equals==0.11 +distlib==0.4.0 # via virtualenv distro==1.9.0 # via agentex-sdk + # via anthropic # via openai # via scale-gp # via scale-gp-beta +docstring-parser==0.17.0 + # via anthropic envier==0.6.1 # via ddtrace -execnet==2.1.1 +execnet==2.1.2 # via pytest-xdist -executing==2.2.0 +executing==2.2.1 # via stack-data fastapi==0.115.14 # via agentex-sdk -filelock==3.12.4 +fastuuid==0.14.0 + # via litellm +filelock==3.25.2 # via huggingface-hub # via virtualenv frozenlist==1.8.0 # via aiohttp # via aiosignal -fsspec==2025.7.0 +fsspec==2026.3.0 # via huggingface-hub -google-auth==2.40.3 +google-auth==2.49.1 # via kubernetes -griffe==1.12.0 +griffe==1.15.0 # via openai-agents h11==0.16.0 # via httpcore # via uvicorn -hf-xet==1.1.7 +hf-xet==1.4.2 # via huggingface-hub httpcore==1.0.9 # via httpx httpx==0.27.2 # via agentex-sdk + # via anthropic # via httpx-aiohttp + # via huggingface-hub + # via langsmith # via litellm # via mcp # via openai # via respx # via scale-gp # via scale-gp-beta -httpx-aiohttp==0.1.9 +httpx-aiohttp==0.1.12 # via agentex-sdk -httpx-sse==0.4.1 +httpx-sse==0.4.3 # via mcp -huggingface-hub==0.34.4 +huggingface-hub==1.8.0 # via tokenizers -idna==3.4 +humanize==4.13.0 + # via nox +idna==3.11 # via anyio # via httpx # via requests # via yarl -importlib-metadata==7.0.0 +importlib-metadata==8.7.1 # via litellm # via opentelemetry-api -iniconfig==2.0.0 +iniconfig==2.1.0 # via pytest -ipykernel==6.30.1 +ipykernel==7.2.0 # via agentex-sdk -ipython==9.4.0 +ipython==9.12.0 # via ipykernel ipython-pygments-lexers==1.1.1 # via ipython @@ -142,36 +164,48 @@ jedi==0.19.2 jinja2==3.1.6 # via agentex-sdk # via litellm -jiter==0.10.0 +jiter==0.13.0 + # via anthropic # via openai json-log-formatter==1.1.1 # via agentex-sdk +jsonpatch==1.33 + # via langchain-core +jsonpointer==3.1.1 + # via jsonpatch jsonref==1.1.0 # via agentex-sdk -jsonschema==4.25.0 +jsonschema==4.26.0 # via agentex-sdk # via litellm # via mcp -jsonschema-specifications==2025.4.1 +jsonschema-specifications==2025.9.1 # via jsonschema -jupyter-client==8.6.3 +jupyter-client==8.8.0 # via ipykernel -jupyter-core==5.8.1 +jupyter-core==5.9.1 # via ipykernel # via jupyter-client kubernetes==28.1.0 # via agentex-sdk -litellm==1.75.5.post1 +langchain-core==1.2.23 + # via langgraph-checkpoint +langgraph-checkpoint==4.0.1 + # via agentex-sdk +langsmith==0.7.22 + # via langchain-core +litellm==1.82.6 # via agentex-sdk markdown-it-py==3.0.0 # via rich -markupsafe==3.0.2 +markupsafe==3.0.3 # via jinja2 -matplotlib-inline==0.1.7 +matplotlib-inline==0.2.1 # via ipykernel # via ipython -mcp==1.12.4 +mcp==1.26.0 # via agentex-sdk + # via claude-agent-sdk # via openai-agents mdurl==0.1.2 # via markdown-it-py @@ -183,61 +217,78 @@ mypy-extensions==1.1.0 # via mypy nest-asyncio==1.6.0 # via ipykernel -nexus-rpc==1.1.0 +nexus-rpc==1.4.0 # via temporalio -nodeenv==1.8.0 +nodeenv==1.10.0 # via pyright -nox==2023.4.22 +nox==2025.11.12 oauthlib==3.3.1 # via kubernetes # via requests-oauthlib -openai==2.7.1 +openai==2.30.0 # via agentex-sdk # via litellm # via openai-agents openai-agents==0.4.2 # via agentex-sdk -opentelemetry-api==1.37.0 +opentelemetry-api==1.40.0 + # via agentex-sdk # via ddtrace -packaging==23.2 + # via opentelemetry-sdk + # via opentelemetry-semantic-conventions +opentelemetry-sdk==1.40.0 + # via agentex-sdk +opentelemetry-semantic-conventions==0.61b0 + # via opentelemetry-sdk +orjson==3.11.7 + # via langsmith +ormsgpack==1.12.2 + # via langgraph-checkpoint +packaging==25.0 + # via dependency-groups # via huggingface-hub # via ipykernel + # via langchain-core + # via langsmith # via nox # via pytest -pathspec==0.12.1 - # via mypy -parso==0.8.4 +parso==0.8.6 # via jedi +pathspec==1.0.3 + # via mypy pexpect==4.9.0 # via ipython -platformdirs==3.11.0 +platformdirs==4.4.0 # via jupyter-core # via virtualenv pluggy==1.6.0 # via pytest -prompt-toolkit==3.0.51 +prompt-toolkit==3.0.52 # via ipython # via questionary -propcache==0.3.1 +propcache==0.4.1 # via aiohttp # via yarl -protobuf==5.29.5 - # via ddtrace +protobuf==6.33.6 # via temporalio -psutil==7.0.0 +psutil==7.2.2 # via ipykernel ptyprocess==0.7.0 # via pexpect pure-eval==0.2.3 # via stack-data -pyasn1==0.6.1 +pyasn1==0.6.3 # via pyasn1-modules - # via rsa pyasn1-modules==0.4.2 # via google-auth -pydantic==2.11.9 +pycparser==3.0 + # via cffi +pydantic==2.12.5 # via agentex-sdk + # via anthropic # via fastapi + # via langchain-core + # via langsmith # via litellm # via mcp # via openai @@ -246,112 +297,115 @@ pydantic==2.11.9 # via python-on-whales # via scale-gp # via scale-gp-beta -pydantic-core==2.33.2 +pydantic-core==2.41.5 # via pydantic -pydantic-settings==2.10.1 +pydantic-settings==2.13.1 # via mcp -pygments==2.18.0 +pygments==2.19.2 # via ipython # via ipython-pygments-lexers # via pytest # via rich -pyjwt==2.10.1 +pyjwt==2.12.1 + # via mcp # via redis pyright==1.1.399 -pytest==8.4.1 +pytest==8.4.2 # via agentex-sdk # via pytest-asyncio # via pytest-xdist -pytest-asyncio==1.1.0 +pytest-asyncio==1.2.0 # via agentex-sdk -pytest-xdist==3.7.0 -python-dateutil==2.8.2 +pytest-xdist==3.8.0 +python-dateutil==2.9.0.post0 # via jupyter-client # via kubernetes # via time-machine -python-dotenv==1.1.1 +python-dotenv==1.2.2 # via litellm # via mcp # via pydantic-settings -python-multipart==0.0.20 +python-multipart==0.0.22 # via mcp python-on-whales==0.73.0 # via agentex-sdk -pytz==2023.3.post1 - # via dirty-equals -pyyaml==6.0.2 +pyyaml==6.0.3 # via agentex-sdk # via huggingface-hub # via kubernetes -pyzmq==27.0.1 + # via langchain-core +pyzmq==27.1.0 # via ipykernel # via jupyter-client -questionary==2.1.0 +questionary==2.1.1 # via agentex-sdk redis==5.3.1 # via agentex-sdk -referencing==0.36.2 +referencing==0.37.0 # via jsonschema # via jsonschema-specifications -regex==2025.7.34 +regex==2026.3.32 # via tiktoken -requests==2.32.4 +requests==2.33.1 # via datadog - # via huggingface-hub # via kubernetes + # via langsmith # via openai-agents # via python-on-whales # via requests-oauthlib + # via requests-toolbelt # via tiktoken requests-oauthlib==2.0.0 # via kubernetes +requests-toolbelt==1.0.0 + # via langsmith respx==0.22.0 rich==13.9.4 # via agentex-sdk # via typer -rpds-py==0.27.0 +rpds-py==0.30.0 # via jsonschema # via referencing -rsa==4.9.1 - # via google-auth -ruff==0.9.4 +ruff==0.14.13 # via agentex-sdk -scale-gp==0.1.0a59 +scale-gp==0.1.0a61 # via agentex-sdk -scale-gp-beta==0.1.0a20 +scale-gp-beta==0.1.0a51 # via agentex-sdk -setuptools==68.2.2 - # via nodeenv shellingham==1.5.4 # via typer -six==1.16.0 +six==1.17.0 # via kubernetes # via python-dateutil sniffio==1.3.1 # via agentex-sdk - # via anyio + # via anthropic # via httpx # via openai # via scale-gp # via scale-gp-beta -sse-starlette==3.0.2 +sse-starlette==3.0.3 # via mcp stack-data==0.6.3 # via ipython starlette==0.46.2 # via fastapi # via mcp -temporalio==1.18.2 +temporalio==1.24.0 # via agentex-sdk -tiktoken==0.11.0 +tenacity==9.1.4 + # via langchain-core +termcolor==3.3.0 + # via yaspin +tiktoken==0.12.0 # via litellm -time-machine==2.9.0 -tokenizers==0.21.4 +time-machine==2.19.0 +tokenizers==0.22.2 # via litellm -tornado==6.5.2 +tornado==6.5.5 # via ipykernel # via jupyter-client -tqdm==4.67.1 +tqdm==4.67.3 # via huggingface-hub # via openai # via python-on-whales @@ -361,30 +415,37 @@ traitlets==5.14.3 # via jupyter-client # via jupyter-core # via matplotlib-inline -typer==0.16.0 +typer==0.16.1 # via agentex-sdk + # via huggingface-hub # via mcp # via python-on-whales -types-protobuf==6.30.2.20250809 +types-protobuf==6.32.1.20260221 # via temporalio types-requests==2.31.0.6 # via openai-agents types-urllib3==1.26.25.14 # via types-requests -typing-extensions==4.12.2 +typing-extensions==4.15.0 # via agentex-sdk # via aiosignal + # via anthropic # via anyio # via fastapi # via huggingface-hub + # via langchain-core + # via mcp # via mypy # via nexus-rpc # via openai # via openai-agents # via opentelemetry-api + # via opentelemetry-sdk + # via opentelemetry-semantic-conventions # via pydantic # via pydantic-core # via pyright + # via pytest-asyncio # via python-on-whales # via referencing # via scale-gp @@ -392,31 +453,40 @@ typing-extensions==4.12.2 # via temporalio # via typer # via typing-inspection - # via virtualenv typing-inspection==0.4.2 + # via mcp # via pydantic # via pydantic-settings -tzdata==2025.2 +tzdata==2025.3 # via agentex-sdk tzlocal==5.3.1 # via agentex-sdk urllib3==1.26.20 # via kubernetes # via requests -uvicorn==0.35.0 +uuid-utils==0.14.1 + # via langchain-core + # via langsmith +uvicorn==0.42.0 # via agentex-sdk # via mcp -virtualenv==20.24.5 +virtualenv==20.36.1 # via nox watchfiles==0.24.0 # via agentex-sdk -wcwidth==0.2.13 +wcwidth==0.6.0 # via prompt-toolkit -websocket-client==1.8.0 +websocket-client==1.9.0 # via kubernetes -wrapt==1.17.3 +wrapt==2.1.2 # via ddtrace -yarl==1.20.0 +xxhash==3.6.0 + # via langsmith +yarl==1.22.0 # via aiohttp +yaspin==3.4.0 + # via agentex-sdk zipp==3.23.0 # via importlib-metadata +zstandard==0.25.0 + # via langsmith diff --git a/requirements.lock b/requirements.lock index 79519671e..87cbd10f2 100644 --- a/requirements.lock +++ b/requirements.lock @@ -12,16 +12,20 @@ -e file:. aiohappyeyeballs==2.6.1 # via aiohttp -aiohttp==3.13.2 +aiohttp==3.13.3 # via agentex-sdk # via httpx-aiohttp # via litellm -aiosignal==1.3.2 +aiosignal==1.4.0 # via aiohttp annotated-types==0.7.0 # via pydantic -anyio==4.10.0 +anthropic==0.86.0 # via agentex-sdk +anyio==4.12.1 + # via agentex-sdk + # via anthropic + # via claude-agent-sdk # via httpx # via mcp # via openai @@ -32,97 +36,110 @@ anyio==4.10.0 # via watchfiles appnope==0.1.4 # via ipykernel -asttokens==3.0.0 +asttokens==3.0.1 # via stack-data -attrs==25.3.0 +attrs==25.4.0 # via aiohttp # via jsonschema # via referencing bytecode==0.17.0 # via ddtrace -cachetools==5.5.2 - # via google-auth -certifi==2023.7.22 +certifi==2026.1.4 # via httpcore # via httpx # via kubernetes # via requests -charset-normalizer==3.4.3 +cffi==2.0.0 + # via cryptography +charset-normalizer==3.4.6 # via requests -click==8.2.1 +claude-agent-sdk==0.1.52 + # via agentex-sdk +click==8.3.1 # via litellm # via typer # via uvicorn -cloudpickle==3.1.1 +cloudpickle==3.1.2 # via agentex-sdk colorama==0.4.6 # via griffe comm==0.2.3 # via ipykernel +cryptography==46.0.6 + # via google-auth + # via pyjwt datadog==0.52.1 # via agentex-sdk -ddtrace==3.15.0 +ddtrace==4.6.4 # via agentex-sdk -debugpy==1.8.16 +debugpy==1.8.20 # via ipykernel decorator==5.2.1 # via ipython -distro==1.8.0 +distro==1.9.0 # via agentex-sdk + # via anthropic # via openai # via scale-gp # via scale-gp-beta +docstring-parser==0.17.0 + # via anthropic envier==0.6.1 # via ddtrace -executing==2.2.0 +executing==2.2.1 # via stack-data fastapi==0.115.14 # via agentex-sdk -filelock==3.19.1 +fastuuid==0.14.0 + # via litellm +filelock==3.25.2 # via huggingface-hub -frozenlist==1.6.2 +frozenlist==1.8.0 # via aiohttp # via aiosignal -fsspec==2025.7.0 +fsspec==2026.3.0 # via huggingface-hub -google-auth==2.40.3 +google-auth==2.49.1 # via kubernetes -griffe==1.12.0 +griffe==1.15.0 # via openai-agents h11==0.16.0 # via httpcore # via uvicorn -hf-xet==1.1.7 +hf-xet==1.4.2 # via huggingface-hub httpcore==1.0.9 # via httpx httpx==0.27.2 # via agentex-sdk + # via anthropic # via httpx-aiohttp + # via huggingface-hub + # via langsmith # via litellm # via mcp # via openai # via scale-gp # via scale-gp-beta -httpx-aiohttp==0.1.9 +httpx-aiohttp==0.1.12 # via agentex-sdk -httpx-sse==0.4.1 +httpx-sse==0.4.3 # via mcp -huggingface-hub==0.34.4 +huggingface-hub==1.8.0 # via tokenizers -idna==3.4 +idna==3.11 # via anyio # via httpx # via requests # via yarl -importlib-metadata==8.7.0 +importlib-metadata==8.7.1 # via litellm # via opentelemetry-api -iniconfig==2.1.0 +iniconfig==2.3.0 # via pytest -ipykernel==6.30.1 +ipykernel==7.2.0 # via agentex-sdk -ipython==9.4.0 +ipython==9.12.0 # via ipykernel ipython-pygments-lexers==1.1.1 # via ipython @@ -131,187 +148,231 @@ jedi==0.19.2 jinja2==3.1.6 # via agentex-sdk # via litellm -jiter==0.10.0 +jiter==0.13.0 + # via anthropic # via openai json-log-formatter==1.1.1 # via agentex-sdk +jsonpatch==1.33 + # via langchain-core +jsonpointer==3.1.1 + # via jsonpatch jsonref==1.1.0 # via agentex-sdk -jsonschema==4.25.0 +jsonschema==4.26.0 # via agentex-sdk # via litellm # via mcp -jsonschema-specifications==2025.4.1 +jsonschema-specifications==2025.9.1 # via jsonschema -jupyter-client==8.6.3 +jupyter-client==8.8.0 # via ipykernel -jupyter-core==5.8.1 +jupyter-core==5.9.1 # via ipykernel # via jupyter-client kubernetes==28.1.0 # via agentex-sdk -litellm==1.75.5.post1 +langchain-core==1.2.23 + # via langgraph-checkpoint +langgraph-checkpoint==4.0.1 + # via agentex-sdk +langsmith==0.7.22 + # via langchain-core +litellm==1.82.6 # via agentex-sdk markdown-it-py==4.0.0 # via rich -markupsafe==3.0.2 +markupsafe==3.0.3 # via jinja2 -matplotlib-inline==0.1.7 +matplotlib-inline==0.2.1 # via ipykernel # via ipython -mcp==1.12.4 +mcp==1.26.0 # via agentex-sdk + # via claude-agent-sdk # via openai-agents mdurl==0.1.2 # via markdown-it-py -multidict==6.4.4 +multidict==6.7.0 # via aiohttp # via yarl nest-asyncio==1.6.0 # via ipykernel -nexus-rpc==1.1.0 +nexus-rpc==1.4.0 # via temporalio oauthlib==3.3.1 # via kubernetes # via requests-oauthlib -openai==2.7.1 +openai==2.30.0 # via agentex-sdk # via litellm # via openai-agents openai-agents==0.4.2 # via agentex-sdk -opentelemetry-api==1.37.0 +opentelemetry-api==1.40.0 + # via agentex-sdk # via ddtrace -packaging==25.0 + # via opentelemetry-sdk + # via opentelemetry-semantic-conventions +opentelemetry-sdk==1.40.0 + # via agentex-sdk +opentelemetry-semantic-conventions==0.61b0 + # via opentelemetry-sdk +orjson==3.11.7 + # via langsmith +ormsgpack==1.12.2 + # via langgraph-checkpoint +packaging==26.0 # via huggingface-hub # via ipykernel + # via langchain-core + # via langsmith # via pytest -parso==0.8.4 +parso==0.8.6 # via jedi pexpect==4.9.0 # via ipython -platformdirs==4.3.8 +platformdirs==4.9.4 # via jupyter-core pluggy==1.6.0 # via pytest -prompt-toolkit==3.0.51 +prompt-toolkit==3.0.52 # via ipython # via questionary -propcache==0.3.1 +propcache==0.4.1 # via aiohttp # via yarl -pydantic==2.12.5 - # via agentex-sdk -pydantic-core==2.41.5 -protobuf==5.29.5 - # via ddtrace +protobuf==6.33.6 # via temporalio -psutil==7.0.0 +psutil==7.2.2 # via ipykernel ptyprocess==0.7.0 # via pexpect pure-eval==0.2.3 # via stack-data -pyasn1==0.6.1 +pyasn1==0.6.3 # via pyasn1-modules - # via rsa pyasn1-modules==0.4.2 # via google-auth +pycparser==3.0 + # via cffi +pydantic==2.12.5 + # via agentex-sdk + # via anthropic + # via fastapi + # via langchain-core + # via langsmith + # 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.41.5 # via pydantic -pydantic-settings==2.10.1 +pydantic-settings==2.13.1 # via mcp -pygments==2.19.2 +pygments==2.20.0 # via ipython # via ipython-pygments-lexers # via pytest # via rich -pyjwt==2.10.1 +pyjwt==2.12.1 + # via mcp # via redis -pytest==8.4.1 +pytest==9.0.2 # via agentex-sdk # via pytest-asyncio -pytest-asyncio==1.1.0 +pytest-asyncio==1.3.0 # via agentex-sdk python-dateutil==2.9.0.post0 # via jupyter-client # via kubernetes -python-dotenv==1.1.1 +python-dotenv==1.2.2 # via litellm # via mcp # via pydantic-settings -python-multipart==0.0.20 +python-multipart==0.0.22 # via mcp python-on-whales==0.73.0 # via agentex-sdk -pyyaml==6.0.2 +pyyaml==6.0.3 # via agentex-sdk # via huggingface-hub # via kubernetes -pyzmq==27.0.1 + # via langchain-core +pyzmq==27.1.0 # via ipykernel # via jupyter-client -questionary==2.1.0 +questionary==2.1.1 # via agentex-sdk redis==5.3.1 # via agentex-sdk -referencing==0.36.2 +referencing==0.37.0 # via jsonschema # via jsonschema-specifications -regex==2025.7.34 +regex==2026.3.32 # via tiktoken -requests==2.32.4 +requests==2.33.1 # via datadog - # via huggingface-hub # via kubernetes + # via langsmith # via openai-agents # via python-on-whales # via requests-oauthlib + # via requests-toolbelt # via tiktoken requests-oauthlib==2.0.0 # via kubernetes +requests-toolbelt==1.0.0 + # via langsmith rich==13.9.4 # via agentex-sdk # via typer -rpds-py==0.27.0 +rpds-py==0.30.0 # via jsonschema # via referencing -rsa==4.9.1 - # via google-auth -ruff==0.12.9 +ruff==0.15.8 # via agentex-sdk -scale-gp==0.1.0a59 +scale-gp==0.1.0a61 # via agentex-sdk -scale-gp-beta==0.1.0a20 +scale-gp-beta==0.1.0a51 # via agentex-sdk shellingham==1.5.4 # via typer six==1.17.0 # via kubernetes # via python-dateutil -sniffio==1.3.0 +sniffio==1.3.1 # via agentex-sdk -typing-extensions==4.15.0 + # via anthropic # via httpx # via openai # via scale-gp # via scale-gp-beta -sse-starlette==3.0.2 +sse-starlette==3.0.3 # via mcp stack-data==0.6.3 # via ipython starlette==0.46.2 # via fastapi # via mcp -temporalio==1.18.2 +temporalio==1.24.0 # via agentex-sdk -tiktoken==0.11.0 +tenacity==9.1.4 + # via langchain-core +termcolor==3.3.0 + # via yaspin +tiktoken==0.12.0 # via litellm -tokenizers==0.21.4 +tokenizers==0.22.2 # via litellm -tornado==6.5.2 +tornado==6.5.5 # via ipykernel # via jupyter-client -tqdm==4.67.1 +tqdm==4.67.3 # via huggingface-hub # via openai # via python-on-whales @@ -321,27 +382,35 @@ traitlets==5.14.3 # via jupyter-client # via jupyter-core # via matplotlib-inline -typer==0.16.0 +typer==0.16.1 # via agentex-sdk + # via huggingface-hub # via mcp # via python-on-whales -types-protobuf==6.30.2.20250809 +types-protobuf==6.32.1.20260221 # via temporalio types-requests==2.31.0.6 # via openai-agents types-urllib3==1.26.25.14 # via types-requests +typing-extensions==4.15.0 # via agentex-sdk # via aiosignal + # via anthropic # via anyio # via fastapi # via huggingface-hub + # via langchain-core + # via mcp # via nexus-rpc # via openai # via openai-agents # via opentelemetry-api + # via opentelemetry-sdk + # via opentelemetry-semantic-conventions # via pydantic # via pydantic-core + # via pytest-asyncio # via python-on-whales # via referencing # via scale-gp @@ -350,27 +419,37 @@ types-urllib3==1.26.25.14 # via typer # via typing-inspection typing-inspection==0.4.2 + # via mcp # via pydantic # via pydantic-settings -tzdata==2025.2 +tzdata==2025.3 # via agentex-sdk tzlocal==5.3.1 # via agentex-sdk urllib3==1.26.20 # via kubernetes # via requests -uvicorn==0.35.0 +uuid-utils==0.14.1 + # via langchain-core + # via langsmith +uvicorn==0.42.0 # via agentex-sdk # via mcp watchfiles==0.24.0 # via agentex-sdk -wcwidth==0.2.13 +wcwidth==0.6.0 # via prompt-toolkit -websocket-client==1.8.0 +websocket-client==1.9.0 # via kubernetes -wrapt==1.17.3 +wrapt==2.1.2 # via ddtrace -yarl==1.20.0 +xxhash==3.6.0 + # via langsmith +yarl==1.22.0 # via aiohttp +yaspin==3.4.0 + # via agentex-sdk zipp==3.23.0 # via importlib-metadata +zstandard==0.25.0 + # via langsmith diff --git a/scripts/mock b/scripts/mock deleted file mode 100755 index 0b28f6ea2..000000000 --- a/scripts/mock +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -set -e - -cd "$(dirname "$0")/.." - -if [[ -n "$1" && "$1" != '--'* ]]; then - URL="$1" - shift -else - URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" -fi - -# Check if the URL is empty -if [ -z "$URL" ]; then - echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" - exit 1 -fi - -echo "==> Starting mock server with URL ${URL}" - -# Run prism mock on the given spec -if [ "$1" == "--daemon" ]; then - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log & - - # Wait for server to come online - echo -n "Waiting for server" - while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do - echo -n "." - sleep 0.1 - done - - if grep -q "✖ fatal" ".prism.log"; then - cat .prism.log - exit 1 - fi - - echo -else - npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" -fi diff --git a/scripts/test b/scripts/test index 2c69d995f..d84605d82 100755 --- a/scripts/test +++ b/scripts/test @@ -4,53 +4,7 @@ set -e cd "$(dirname "$0")/.." -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color -function prism_is_running() { - curl --silent "http://localhost:4010" >/dev/null 2>&1 -} - -kill_server_on_port() { - pids=$(lsof -t -i tcp:"$1" || echo "") - if [ "$pids" != "" ]; then - kill "$pids" - echo "Stopped $pids." - fi -} - -function is_overriding_api_base_url() { - [ -n "$TEST_API_BASE_URL" ] -} - -if ! is_overriding_api_base_url && ! prism_is_running ; then - # When we exit this script, make sure to kill the background mock server process - trap 'kill_server_on_port 4010' EXIT - - # Start the dev server - ./scripts/mock --daemon -fi - -if is_overriding_api_base_url ; then - echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" - echo -elif ! prism_is_running ; then - echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" - echo -e "running against your OpenAPI spec." - echo - echo -e "To run the server, pass in the path or url of your OpenAPI" - echo -e "spec to the prism command:" - echo - echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}" - echo - - exit 1 -else - echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" - echo -fi export DEFER_PYDANTIC_BUILD=false diff --git a/src/agentex/_compat.py b/src/agentex/_compat.py index 786ff42ad..e6690a4f2 100644 --- a/src/agentex/_compat.py +++ b/src/agentex/_compat.py @@ -2,7 +2,7 @@ from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload from datetime import date, datetime -from typing_extensions import Self, Literal +from typing_extensions import Self, Literal, TypedDict import pydantic from pydantic.fields import FieldInfo @@ -131,6 +131,10 @@ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: return model.model_dump_json(indent=indent) +class _ModelDumpKwargs(TypedDict, total=False): + by_alias: bool + + def model_dump( model: pydantic.BaseModel, *, @@ -142,6 +146,9 @@ def model_dump( by_alias: bool | None = None, ) -> dict[str, Any]: if (not PYDANTIC_V1) or hasattr(model, "model_dump"): + kwargs: _ModelDumpKwargs = {} + if by_alias is not None: + kwargs["by_alias"] = by_alias return model.model_dump( mode=mode, exclude=exclude, @@ -149,7 +156,7 @@ def model_dump( exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 warnings=True if PYDANTIC_V1 else warnings, - by_alias=by_alias, + **kwargs, ) return cast( "dict[str, Any]", diff --git a/src/agentex/_qs.py b/src/agentex/_qs.py index ada6fd3f7..de8c99bc6 100644 --- a/src/agentex/_qs.py +++ b/src/agentex/_qs.py @@ -101,7 +101,10 @@ def _stringify_item( items.extend(self._stringify_item(key, item, opts)) return items elif array_format == "indices": - raise NotImplementedError("The array indices format is not supported yet") + items = [] + for i, item in enumerate(value): + items.extend(self._stringify_item(f"{key}[{i}]", item, opts)) + return items elif array_format == "brackets": items = [] key = key + "[]" diff --git a/src/agentex/_response.py b/src/agentex/_response.py index be9bfbc37..d8e2464e0 100644 --- a/src/agentex/_response.py +++ b/src/agentex/_response.py @@ -152,6 +152,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: ), response=self.http_response, client=cast(Any, self._client), + options=self._options, ), ) @@ -162,6 +163,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: cast_to=extract_stream_chunk_type(self._stream_cls), response=self.http_response, client=cast(Any, self._client), + options=self._options, ), ) @@ -175,6 +177,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: cast_to=cast_to, response=self.http_response, client=cast(Any, self._client), + options=self._options, ), ) diff --git a/src/agentex/_streaming.py b/src/agentex/_streaming.py index bfe61d2ab..96585bde7 100644 --- a/src/agentex/_streaming.py +++ b/src/agentex/_streaming.py @@ -4,7 +4,7 @@ import json import inspect from types import TracebackType -from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, AsyncIterator, cast +from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, Optional, AsyncIterator, cast from typing_extensions import Self, Protocol, TypeGuard, override, get_origin, runtime_checkable import httpx @@ -13,6 +13,7 @@ if TYPE_CHECKING: from ._client import Agentex, AsyncAgentex + from ._models import FinalRequestOptions _T = TypeVar("_T") @@ -22,7 +23,7 @@ class Stream(Generic[_T]): """Provides the core interface to iterate over a synchronous stream response.""" response: httpx.Response - + _options: Optional[FinalRequestOptions] = None _decoder: SSEBytesDecoder def __init__( @@ -31,10 +32,12 @@ def __init__( cast_to: type[_T], response: httpx.Response, client: Agentex, + options: Optional[FinalRequestOptions] = None, ) -> None: self.response = response self._cast_to = cast_to self._client = client + self._options = options self._decoder = client._make_sse_decoder() self._iterator = self.__stream__() @@ -85,7 +88,7 @@ class AsyncStream(Generic[_T]): """Provides the core interface to iterate over an asynchronous stream response.""" response: httpx.Response - + _options: Optional[FinalRequestOptions] = None _decoder: SSEDecoder | SSEBytesDecoder def __init__( @@ -94,10 +97,12 @@ def __init__( cast_to: type[_T], response: httpx.Response, client: AsyncAgentex, + options: Optional[FinalRequestOptions] = None, ) -> None: self.response = response self._cast_to = cast_to self._client = client + self._options = options self._decoder = client._make_sse_decoder() self._iterator = self.__stream__() diff --git a/src/agentex/_utils/__init__.py b/src/agentex/_utils/__init__.py index dc64e29a1..10cb66d2d 100644 --- a/src/agentex/_utils/__init__.py +++ b/src/agentex/_utils/__init__.py @@ -1,3 +1,4 @@ +from ._path import path_template as path_template from ._sync import asyncify as asyncify from ._proxy import LazyProxy as LazyProxy from ._utils import ( diff --git a/src/agentex/_utils/_compat.py b/src/agentex/_utils/_compat.py index dd703233c..2c70b299c 100644 --- a/src/agentex/_utils/_compat.py +++ b/src/agentex/_utils/_compat.py @@ -26,7 +26,7 @@ def is_union(tp: Optional[Type[Any]]) -> bool: else: import types - return tp is Union or tp is types.UnionType + return tp is Union or tp is types.UnionType # type: ignore[comparison-overlap] def is_typeddict(tp: Type[Any]) -> bool: diff --git a/src/agentex/_utils/_path.py b/src/agentex/_utils/_path.py new file mode 100644 index 000000000..4d6e1e4cb --- /dev/null +++ b/src/agentex/_utils/_path.py @@ -0,0 +1,127 @@ +from __future__ import annotations + +import re +from typing import ( + Any, + Mapping, + Callable, +) +from urllib.parse import quote + +# Matches '.' or '..' where each dot is either literal or percent-encoded (%2e / %2E). +_DOT_SEGMENT_RE = re.compile(r"^(?:\.|%2[eE]){1,2}$") + +_PLACEHOLDER_RE = re.compile(r"\{(\w+)\}") + + +def _quote_path_segment_part(value: str) -> str: + """Percent-encode `value` for use in a URI path segment. + + Considers characters not in `pchar` set from RFC 3986 §3.3 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 + """ + # quote() already treats unreserved characters (letters, digits, and -._~) + # as safe, so we only need to add sub-delims, ':', and '@'. + # Notably, unlike the default `safe` for quote(), / is unsafe and must be quoted. + return quote(value, safe="!$&'()*+,;=:@") + + +def _quote_query_part(value: str) -> str: + """Percent-encode `value` for use in a URI query string. + + Considers &, = and characters not in `query` set from RFC 3986 §3.4 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 + """ + return quote(value, safe="!$'()*+,;:@/?") + + +def _quote_fragment_part(value: str) -> str: + """Percent-encode `value` for use in a URI fragment. + + Considers characters not in `fragment` set from RFC 3986 §3.5 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.5 + """ + return quote(value, safe="!$&'()*+,;=:@/?") + + +def _interpolate( + template: str, + values: Mapping[str, Any], + quoter: Callable[[str], str], +) -> str: + """Replace {name} placeholders in `template`, quoting each value with `quoter`. + + Placeholder names are looked up in `values`. + + Raises: + KeyError: If a placeholder is not found in `values`. + """ + # re.split with a capturing group returns alternating + # [text, name, text, name, ..., text] elements. + parts = _PLACEHOLDER_RE.split(template) + + for i in range(1, len(parts), 2): + name = parts[i] + if name not in values: + raise KeyError(f"a value for placeholder {{{name}}} was not provided") + val = values[name] + if val is None: + parts[i] = "null" + elif isinstance(val, bool): + parts[i] = "true" if val else "false" + else: + parts[i] = quoter(str(values[name])) + + return "".join(parts) + + +def path_template(template: str, /, **kwargs: Any) -> str: + """Interpolate {name} placeholders in `template` from keyword arguments. + + Args: + template: The template string containing {name} placeholders. + **kwargs: Keyword arguments to interpolate into the template. + + Returns: + The template with placeholders interpolated and percent-encoded. + + Safe characters for percent-encoding are dependent on the URI component. + Placeholders in path and fragment portions are percent-encoded where the `segment` + and `fragment` sets from RFC 3986 respectively are considered safe. + Placeholders in the query portion are percent-encoded where the `query` set from + RFC 3986 §3.3 is considered safe except for = and & characters. + + Raises: + KeyError: If a placeholder is not found in `kwargs`. + ValueError: If resulting path contains /./ or /../ segments (including percent-encoded dot-segments). + """ + # Split the template into path, query, and fragment portions. + fragment_template: str | None = None + query_template: str | None = None + + rest = template + if "#" in rest: + rest, fragment_template = rest.split("#", 1) + if "?" in rest: + rest, query_template = rest.split("?", 1) + path_template = rest + + # Interpolate each portion with the appropriate quoting rules. + path_result = _interpolate(path_template, kwargs, _quote_path_segment_part) + + # Reject dot-segments (. and ..) in the final assembled path. The check + # runs after interpolation so that adjacent placeholders or a mix of static + # text and placeholders that together form a dot-segment are caught. + # Also reject percent-encoded dot-segments to protect against incorrectly + # implemented normalization in servers/proxies. + for segment in path_result.split("/"): + if _DOT_SEGMENT_RE.match(segment): + raise ValueError(f"Constructed path {path_result!r} contains dot-segment {segment!r} which is not allowed") + + result = path_result + if query_template is not None: + result += "?" + _interpolate(query_template, kwargs, _quote_query_part) + if fragment_template is not None: + result += "#" + _interpolate(fragment_template, kwargs, _quote_fragment_part) + + return result diff --git a/src/agentex/_version.py b/src/agentex/_version.py index 3c4a3a3a0..f3bb1cd71 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.9.5" # x-release-please-version +__version__ = "0.9.6" # x-release-please-version diff --git a/src/agentex/resources/agents.py b/src/agentex/resources/agents.py index ae6821e76..e6da458b9 100644 --- a/src/agentex/resources/agents.py +++ b/src/agentex/resources/agents.py @@ -11,7 +11,7 @@ from ..types import agent_rpc_params, agent_list_params, agent_rpc_by_name_params from .._types import NOT_GIVEN, Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -82,7 +82,7 @@ def retrieve( if not agent_id: raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") return self._get( - f"/agents/{agent_id}", + path_template("/agents/{agent_id}", agent_id=agent_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -173,7 +173,7 @@ def delete( if not agent_id: raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") return self._delete( - f"/agents/{agent_id}", + path_template("/agents/{agent_id}", agent_id=agent_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -206,7 +206,7 @@ def delete_by_name( if not agent_name: raise ValueError(f"Expected a non-empty value for `agent_name` but received {agent_name!r}") return self._delete( - f"/agents/name/{agent_name}", + path_template("/agents/name/{agent_name}", agent_name=agent_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -239,7 +239,7 @@ def retrieve_by_name( if not agent_name: raise ValueError(f"Expected a non-empty value for `agent_name` but received {agent_name!r}") return self._get( - f"/agents/name/{agent_name}", + path_template("/agents/name/{agent_name}", agent_name=agent_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -278,7 +278,7 @@ def rpc( if not agent_id: raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") return self._post( - f"/agents/{agent_id}/rpc", + path_template("/agents/{agent_id}/rpc", agent_id=agent_id), body=maybe_transform( { "method": method, @@ -326,7 +326,7 @@ def rpc_by_name( if not agent_name: raise ValueError(f"Expected a non-empty value for `agent_name` but received {agent_name!r}") return self._post( - f"/agents/name/{agent_name}/rpc", + path_template("/agents/name/{agent_name}/rpc", agent_name=agent_name), body=maybe_transform( { "method": method, @@ -650,7 +650,7 @@ async def retrieve( if not agent_id: raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") return await self._get( - f"/agents/{agent_id}", + path_template("/agents/{agent_id}", agent_id=agent_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -741,7 +741,7 @@ async def delete( if not agent_id: raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") return await self._delete( - f"/agents/{agent_id}", + path_template("/agents/{agent_id}", agent_id=agent_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -774,7 +774,7 @@ async def delete_by_name( if not agent_name: raise ValueError(f"Expected a non-empty value for `agent_name` but received {agent_name!r}") return await self._delete( - f"/agents/name/{agent_name}", + path_template("/agents/name/{agent_name}", agent_name=agent_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -807,7 +807,7 @@ async def retrieve_by_name( if not agent_name: raise ValueError(f"Expected a non-empty value for `agent_name` but received {agent_name!r}") return await self._get( - f"/agents/name/{agent_name}", + path_template("/agents/name/{agent_name}", agent_name=agent_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -846,7 +846,7 @@ async def rpc( if not agent_id: raise ValueError(f"Expected a non-empty value for `agent_id` but received {agent_id!r}") return await self._post( - f"/agents/{agent_id}/rpc", + path_template("/agents/{agent_id}/rpc", agent_id=agent_id), body=await async_maybe_transform( { "method": method, @@ -894,7 +894,7 @@ async def rpc_by_name( if not agent_name: raise ValueError(f"Expected a non-empty value for `agent_name` but received {agent_name!r}") return await self._post( - f"/agents/name/{agent_name}/rpc", + path_template("/agents/name/{agent_name}/rpc", agent_name=agent_name), body=await async_maybe_transform( { "method": method, diff --git a/src/agentex/resources/deployment_history.py b/src/agentex/resources/deployment_history.py index 4f3638cfa..9149ffff8 100644 --- a/src/agentex/resources/deployment_history.py +++ b/src/agentex/resources/deployment_history.py @@ -8,7 +8,7 @@ from ..types import deployment_history_list_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -70,7 +70,7 @@ def retrieve( if not deployment_id: raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}") return self._get( - f"/deployment-history/{deployment_id}", + path_template("/deployment-history/{deployment_id}", deployment_id=deployment_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -83,6 +83,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, # 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. @@ -115,6 +117,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, }, deployment_history_list_params.DeploymentHistoryListParams, @@ -170,7 +174,7 @@ async def retrieve( if not deployment_id: raise ValueError(f"Expected a non-empty value for `deployment_id` but received {deployment_id!r}") return await self._get( - f"/deployment-history/{deployment_id}", + path_template("/deployment-history/{deployment_id}", deployment_id=deployment_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -183,6 +187,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, # 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. @@ -215,6 +221,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, }, deployment_history_list_params.DeploymentHistoryListParams, diff --git a/src/agentex/resources/events.py b/src/agentex/resources/events.py index 64ac63268..b0111abb4 100644 --- a/src/agentex/resources/events.py +++ b/src/agentex/resources/events.py @@ -8,7 +8,7 @@ from ..types import event_list_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -70,7 +70,7 @@ def retrieve( if not event_id: raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") return self._get( - f"/events/{event_id}", + path_template("/events/{event_id}", event_id=event_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -181,7 +181,7 @@ async def retrieve( if not event_id: raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") return await self._get( - f"/events/{event_id}", + path_template("/events/{event_id}", event_id=event_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/agentex/resources/messages/messages.py b/src/agentex/resources/messages/messages.py index c047c9c23..667ef41ca 100644 --- a/src/agentex/resources/messages/messages.py +++ b/src/agentex/resources/messages/messages.py @@ -22,7 +22,7 @@ message_list_paginated_params, ) from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from ..._utils import maybe_transform, async_maybe_transform +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -131,7 +131,7 @@ def retrieve( if not message_id: raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}") return self._get( - f"/messages/{message_id}", + path_template("/messages/{message_id}", message_id=message_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -167,7 +167,7 @@ def update( if not message_id: raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}") return self._put( - f"/messages/{message_id}", + path_template("/messages/{message_id}", message_id=message_id), body=maybe_transform( { "content": content, @@ -1395,7 +1395,7 @@ async def retrieve( if not message_id: raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}") return await self._get( - f"/messages/{message_id}", + path_template("/messages/{message_id}", message_id=message_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1431,7 +1431,7 @@ async def update( if not message_id: raise ValueError(f"Expected a non-empty value for `message_id` but received {message_id!r}") return await self._put( - f"/messages/{message_id}", + path_template("/messages/{message_id}", message_id=message_id), body=await async_maybe_transform( { "content": content, diff --git a/src/agentex/resources/spans.py b/src/agentex/resources/spans.py index 589c2ac6b..f8d97e0de 100644 --- a/src/agentex/resources/spans.py +++ b/src/agentex/resources/spans.py @@ -9,7 +9,7 @@ from ..types import span_list_params, span_create_params, span_update_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -142,7 +142,7 @@ def retrieve( if not span_id: raise ValueError(f"Expected a non-empty value for `span_id` but received {span_id!r}") return self._get( - f"/spans/{span_id}", + path_template("/spans/{span_id}", span_id=span_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -199,7 +199,7 @@ def update( if not span_id: raise ValueError(f"Expected a non-empty value for `span_id` but received {span_id!r}") return self._patch( - f"/spans/{span_id}", + path_template("/spans/{span_id}", span_id=span_id), body=maybe_transform( { "data": data, @@ -385,7 +385,7 @@ async def retrieve( if not span_id: raise ValueError(f"Expected a non-empty value for `span_id` but received {span_id!r}") return await self._get( - f"/spans/{span_id}", + path_template("/spans/{span_id}", span_id=span_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -442,7 +442,7 @@ async def update( if not span_id: raise ValueError(f"Expected a non-empty value for `span_id` but received {span_id!r}") return await self._patch( - f"/spans/{span_id}", + path_template("/spans/{span_id}", span_id=span_id), body=await async_maybe_transform( { "data": data, diff --git a/src/agentex/resources/states.py b/src/agentex/resources/states.py index a8f3d0854..d8cfa1ad8 100644 --- a/src/agentex/resources/states.py +++ b/src/agentex/resources/states.py @@ -8,7 +8,7 @@ from ..types import state_list_params, state_create_params, state_update_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -111,7 +111,7 @@ def retrieve( if not state_id: raise ValueError(f"Expected a non-empty value for `state_id` but received {state_id!r}") return self._get( - f"/states/{state_id}", + path_template("/states/{state_id}", state_id=state_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -147,7 +147,7 @@ def update( if not state_id: raise ValueError(f"Expected a non-empty value for `state_id` but received {state_id!r}") return self._put( - f"/states/{state_id}", + path_template("/states/{state_id}", state_id=state_id), body=maybe_transform( { "agent_id": agent_id, @@ -250,7 +250,7 @@ def delete( if not state_id: raise ValueError(f"Expected a non-empty value for `state_id` but received {state_id!r}") return self._delete( - f"/states/{state_id}", + path_template("/states/{state_id}", state_id=state_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -345,7 +345,7 @@ async def retrieve( if not state_id: raise ValueError(f"Expected a non-empty value for `state_id` but received {state_id!r}") return await self._get( - f"/states/{state_id}", + path_template("/states/{state_id}", state_id=state_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -381,7 +381,7 @@ async def update( if not state_id: raise ValueError(f"Expected a non-empty value for `state_id` but received {state_id!r}") return await self._put( - f"/states/{state_id}", + path_template("/states/{state_id}", state_id=state_id), body=await async_maybe_transform( { "agent_id": agent_id, @@ -484,7 +484,7 @@ async def delete( if not state_id: raise ValueError(f"Expected a non-empty value for `state_id` but received {state_id!r}") return await self._delete( - f"/states/{state_id}", + path_template("/states/{state_id}", state_id=state_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/agentex/resources/tasks.py b/src/agentex/resources/tasks.py index 1bf41b7b5..d1e33f3a5 100644 --- a/src/agentex/resources/tasks.py +++ b/src/agentex/resources/tasks.py @@ -2,14 +2,25 @@ from __future__ import annotations -from typing import List, Optional +from typing import Dict, List, Optional from typing_extensions import Literal import httpx -from ..types import task_list_params, task_retrieve_params, task_retrieve_by_name_params +from ..types import ( + task_fail_params, + task_list_params, + task_cancel_params, + task_timeout_params, + task_complete_params, + task_retrieve_params, + task_terminate_params, + task_update_by_id_params, + task_update_by_name_params, + task_retrieve_by_name_params, +) from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -19,10 +30,12 @@ async_to_streamed_response_wrapper, ) from .._streaming import Stream, AsyncStream +from ..types.task import Task from .._base_client import make_request_options from ..types.task_list_response import TaskListResponse from ..types.shared.delete_response import DeleteResponse from ..types.task_retrieve_response import TaskRetrieveResponse +from ..types.task_query_workflow_response import TaskQueryWorkflowResponse from ..types.task_retrieve_by_name_response import TaskRetrieveByNameResponse __all__ = ["TasksResource", "AsyncTasksResource"] @@ -75,7 +88,7 @@ def retrieve( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/tasks/{task_id}", + path_template("/tasks/{task_id}", task_id=task_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -164,13 +177,83 @@ def delete( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._delete( - f"/tasks/{task_id}", + path_template("/tasks/{task_id}", task_id=task_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=DeleteResponse, ) + def cancel( + self, + task_id: str, + *, + reason: Optional[str] | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Task: + """ + Mark a running task as canceled. + + 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 + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return self._post( + path_template("/tasks/{task_id}/cancel", task_id=task_id), + body=maybe_transform({"reason": reason}, task_cancel_params.TaskCancelParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + + def complete( + self, + task_id: str, + *, + reason: Optional[str] | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Task: + """ + Mark a running task as completed. + + 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 + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return self._post( + path_template("/tasks/{task_id}/complete", task_id=task_id), + body=maybe_transform({"reason": reason}, task_complete_params.TaskCompleteParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + def delete_by_name( self, task_name: str, @@ -197,13 +280,84 @@ def delete_by_name( if not task_name: raise ValueError(f"Expected a non-empty value for `task_name` but received {task_name!r}") return self._delete( - f"/tasks/name/{task_name}", + path_template("/tasks/name/{task_name}", task_name=task_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=DeleteResponse, ) + def fail( + self, + task_id: str, + *, + reason: Optional[str] | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Task: + """ + Mark a running task as failed. + + 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 + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return self._post( + path_template("/tasks/{task_id}/fail", task_id=task_id), + body=maybe_transform({"reason": reason}, task_fail_params.TaskFailParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + + def query_workflow( + self, + query_name: str, + *, + task_id: str, + # 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, + ) -> TaskQueryWorkflowResponse: + """ + Query a Temporal workflow associated with a task for its current state. + + 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 + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + if not query_name: + raise ValueError(f"Expected a non-empty value for `query_name` but received {query_name!r}") + return self._get( + path_template("/tasks/{task_id}/query/{query_name}", task_id=task_id, query_name=query_name), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskQueryWorkflowResponse, + ) + def retrieve_by_name( self, task_name: str, @@ -231,7 +385,7 @@ def retrieve_by_name( if not task_name: raise ValueError(f"Expected a non-empty value for `task_name` but received {task_name!r}") return self._get( - f"/tasks/name/{task_name}", + path_template("/tasks/name/{task_name}", task_name=task_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -270,7 +424,7 @@ def stream_events( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return self._get( - f"/tasks/{task_id}/stream", + path_template("/tasks/{task_id}/stream", task_id=task_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -305,7 +459,7 @@ def stream_events_by_name( if not task_name: raise ValueError(f"Expected a non-empty value for `task_name` but received {task_name!r}") return self._get( - f"/tasks/name/{task_name}/stream", + path_template("/tasks/name/{task_name}/stream", task_name=task_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -314,6 +468,146 @@ def stream_events_by_name( stream_cls=Stream[object], ) + def terminate( + self, + task_id: str, + *, + reason: Optional[str] | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Task: + """ + Mark a running task as terminated. + + 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 + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return self._post( + path_template("/tasks/{task_id}/terminate", task_id=task_id), + body=maybe_transform({"reason": reason}, task_terminate_params.TaskTerminateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + + def timeout( + self, + task_id: str, + *, + reason: Optional[str] | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Task: + """ + Mark a running task as timed out. + + 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 + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return self._post( + path_template("/tasks/{task_id}/timeout", task_id=task_id), + body=maybe_transform({"reason": reason}, task_timeout_params.TaskTimeoutParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + + def update_by_id( + self, + task_id: str, + *, + task_metadata: Optional[Dict[str, object]] | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Task: + """ + Update mutable fields for a task by its unique ID. + + 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 + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return self._put( + path_template("/tasks/{task_id}", task_id=task_id), + body=maybe_transform({"task_metadata": task_metadata}, task_update_by_id_params.TaskUpdateByIDParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + + def update_by_name( + self, + task_name: str, + *, + task_metadata: Optional[Dict[str, object]] | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Task: + """ + Update mutable fields for a task by its unique Name. + + 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 + """ + if not task_name: + raise ValueError(f"Expected a non-empty value for `task_name` but received {task_name!r}") + return self._put( + path_template("/tasks/name/{task_name}", task_name=task_name), + body=maybe_transform({"task_metadata": task_metadata}, task_update_by_name_params.TaskUpdateByNameParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + class AsyncTasksResource(AsyncAPIResource): @cached_property @@ -362,7 +656,7 @@ async def retrieve( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/tasks/{task_id}", + path_template("/tasks/{task_id}", task_id=task_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -453,13 +747,83 @@ async def delete( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._delete( - f"/tasks/{task_id}", + path_template("/tasks/{task_id}", task_id=task_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=DeleteResponse, ) + async def cancel( + self, + task_id: str, + *, + reason: Optional[str] | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Task: + """ + Mark a running task as canceled. + + 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 + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return await self._post( + path_template("/tasks/{task_id}/cancel", task_id=task_id), + body=await async_maybe_transform({"reason": reason}, task_cancel_params.TaskCancelParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + + async def complete( + self, + task_id: str, + *, + reason: Optional[str] | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Task: + """ + Mark a running task as completed. + + 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 + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return await self._post( + path_template("/tasks/{task_id}/complete", task_id=task_id), + body=await async_maybe_transform({"reason": reason}, task_complete_params.TaskCompleteParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + async def delete_by_name( self, task_name: str, @@ -486,13 +850,84 @@ async def delete_by_name( if not task_name: raise ValueError(f"Expected a non-empty value for `task_name` but received {task_name!r}") return await self._delete( - f"/tasks/name/{task_name}", + path_template("/tasks/name/{task_name}", task_name=task_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=DeleteResponse, ) + async def fail( + self, + task_id: str, + *, + reason: Optional[str] | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Task: + """ + Mark a running task as failed. + + 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 + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return await self._post( + path_template("/tasks/{task_id}/fail", task_id=task_id), + body=await async_maybe_transform({"reason": reason}, task_fail_params.TaskFailParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + + async def query_workflow( + self, + query_name: str, + *, + task_id: str, + # 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, + ) -> TaskQueryWorkflowResponse: + """ + Query a Temporal workflow associated with a task for its current state. + + 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 + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + if not query_name: + raise ValueError(f"Expected a non-empty value for `query_name` but received {query_name!r}") + return await self._get( + path_template("/tasks/{task_id}/query/{query_name}", task_id=task_id, query_name=query_name), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=TaskQueryWorkflowResponse, + ) + async def retrieve_by_name( self, task_name: str, @@ -520,7 +955,7 @@ async def retrieve_by_name( if not task_name: raise ValueError(f"Expected a non-empty value for `task_name` but received {task_name!r}") return await self._get( - f"/tasks/name/{task_name}", + path_template("/tasks/name/{task_name}", task_name=task_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -559,7 +994,7 @@ async def stream_events( if not task_id: raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") return await self._get( - f"/tasks/{task_id}/stream", + path_template("/tasks/{task_id}/stream", task_id=task_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -594,7 +1029,7 @@ async def stream_events_by_name( if not task_name: raise ValueError(f"Expected a non-empty value for `task_name` but received {task_name!r}") return await self._get( - f"/tasks/name/{task_name}/stream", + path_template("/tasks/name/{task_name}/stream", task_name=task_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -603,6 +1038,150 @@ async def stream_events_by_name( stream_cls=AsyncStream[object], ) + async def terminate( + self, + task_id: str, + *, + reason: Optional[str] | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Task: + """ + Mark a running task as terminated. + + 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 + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return await self._post( + path_template("/tasks/{task_id}/terminate", task_id=task_id), + body=await async_maybe_transform({"reason": reason}, task_terminate_params.TaskTerminateParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + + async def timeout( + self, + task_id: str, + *, + reason: Optional[str] | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Task: + """ + Mark a running task as timed out. + + 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 + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return await self._post( + path_template("/tasks/{task_id}/timeout", task_id=task_id), + body=await async_maybe_transform({"reason": reason}, task_timeout_params.TaskTimeoutParams), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + + async def update_by_id( + self, + task_id: str, + *, + task_metadata: Optional[Dict[str, object]] | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Task: + """ + Update mutable fields for a task by its unique ID. + + 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 + """ + if not task_id: + raise ValueError(f"Expected a non-empty value for `task_id` but received {task_id!r}") + return await self._put( + path_template("/tasks/{task_id}", task_id=task_id), + body=await async_maybe_transform( + {"task_metadata": task_metadata}, task_update_by_id_params.TaskUpdateByIDParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + + async def update_by_name( + self, + task_name: str, + *, + task_metadata: Optional[Dict[str, object]] | 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. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Task: + """ + Update mutable fields for a task by its unique Name. + + 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 + """ + if not task_name: + raise ValueError(f"Expected a non-empty value for `task_name` but received {task_name!r}") + return await self._put( + path_template("/tasks/name/{task_name}", task_name=task_name), + body=await async_maybe_transform( + {"task_metadata": task_metadata}, task_update_by_name_params.TaskUpdateByNameParams + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Task, + ) + class TasksResourceWithRawResponse: def __init__(self, tasks: TasksResource) -> None: @@ -617,9 +1196,21 @@ def __init__(self, tasks: TasksResource) -> None: self.delete = to_raw_response_wrapper( tasks.delete, ) + self.cancel = to_raw_response_wrapper( + tasks.cancel, + ) + self.complete = to_raw_response_wrapper( + tasks.complete, + ) self.delete_by_name = to_raw_response_wrapper( tasks.delete_by_name, ) + self.fail = to_raw_response_wrapper( + tasks.fail, + ) + self.query_workflow = to_raw_response_wrapper( + tasks.query_workflow, + ) self.retrieve_by_name = to_raw_response_wrapper( tasks.retrieve_by_name, ) @@ -629,6 +1220,18 @@ def __init__(self, tasks: TasksResource) -> None: self.stream_events_by_name = to_raw_response_wrapper( tasks.stream_events_by_name, ) + self.terminate = to_raw_response_wrapper( + tasks.terminate, + ) + self.timeout = to_raw_response_wrapper( + tasks.timeout, + ) + self.update_by_id = to_raw_response_wrapper( + tasks.update_by_id, + ) + self.update_by_name = to_raw_response_wrapper( + tasks.update_by_name, + ) class AsyncTasksResourceWithRawResponse: @@ -644,9 +1247,21 @@ def __init__(self, tasks: AsyncTasksResource) -> None: self.delete = async_to_raw_response_wrapper( tasks.delete, ) + self.cancel = async_to_raw_response_wrapper( + tasks.cancel, + ) + self.complete = async_to_raw_response_wrapper( + tasks.complete, + ) self.delete_by_name = async_to_raw_response_wrapper( tasks.delete_by_name, ) + self.fail = async_to_raw_response_wrapper( + tasks.fail, + ) + self.query_workflow = async_to_raw_response_wrapper( + tasks.query_workflow, + ) self.retrieve_by_name = async_to_raw_response_wrapper( tasks.retrieve_by_name, ) @@ -656,6 +1271,18 @@ def __init__(self, tasks: AsyncTasksResource) -> None: self.stream_events_by_name = async_to_raw_response_wrapper( tasks.stream_events_by_name, ) + self.terminate = async_to_raw_response_wrapper( + tasks.terminate, + ) + self.timeout = async_to_raw_response_wrapper( + tasks.timeout, + ) + self.update_by_id = async_to_raw_response_wrapper( + tasks.update_by_id, + ) + self.update_by_name = async_to_raw_response_wrapper( + tasks.update_by_name, + ) class TasksResourceWithStreamingResponse: @@ -671,9 +1298,21 @@ def __init__(self, tasks: TasksResource) -> None: self.delete = to_streamed_response_wrapper( tasks.delete, ) + self.cancel = to_streamed_response_wrapper( + tasks.cancel, + ) + self.complete = to_streamed_response_wrapper( + tasks.complete, + ) self.delete_by_name = to_streamed_response_wrapper( tasks.delete_by_name, ) + self.fail = to_streamed_response_wrapper( + tasks.fail, + ) + self.query_workflow = to_streamed_response_wrapper( + tasks.query_workflow, + ) self.retrieve_by_name = to_streamed_response_wrapper( tasks.retrieve_by_name, ) @@ -683,6 +1322,18 @@ def __init__(self, tasks: TasksResource) -> None: self.stream_events_by_name = to_streamed_response_wrapper( tasks.stream_events_by_name, ) + self.terminate = to_streamed_response_wrapper( + tasks.terminate, + ) + self.timeout = to_streamed_response_wrapper( + tasks.timeout, + ) + self.update_by_id = to_streamed_response_wrapper( + tasks.update_by_id, + ) + self.update_by_name = to_streamed_response_wrapper( + tasks.update_by_name, + ) class AsyncTasksResourceWithStreamingResponse: @@ -698,9 +1349,21 @@ def __init__(self, tasks: AsyncTasksResource) -> None: self.delete = async_to_streamed_response_wrapper( tasks.delete, ) + self.cancel = async_to_streamed_response_wrapper( + tasks.cancel, + ) + self.complete = async_to_streamed_response_wrapper( + tasks.complete, + ) self.delete_by_name = async_to_streamed_response_wrapper( tasks.delete_by_name, ) + self.fail = async_to_streamed_response_wrapper( + tasks.fail, + ) + self.query_workflow = async_to_streamed_response_wrapper( + tasks.query_workflow, + ) self.retrieve_by_name = async_to_streamed_response_wrapper( tasks.retrieve_by_name, ) @@ -710,3 +1373,15 @@ def __init__(self, tasks: AsyncTasksResource) -> None: self.stream_events_by_name = async_to_streamed_response_wrapper( tasks.stream_events_by_name, ) + self.terminate = async_to_streamed_response_wrapper( + tasks.terminate, + ) + self.timeout = async_to_streamed_response_wrapper( + tasks.timeout, + ) + self.update_by_id = async_to_streamed_response_wrapper( + tasks.update_by_id, + ) + self.update_by_name = async_to_streamed_response_wrapper( + tasks.update_by_name, + ) diff --git a/src/agentex/resources/tracker.py b/src/agentex/resources/tracker.py index 15906b3f0..14de3fc49 100644 --- a/src/agentex/resources/tracker.py +++ b/src/agentex/resources/tracker.py @@ -8,7 +8,7 @@ from ..types import tracker_list_params, tracker_update_params from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given -from .._utils import maybe_transform, async_maybe_transform +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource from .._response import ( @@ -70,7 +70,7 @@ def retrieve( if not tracker_id: raise ValueError(f"Expected a non-empty value for `tracker_id` but received {tracker_id!r}") return self._get( - f"/tracker/{tracker_id}", + path_template("/tracker/{tracker_id}", tracker_id=tracker_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -112,7 +112,7 @@ def update( if not tracker_id: raise ValueError(f"Expected a non-empty value for `tracker_id` but received {tracker_id!r}") return self._put( - f"/tracker/{tracker_id}", + path_template("/tracker/{tracker_id}", tracker_id=tracker_id), body=maybe_transform( { "last_processed_event_id": last_processed_event_id, @@ -236,7 +236,7 @@ async def retrieve( if not tracker_id: raise ValueError(f"Expected a non-empty value for `tracker_id` but received {tracker_id!r}") return await self._get( - f"/tracker/{tracker_id}", + path_template("/tracker/{tracker_id}", tracker_id=tracker_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -278,7 +278,7 @@ async def update( if not tracker_id: raise ValueError(f"Expected a non-empty value for `tracker_id` but received {tracker_id!r}") return await self._put( - f"/tracker/{tracker_id}", + path_template("/tracker/{tracker_id}", tracker_id=tracker_id), body=await async_maybe_transform( { "last_processed_event_id": last_processed_event_id, diff --git a/src/agentex/types/__init__.py b/src/agentex/types/__init__.py index 140acd92f..5125c00b0 100644 --- a/src/agentex/types/__init__.py +++ b/src/agentex/types/__init__.py @@ -20,6 +20,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_fail_params import TaskFailParams as TaskFailParams from .task_list_params import TaskListParams as TaskListParams from .agent_list_params import AgentListParams as AgentListParams from .event_list_params import EventListParams as EventListParams @@ -32,6 +33,7 @@ from .span_create_params import SpanCreateParams as SpanCreateParams from .span_list_response import SpanListResponse as SpanListResponse from .span_update_params import SpanUpdateParams as SpanUpdateParams +from .task_cancel_params import TaskCancelParams as TaskCancelParams from .task_list_response import TaskListResponse as TaskListResponse from .task_message_delta import TaskMessageDelta as TaskMessageDelta from .text_content_param import TextContentParam as TextContentParam @@ -43,14 +45,17 @@ from .state_list_response import StateListResponse as StateListResponse from .state_update_params import StateUpdateParams as StateUpdateParams from .task_message_update import TaskMessageUpdate as TaskMessageUpdate +from .task_timeout_params import TaskTimeoutParams as TaskTimeoutParams from .tool_response_delta import ToolResponseDelta as ToolResponseDelta from .tracker_list_params import TrackerListParams as TrackerListParams +from .task_complete_params import TaskCompleteParams as TaskCompleteParams from .task_message_content import TaskMessageContent as TaskMessageContent from .task_retrieve_params import TaskRetrieveParams as TaskRetrieveParams from .tool_request_content import ToolRequestContent as ToolRequestContent from .message_create_params import MessageCreateParams as MessageCreateParams from .message_list_response import MessageListResponse as MessageListResponse from .message_update_params import MessageUpdateParams as MessageUpdateParams +from .task_terminate_params import TaskTerminateParams as TaskTerminateParams from .tool_response_content import ToolResponseContent as ToolResponseContent from .tracker_list_response import TrackerListResponse as TrackerListResponse from .tracker_update_params import TrackerUpdateParams as TrackerUpdateParams @@ -59,9 +64,12 @@ from .reasoning_content_param import ReasoningContentParam as ReasoningContentParam from .reasoning_summary_delta import ReasoningSummaryDelta as ReasoningSummaryDelta from .agent_rpc_by_name_params import AgentRpcByNameParams as AgentRpcByNameParams +from .task_update_by_id_params import TaskUpdateByIDParams as TaskUpdateByIDParams from .task_message_content_param import TaskMessageContentParam as TaskMessageContentParam +from .task_update_by_name_params import TaskUpdateByNameParams as TaskUpdateByNameParams from .tool_request_content_param import ToolRequestContentParam as ToolRequestContentParam from .tool_response_content_param import ToolResponseContentParam as ToolResponseContentParam +from .task_query_workflow_response import TaskQueryWorkflowResponse as TaskQueryWorkflowResponse from .task_retrieve_by_name_params import TaskRetrieveByNameParams as TaskRetrieveByNameParams from .message_list_paginated_params import MessageListPaginatedParams as MessageListPaginatedParams from .deployment_history_list_params import DeploymentHistoryListParams as DeploymentHistoryListParams diff --git a/src/agentex/types/deployment_history.py b/src/agentex/types/deployment_history.py index f9e3ce518..63a25e8e2 100644 --- a/src/agentex/types/deployment_history.py +++ b/src/agentex/types/deployment_history.py @@ -8,6 +8,8 @@ class DeploymentHistory(BaseModel): + """API schema for deployment history.""" + id: str """The unique identifier of the deployment record""" diff --git a/src/agentex/types/deployment_history_list_params.py b/src/agentex/types/deployment_history_list_params.py index b26b2462d..d77ed5d17 100644 --- a/src/agentex/types/deployment_history_list_params.py +++ b/src/agentex/types/deployment_history_list_params.py @@ -15,4 +15,8 @@ class DeploymentHistoryListParams(TypedDict, total=False): limit: int + order_by: Optional[str] + + order_direction: str + page_number: int diff --git a/src/agentex/types/task_cancel_params.py b/src/agentex/types/task_cancel_params.py new file mode 100644 index 000000000..c76e97aa9 --- /dev/null +++ b/src/agentex/types/task_cancel_params.py @@ -0,0 +1,12 @@ +# 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__ = ["TaskCancelParams"] + + +class TaskCancelParams(TypedDict, total=False): + reason: Optional[str] diff --git a/src/agentex/types/task_complete_params.py b/src/agentex/types/task_complete_params.py new file mode 100644 index 000000000..7e523041a --- /dev/null +++ b/src/agentex/types/task_complete_params.py @@ -0,0 +1,12 @@ +# 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__ = ["TaskCompleteParams"] + + +class TaskCompleteParams(TypedDict, total=False): + reason: Optional[str] diff --git a/src/agentex/types/task_fail_params.py b/src/agentex/types/task_fail_params.py new file mode 100644 index 000000000..ba32ad5fd --- /dev/null +++ b/src/agentex/types/task_fail_params.py @@ -0,0 +1,12 @@ +# 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__ = ["TaskFailParams"] + + +class TaskFailParams(TypedDict, total=False): + reason: Optional[str] diff --git a/src/agentex/types/task_query_workflow_response.py b/src/agentex/types/task_query_workflow_response.py new file mode 100644 index 000000000..3f8ae2c69 --- /dev/null +++ b/src/agentex/types/task_query_workflow_response.py @@ -0,0 +1,8 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict +from typing_extensions import TypeAlias + +__all__ = ["TaskQueryWorkflowResponse"] + +TaskQueryWorkflowResponse: TypeAlias = Dict[str, object] diff --git a/src/agentex/types/task_terminate_params.py b/src/agentex/types/task_terminate_params.py new file mode 100644 index 000000000..869e3d45c --- /dev/null +++ b/src/agentex/types/task_terminate_params.py @@ -0,0 +1,12 @@ +# 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__ = ["TaskTerminateParams"] + + +class TaskTerminateParams(TypedDict, total=False): + reason: Optional[str] diff --git a/src/agentex/types/task_timeout_params.py b/src/agentex/types/task_timeout_params.py new file mode 100644 index 000000000..03d5fa75c --- /dev/null +++ b/src/agentex/types/task_timeout_params.py @@ -0,0 +1,12 @@ +# 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__ = ["TaskTimeoutParams"] + + +class TaskTimeoutParams(TypedDict, total=False): + reason: Optional[str] diff --git a/src/agentex/types/task_update_by_id_params.py b/src/agentex/types/task_update_by_id_params.py new file mode 100644 index 000000000..8b0f04f11 --- /dev/null +++ b/src/agentex/types/task_update_by_id_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import TypedDict + +__all__ = ["TaskUpdateByIDParams"] + + +class TaskUpdateByIDParams(TypedDict, total=False): + task_metadata: Optional[Dict[str, object]] diff --git a/src/agentex/types/task_update_by_name_params.py b/src/agentex/types/task_update_by_name_params.py new file mode 100644 index 000000000..07d48df9b --- /dev/null +++ b/src/agentex/types/task_update_by_name_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, Optional +from typing_extensions import TypedDict + +__all__ = ["TaskUpdateByNameParams"] + + +class TaskUpdateByNameParams(TypedDict, total=False): + task_metadata: Optional[Dict[str, object]] diff --git a/tests/api_resources/messages/test_batch.py b/tests/api_resources/messages/test_batch.py index da404855f..5b7e981bf 100644 --- a/tests/api_resources/messages/test_batch.py +++ b/tests/api_resources/messages/test_batch.py @@ -18,7 +18,7 @@ class TestBatch: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_create(self, client: Agentex) -> None: batch = client.messages.batch.create( @@ -33,7 +33,7 @@ def test_method_create(self, client: Agentex) -> None: ) assert_matches_type(BatchCreateResponse, batch, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_create(self, client: Agentex) -> None: response = client.messages.batch.with_raw_response.create( @@ -52,7 +52,7 @@ def test_raw_response_create(self, client: Agentex) -> None: batch = response.parse() assert_matches_type(BatchCreateResponse, batch, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_create(self, client: Agentex) -> None: with client.messages.batch.with_streaming_response.create( @@ -73,7 +73,7 @@ def test_streaming_response_create(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_update(self, client: Agentex) -> None: batch = client.messages.batch.update( @@ -88,7 +88,7 @@ def test_method_update(self, client: Agentex) -> None: ) assert_matches_type(BatchUpdateResponse, batch, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_update(self, client: Agentex) -> None: response = client.messages.batch.with_raw_response.update( @@ -107,7 +107,7 @@ def test_raw_response_update(self, client: Agentex) -> None: batch = response.parse() assert_matches_type(BatchUpdateResponse, batch, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_update(self, client: Agentex) -> None: with client.messages.batch.with_streaming_response.update( @@ -134,7 +134,7 @@ class TestAsyncBatch: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_create(self, async_client: AsyncAgentex) -> None: batch = await async_client.messages.batch.create( @@ -149,7 +149,7 @@ async def test_method_create(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(BatchCreateResponse, batch, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_create(self, async_client: AsyncAgentex) -> None: response = await async_client.messages.batch.with_raw_response.create( @@ -168,7 +168,7 @@ async def test_raw_response_create(self, async_client: AsyncAgentex) -> None: batch = await response.parse() assert_matches_type(BatchCreateResponse, batch, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_create(self, async_client: AsyncAgentex) -> None: async with async_client.messages.batch.with_streaming_response.create( @@ -189,7 +189,7 @@ async def test_streaming_response_create(self, async_client: AsyncAgentex) -> No assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_update(self, async_client: AsyncAgentex) -> None: batch = await async_client.messages.batch.update( @@ -204,7 +204,7 @@ async def test_method_update(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(BatchUpdateResponse, batch, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_update(self, async_client: AsyncAgentex) -> None: response = await async_client.messages.batch.with_raw_response.update( @@ -223,7 +223,7 @@ async def test_raw_response_update(self, async_client: AsyncAgentex) -> None: batch = await response.parse() assert_matches_type(BatchUpdateResponse, batch, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_update(self, async_client: AsyncAgentex) -> None: async with async_client.messages.batch.with_streaming_response.update( diff --git a/tests/api_resources/test_agents.py b/tests/api_resources/test_agents.py index 2b078045b..859dee815 100644 --- a/tests/api_resources/test_agents.py +++ b/tests/api_resources/test_agents.py @@ -23,7 +23,7 @@ class TestAgents: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve(self, client: Agentex) -> None: agent = client.agents.retrieve( @@ -31,7 +31,7 @@ def test_method_retrieve(self, client: Agentex) -> None: ) assert_matches_type(Agent, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_retrieve(self, client: Agentex) -> None: response = client.agents.with_raw_response.retrieve( @@ -43,7 +43,7 @@ def test_raw_response_retrieve(self, client: Agentex) -> None: agent = response.parse() assert_matches_type(Agent, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_retrieve(self, client: Agentex) -> None: with client.agents.with_streaming_response.retrieve( @@ -57,7 +57,7 @@ def test_streaming_response_retrieve(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_retrieve(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): @@ -65,13 +65,13 @@ def test_path_params_retrieve(self, client: Agentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list(self, client: Agentex) -> None: agent = client.agents.list() assert_matches_type(AgentListResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list_with_all_params(self, client: Agentex) -> None: agent = client.agents.list( @@ -83,7 +83,7 @@ def test_method_list_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(AgentListResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_list(self, client: Agentex) -> None: response = client.agents.with_raw_response.list() @@ -93,7 +93,7 @@ def test_raw_response_list(self, client: Agentex) -> None: agent = response.parse() assert_matches_type(AgentListResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_list(self, client: Agentex) -> None: with client.agents.with_streaming_response.list() as response: @@ -105,7 +105,7 @@ def test_streaming_response_list(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_delete(self, client: Agentex) -> None: agent = client.agents.delete( @@ -113,7 +113,7 @@ def test_method_delete(self, client: Agentex) -> None: ) assert_matches_type(DeleteResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_delete(self, client: Agentex) -> None: response = client.agents.with_raw_response.delete( @@ -125,7 +125,7 @@ def test_raw_response_delete(self, client: Agentex) -> None: agent = response.parse() assert_matches_type(DeleteResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_delete(self, client: Agentex) -> None: with client.agents.with_streaming_response.delete( @@ -139,7 +139,7 @@ def test_streaming_response_delete(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_delete(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): @@ -147,7 +147,7 @@ def test_path_params_delete(self, client: Agentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_delete_by_name(self, client: Agentex) -> None: agent = client.agents.delete_by_name( @@ -155,7 +155,7 @@ def test_method_delete_by_name(self, client: Agentex) -> None: ) assert_matches_type(DeleteResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_delete_by_name(self, client: Agentex) -> None: response = client.agents.with_raw_response.delete_by_name( @@ -167,7 +167,7 @@ def test_raw_response_delete_by_name(self, client: Agentex) -> None: agent = response.parse() assert_matches_type(DeleteResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_delete_by_name(self, client: Agentex) -> None: with client.agents.with_streaming_response.delete_by_name( @@ -181,7 +181,7 @@ def test_streaming_response_delete_by_name(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_delete_by_name(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_name` but received ''"): @@ -189,7 +189,7 @@ def test_path_params_delete_by_name(self, client: Agentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve_by_name(self, client: Agentex) -> None: agent = client.agents.retrieve_by_name( @@ -197,7 +197,7 @@ def test_method_retrieve_by_name(self, client: Agentex) -> None: ) assert_matches_type(Agent, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_retrieve_by_name(self, client: Agentex) -> None: response = client.agents.with_raw_response.retrieve_by_name( @@ -209,7 +209,7 @@ def test_raw_response_retrieve_by_name(self, client: Agentex) -> None: agent = response.parse() assert_matches_type(Agent, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_retrieve_by_name(self, client: Agentex) -> None: with client.agents.with_streaming_response.retrieve_by_name( @@ -223,7 +223,7 @@ def test_streaming_response_retrieve_by_name(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_retrieve_by_name(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_name` but received ''"): @@ -231,7 +231,7 @@ def test_path_params_retrieve_by_name(self, client: Agentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_rpc(self, client: Agentex) -> None: agent = client.agents.rpc( @@ -241,7 +241,7 @@ def test_method_rpc(self, client: Agentex) -> None: ) assert_matches_type(AgentRpcResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_rpc_with_all_params(self, client: Agentex) -> None: agent = client.agents.rpc( @@ -256,7 +256,7 @@ def test_method_rpc_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(AgentRpcResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_rpc(self, client: Agentex) -> None: response = client.agents.with_raw_response.rpc( @@ -270,7 +270,7 @@ def test_raw_response_rpc(self, client: Agentex) -> None: agent = response.parse() assert_matches_type(AgentRpcResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_rpc(self, client: Agentex) -> None: with client.agents.with_streaming_response.rpc( @@ -286,7 +286,7 @@ def test_streaming_response_rpc(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_rpc(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): @@ -296,7 +296,7 @@ def test_path_params_rpc(self, client: Agentex) -> None: params={}, ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_rpc_by_name(self, client: Agentex) -> None: agent = client.agents.rpc_by_name( @@ -306,7 +306,7 @@ def test_method_rpc_by_name(self, client: Agentex) -> None: ) assert_matches_type(AgentRpcResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_rpc_by_name_with_all_params(self, client: Agentex) -> None: agent = client.agents.rpc_by_name( @@ -321,7 +321,7 @@ def test_method_rpc_by_name_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(AgentRpcResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_rpc_by_name(self, client: Agentex) -> None: response = client.agents.with_raw_response.rpc_by_name( @@ -335,7 +335,7 @@ def test_raw_response_rpc_by_name(self, client: Agentex) -> None: agent = response.parse() assert_matches_type(AgentRpcResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_rpc_by_name(self, client: Agentex) -> None: with client.agents.with_streaming_response.rpc_by_name( @@ -351,7 +351,7 @@ def test_streaming_response_rpc_by_name(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_rpc_by_name(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_name` but received ''"): @@ -367,7 +367,7 @@ class TestAsyncAgents: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: agent = await async_client.agents.retrieve( @@ -375,7 +375,7 @@ async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(Agent, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: response = await async_client.agents.with_raw_response.retrieve( @@ -387,7 +387,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: agent = await response.parse() assert_matches_type(Agent, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> None: async with async_client.agents.with_streaming_response.retrieve( @@ -401,7 +401,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): @@ -409,13 +409,13 @@ async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list(self, async_client: AsyncAgentex) -> None: agent = await async_client.agents.list() assert_matches_type(AgentListResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> None: agent = await async_client.agents.list( @@ -427,7 +427,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> ) assert_matches_type(AgentListResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: response = await async_client.agents.with_raw_response.list() @@ -437,7 +437,7 @@ async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: agent = await response.parse() assert_matches_type(AgentListResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_list(self, async_client: AsyncAgentex) -> None: async with async_client.agents.with_streaming_response.list() as response: @@ -449,7 +449,7 @@ async def test_streaming_response_list(self, async_client: AsyncAgentex) -> None assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_delete(self, async_client: AsyncAgentex) -> None: agent = await async_client.agents.delete( @@ -457,7 +457,7 @@ async def test_method_delete(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(DeleteResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_delete(self, async_client: AsyncAgentex) -> None: response = await async_client.agents.with_raw_response.delete( @@ -469,7 +469,7 @@ async def test_raw_response_delete(self, async_client: AsyncAgentex) -> None: agent = await response.parse() assert_matches_type(DeleteResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_delete(self, async_client: AsyncAgentex) -> None: async with async_client.agents.with_streaming_response.delete( @@ -483,7 +483,7 @@ async def test_streaming_response_delete(self, async_client: AsyncAgentex) -> No assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_delete(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): @@ -491,7 +491,7 @@ async def test_path_params_delete(self, async_client: AsyncAgentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_delete_by_name(self, async_client: AsyncAgentex) -> None: agent = await async_client.agents.delete_by_name( @@ -499,7 +499,7 @@ async def test_method_delete_by_name(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(DeleteResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_delete_by_name(self, async_client: AsyncAgentex) -> None: response = await async_client.agents.with_raw_response.delete_by_name( @@ -511,7 +511,7 @@ async def test_raw_response_delete_by_name(self, async_client: AsyncAgentex) -> agent = await response.parse() assert_matches_type(DeleteResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_delete_by_name(self, async_client: AsyncAgentex) -> None: async with async_client.agents.with_streaming_response.delete_by_name( @@ -525,7 +525,7 @@ async def test_streaming_response_delete_by_name(self, async_client: AsyncAgente assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_delete_by_name(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_name` but received ''"): @@ -533,7 +533,7 @@ async def test_path_params_delete_by_name(self, async_client: AsyncAgentex) -> N "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve_by_name(self, async_client: AsyncAgentex) -> None: agent = await async_client.agents.retrieve_by_name( @@ -541,7 +541,7 @@ async def test_method_retrieve_by_name(self, async_client: AsyncAgentex) -> None ) assert_matches_type(Agent, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_retrieve_by_name(self, async_client: AsyncAgentex) -> None: response = await async_client.agents.with_raw_response.retrieve_by_name( @@ -553,7 +553,7 @@ async def test_raw_response_retrieve_by_name(self, async_client: AsyncAgentex) - agent = await response.parse() assert_matches_type(Agent, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_retrieve_by_name(self, async_client: AsyncAgentex) -> None: async with async_client.agents.with_streaming_response.retrieve_by_name( @@ -567,7 +567,7 @@ async def test_streaming_response_retrieve_by_name(self, async_client: AsyncAgen assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_retrieve_by_name(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_name` but received ''"): @@ -575,7 +575,7 @@ async def test_path_params_retrieve_by_name(self, async_client: AsyncAgentex) -> "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_rpc(self, async_client: AsyncAgentex) -> None: agent = await async_client.agents.rpc( @@ -585,7 +585,7 @@ async def test_method_rpc(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(AgentRpcResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_rpc_with_all_params(self, async_client: AsyncAgentex) -> None: agent = await async_client.agents.rpc( @@ -600,7 +600,7 @@ async def test_method_rpc_with_all_params(self, async_client: AsyncAgentex) -> N ) assert_matches_type(AgentRpcResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_rpc(self, async_client: AsyncAgentex) -> None: response = await async_client.agents.with_raw_response.rpc( @@ -614,7 +614,7 @@ async def test_raw_response_rpc(self, async_client: AsyncAgentex) -> None: agent = await response.parse() assert_matches_type(AgentRpcResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_rpc(self, async_client: AsyncAgentex) -> None: async with async_client.agents.with_streaming_response.rpc( @@ -630,7 +630,7 @@ async def test_streaming_response_rpc(self, async_client: AsyncAgentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_rpc(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_id` but received ''"): @@ -640,7 +640,7 @@ async def test_path_params_rpc(self, async_client: AsyncAgentex) -> None: params={}, ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_rpc_by_name(self, async_client: AsyncAgentex) -> None: agent = await async_client.agents.rpc_by_name( @@ -650,7 +650,7 @@ async def test_method_rpc_by_name(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(AgentRpcResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_rpc_by_name_with_all_params(self, async_client: AsyncAgentex) -> None: agent = await async_client.agents.rpc_by_name( @@ -665,7 +665,7 @@ async def test_method_rpc_by_name_with_all_params(self, async_client: AsyncAgent ) assert_matches_type(AgentRpcResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_rpc_by_name(self, async_client: AsyncAgentex) -> None: response = await async_client.agents.with_raw_response.rpc_by_name( @@ -679,7 +679,7 @@ async def test_raw_response_rpc_by_name(self, async_client: AsyncAgentex) -> Non agent = await response.parse() assert_matches_type(AgentRpcResponse, agent, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_rpc_by_name(self, async_client: AsyncAgentex) -> None: async with async_client.agents.with_streaming_response.rpc_by_name( @@ -695,7 +695,7 @@ async def test_streaming_response_rpc_by_name(self, async_client: AsyncAgentex) assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_rpc_by_name(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `agent_name` but received ''"): diff --git a/tests/api_resources/test_deployment_history.py b/tests/api_resources/test_deployment_history.py index 89012bf9f..1b98042b7 100644 --- a/tests/api_resources/test_deployment_history.py +++ b/tests/api_resources/test_deployment_history.py @@ -18,7 +18,7 @@ class TestDeploymentHistory: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve(self, client: Agentex) -> None: deployment_history = client.deployment_history.retrieve( @@ -26,7 +26,7 @@ def test_method_retrieve(self, client: Agentex) -> None: ) assert_matches_type(DeploymentHistory, deployment_history, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_retrieve(self, client: Agentex) -> None: response = client.deployment_history.with_raw_response.retrieve( @@ -38,7 +38,7 @@ def test_raw_response_retrieve(self, client: Agentex) -> None: deployment_history = response.parse() assert_matches_type(DeploymentHistory, deployment_history, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_retrieve(self, client: Agentex) -> None: with client.deployment_history.with_streaming_response.retrieve( @@ -52,7 +52,7 @@ def test_streaming_response_retrieve(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_retrieve(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_id` but received ''"): @@ -60,24 +60,26 @@ def test_path_params_retrieve(self, client: Agentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list(self, client: Agentex) -> None: deployment_history = client.deployment_history.list() assert_matches_type(DeploymentHistoryListResponse, deployment_history, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list_with_all_params(self, client: Agentex) -> None: deployment_history = client.deployment_history.list( agent_id="agent_id", agent_name="agent_name", limit=0, + order_by="order_by", + order_direction="order_direction", page_number=0, ) assert_matches_type(DeploymentHistoryListResponse, deployment_history, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_list(self, client: Agentex) -> None: response = client.deployment_history.with_raw_response.list() @@ -87,7 +89,7 @@ def test_raw_response_list(self, client: Agentex) -> None: deployment_history = response.parse() assert_matches_type(DeploymentHistoryListResponse, deployment_history, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_list(self, client: Agentex) -> None: with client.deployment_history.with_streaming_response.list() as response: @@ -105,7 +107,7 @@ class TestAsyncDeploymentHistory: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: deployment_history = await async_client.deployment_history.retrieve( @@ -113,7 +115,7 @@ async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(DeploymentHistory, deployment_history, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: response = await async_client.deployment_history.with_raw_response.retrieve( @@ -125,7 +127,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: deployment_history = await response.parse() assert_matches_type(DeploymentHistory, deployment_history, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> None: async with async_client.deployment_history.with_streaming_response.retrieve( @@ -139,7 +141,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `deployment_id` but received ''"): @@ -147,24 +149,26 @@ async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list(self, async_client: AsyncAgentex) -> None: deployment_history = await async_client.deployment_history.list() assert_matches_type(DeploymentHistoryListResponse, deployment_history, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> None: deployment_history = await async_client.deployment_history.list( agent_id="agent_id", agent_name="agent_name", limit=0, + order_by="order_by", + order_direction="order_direction", page_number=0, ) assert_matches_type(DeploymentHistoryListResponse, deployment_history, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: response = await async_client.deployment_history.with_raw_response.list() @@ -174,7 +178,7 @@ async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: deployment_history = await response.parse() assert_matches_type(DeploymentHistoryListResponse, deployment_history, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_list(self, async_client: AsyncAgentex) -> None: async with async_client.deployment_history.with_streaming_response.list() as response: diff --git a/tests/api_resources/test_events.py b/tests/api_resources/test_events.py index ccf5f7bfb..7a0805b52 100644 --- a/tests/api_resources/test_events.py +++ b/tests/api_resources/test_events.py @@ -18,7 +18,7 @@ class TestEvents: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve(self, client: Agentex) -> None: event = client.events.retrieve( @@ -26,7 +26,7 @@ def test_method_retrieve(self, client: Agentex) -> None: ) assert_matches_type(Event, event, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_retrieve(self, client: Agentex) -> None: response = client.events.with_raw_response.retrieve( @@ -38,7 +38,7 @@ def test_raw_response_retrieve(self, client: Agentex) -> None: event = response.parse() assert_matches_type(Event, event, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_retrieve(self, client: Agentex) -> None: with client.events.with_streaming_response.retrieve( @@ -52,7 +52,7 @@ def test_streaming_response_retrieve(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_retrieve(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): @@ -60,7 +60,7 @@ def test_path_params_retrieve(self, client: Agentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list(self, client: Agentex) -> None: event = client.events.list( @@ -69,7 +69,7 @@ def test_method_list(self, client: Agentex) -> None: ) assert_matches_type(EventListResponse, event, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list_with_all_params(self, client: Agentex) -> None: event = client.events.list( @@ -80,7 +80,7 @@ def test_method_list_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(EventListResponse, event, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_list(self, client: Agentex) -> None: response = client.events.with_raw_response.list( @@ -93,7 +93,7 @@ def test_raw_response_list(self, client: Agentex) -> None: event = response.parse() assert_matches_type(EventListResponse, event, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_list(self, client: Agentex) -> None: with client.events.with_streaming_response.list( @@ -114,7 +114,7 @@ class TestAsyncEvents: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: event = await async_client.events.retrieve( @@ -122,7 +122,7 @@ async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(Event, event, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: response = await async_client.events.with_raw_response.retrieve( @@ -134,7 +134,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: event = await response.parse() assert_matches_type(Event, event, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> None: async with async_client.events.with_streaming_response.retrieve( @@ -148,7 +148,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_id` but received ''"): @@ -156,7 +156,7 @@ async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list(self, async_client: AsyncAgentex) -> None: event = await async_client.events.list( @@ -165,7 +165,7 @@ async def test_method_list(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(EventListResponse, event, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> None: event = await async_client.events.list( @@ -176,7 +176,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> ) assert_matches_type(EventListResponse, event, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: response = await async_client.events.with_raw_response.list( @@ -189,7 +189,7 @@ async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: event = await response.parse() assert_matches_type(EventListResponse, event, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_list(self, async_client: AsyncAgentex) -> None: async with async_client.events.with_streaming_response.list( diff --git a/tests/api_resources/test_messages.py b/tests/api_resources/test_messages.py index 4b9cfc31b..2aeeffe95 100644 --- a/tests/api_resources/test_messages.py +++ b/tests/api_resources/test_messages.py @@ -22,7 +22,7 @@ class TestMessages: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_create(self, client: Agentex) -> None: message = client.messages.create( @@ -35,7 +35,7 @@ def test_method_create(self, client: Agentex) -> None: ) assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_create_with_all_params(self, client: Agentex) -> None: message = client.messages.create( @@ -59,7 +59,7 @@ def test_method_create_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_create(self, client: Agentex) -> None: response = client.messages.with_raw_response.create( @@ -76,7 +76,7 @@ def test_raw_response_create(self, client: Agentex) -> None: message = response.parse() assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_create(self, client: Agentex) -> None: with client.messages.with_streaming_response.create( @@ -95,7 +95,7 @@ def test_streaming_response_create(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve(self, client: Agentex) -> None: message = client.messages.retrieve( @@ -103,7 +103,7 @@ def test_method_retrieve(self, client: Agentex) -> None: ) assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_retrieve(self, client: Agentex) -> None: response = client.messages.with_raw_response.retrieve( @@ -115,7 +115,7 @@ def test_raw_response_retrieve(self, client: Agentex) -> None: message = response.parse() assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_retrieve(self, client: Agentex) -> None: with client.messages.with_streaming_response.retrieve( @@ -129,7 +129,7 @@ def test_streaming_response_retrieve(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_retrieve(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_id` but received ''"): @@ -137,7 +137,7 @@ def test_path_params_retrieve(self, client: Agentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_update(self, client: Agentex) -> None: message = client.messages.update( @@ -151,7 +151,7 @@ def test_method_update(self, client: Agentex) -> None: ) assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_update_with_all_params(self, client: Agentex) -> None: message = client.messages.update( @@ -176,7 +176,7 @@ def test_method_update_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_update(self, client: Agentex) -> None: response = client.messages.with_raw_response.update( @@ -194,7 +194,7 @@ def test_raw_response_update(self, client: Agentex) -> None: message = response.parse() assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_update(self, client: Agentex) -> None: with client.messages.with_streaming_response.update( @@ -214,7 +214,7 @@ def test_streaming_response_update(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_update(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_id` but received ''"): @@ -228,7 +228,7 @@ def test_path_params_update(self, client: Agentex) -> None: task_id="task_id", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list(self, client: Agentex) -> None: message = client.messages.list( @@ -236,7 +236,7 @@ def test_method_list(self, client: Agentex) -> None: ) assert_matches_type(MessageListResponse, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list_with_all_params(self, client: Agentex) -> None: message = client.messages.list( @@ -249,7 +249,7 @@ def test_method_list_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(MessageListResponse, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_list(self, client: Agentex) -> None: response = client.messages.with_raw_response.list( @@ -261,7 +261,7 @@ def test_raw_response_list(self, client: Agentex) -> None: message = response.parse() assert_matches_type(MessageListResponse, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_list(self, client: Agentex) -> None: with client.messages.with_streaming_response.list( @@ -275,7 +275,7 @@ def test_streaming_response_list(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list_paginated(self, client: Agentex) -> None: message = client.messages.list_paginated( @@ -283,7 +283,7 @@ def test_method_list_paginated(self, client: Agentex) -> None: ) assert_matches_type(MessageListPaginatedResponse, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list_paginated_with_all_params(self, client: Agentex) -> None: message = client.messages.list_paginated( @@ -295,7 +295,7 @@ def test_method_list_paginated_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(MessageListPaginatedResponse, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_list_paginated(self, client: Agentex) -> None: response = client.messages.with_raw_response.list_paginated( @@ -307,7 +307,7 @@ def test_raw_response_list_paginated(self, client: Agentex) -> None: message = response.parse() assert_matches_type(MessageListPaginatedResponse, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_list_paginated(self, client: Agentex) -> None: with client.messages.with_streaming_response.list_paginated( @@ -327,7 +327,7 @@ class TestAsyncMessages: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_create(self, async_client: AsyncAgentex) -> None: message = await async_client.messages.create( @@ -340,7 +340,7 @@ async def test_method_create(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_create_with_all_params(self, async_client: AsyncAgentex) -> None: message = await async_client.messages.create( @@ -364,7 +364,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAgentex) - ) assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_create(self, async_client: AsyncAgentex) -> None: response = await async_client.messages.with_raw_response.create( @@ -381,7 +381,7 @@ async def test_raw_response_create(self, async_client: AsyncAgentex) -> None: message = await response.parse() assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_create(self, async_client: AsyncAgentex) -> None: async with async_client.messages.with_streaming_response.create( @@ -400,7 +400,7 @@ async def test_streaming_response_create(self, async_client: AsyncAgentex) -> No assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: message = await async_client.messages.retrieve( @@ -408,7 +408,7 @@ async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: response = await async_client.messages.with_raw_response.retrieve( @@ -420,7 +420,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: message = await response.parse() assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> None: async with async_client.messages.with_streaming_response.retrieve( @@ -434,7 +434,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_id` but received ''"): @@ -442,7 +442,7 @@ async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_update(self, async_client: AsyncAgentex) -> None: message = await async_client.messages.update( @@ -456,7 +456,7 @@ async def test_method_update(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_update_with_all_params(self, async_client: AsyncAgentex) -> None: message = await async_client.messages.update( @@ -481,7 +481,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAgentex) - ) assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_update(self, async_client: AsyncAgentex) -> None: response = await async_client.messages.with_raw_response.update( @@ -499,7 +499,7 @@ async def test_raw_response_update(self, async_client: AsyncAgentex) -> None: message = await response.parse() assert_matches_type(TaskMessage, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_update(self, async_client: AsyncAgentex) -> None: async with async_client.messages.with_streaming_response.update( @@ -519,7 +519,7 @@ async def test_streaming_response_update(self, async_client: AsyncAgentex) -> No assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_update(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `message_id` but received ''"): @@ -533,7 +533,7 @@ async def test_path_params_update(self, async_client: AsyncAgentex) -> None: task_id="task_id", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list(self, async_client: AsyncAgentex) -> None: message = await async_client.messages.list( @@ -541,7 +541,7 @@ async def test_method_list(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(MessageListResponse, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> None: message = await async_client.messages.list( @@ -554,7 +554,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> ) assert_matches_type(MessageListResponse, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: response = await async_client.messages.with_raw_response.list( @@ -566,7 +566,7 @@ async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: message = await response.parse() assert_matches_type(MessageListResponse, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_list(self, async_client: AsyncAgentex) -> None: async with async_client.messages.with_streaming_response.list( @@ -580,7 +580,7 @@ async def test_streaming_response_list(self, async_client: AsyncAgentex) -> None assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list_paginated(self, async_client: AsyncAgentex) -> None: message = await async_client.messages.list_paginated( @@ -588,7 +588,7 @@ async def test_method_list_paginated(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(MessageListPaginatedResponse, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list_paginated_with_all_params(self, async_client: AsyncAgentex) -> None: message = await async_client.messages.list_paginated( @@ -600,7 +600,7 @@ async def test_method_list_paginated_with_all_params(self, async_client: AsyncAg ) assert_matches_type(MessageListPaginatedResponse, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_list_paginated(self, async_client: AsyncAgentex) -> None: response = await async_client.messages.with_raw_response.list_paginated( @@ -612,7 +612,7 @@ async def test_raw_response_list_paginated(self, async_client: AsyncAgentex) -> message = await response.parse() assert_matches_type(MessageListPaginatedResponse, message, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_list_paginated(self, async_client: AsyncAgentex) -> None: async with async_client.messages.with_streaming_response.list_paginated( diff --git a/tests/api_resources/test_spans.py b/tests/api_resources/test_spans.py index dd4162ba0..948760a67 100644 --- a/tests/api_resources/test_spans.py +++ b/tests/api_resources/test_spans.py @@ -19,7 +19,7 @@ class TestSpans: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_create(self, client: Agentex) -> None: span = client.spans.create( @@ -29,7 +29,7 @@ def test_method_create(self, client: Agentex) -> None: ) assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_create_with_all_params(self, client: Agentex) -> None: span = client.spans.create( @@ -45,7 +45,7 @@ def test_method_create_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_create(self, client: Agentex) -> None: response = client.spans.with_raw_response.create( @@ -59,7 +59,7 @@ def test_raw_response_create(self, client: Agentex) -> None: span = response.parse() assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_create(self, client: Agentex) -> None: with client.spans.with_streaming_response.create( @@ -75,7 +75,7 @@ def test_streaming_response_create(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve(self, client: Agentex) -> None: span = client.spans.retrieve( @@ -83,7 +83,7 @@ def test_method_retrieve(self, client: Agentex) -> None: ) assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_retrieve(self, client: Agentex) -> None: response = client.spans.with_raw_response.retrieve( @@ -95,7 +95,7 @@ def test_raw_response_retrieve(self, client: Agentex) -> None: span = response.parse() assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_retrieve(self, client: Agentex) -> None: with client.spans.with_streaming_response.retrieve( @@ -109,7 +109,7 @@ def test_streaming_response_retrieve(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_retrieve(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `span_id` but received ''"): @@ -117,7 +117,7 @@ def test_path_params_retrieve(self, client: Agentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_update(self, client: Agentex) -> None: span = client.spans.update( @@ -125,7 +125,7 @@ def test_method_update(self, client: Agentex) -> None: ) assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_update_with_all_params(self, client: Agentex) -> None: span = client.spans.update( @@ -141,7 +141,7 @@ def test_method_update_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_update(self, client: Agentex) -> None: response = client.spans.with_raw_response.update( @@ -153,7 +153,7 @@ def test_raw_response_update(self, client: Agentex) -> None: span = response.parse() assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_update(self, client: Agentex) -> None: with client.spans.with_streaming_response.update( @@ -167,7 +167,7 @@ def test_streaming_response_update(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_update(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `span_id` but received ''"): @@ -175,13 +175,13 @@ def test_path_params_update(self, client: Agentex) -> None: span_id="", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list(self, client: Agentex) -> None: span = client.spans.list() assert_matches_type(SpanListResponse, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list_with_all_params(self, client: Agentex) -> None: span = client.spans.list( @@ -193,7 +193,7 @@ def test_method_list_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(SpanListResponse, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_list(self, client: Agentex) -> None: response = client.spans.with_raw_response.list() @@ -203,7 +203,7 @@ def test_raw_response_list(self, client: Agentex) -> None: span = response.parse() assert_matches_type(SpanListResponse, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_list(self, client: Agentex) -> None: with client.spans.with_streaming_response.list() as response: @@ -221,7 +221,7 @@ class TestAsyncSpans: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_create(self, async_client: AsyncAgentex) -> None: span = await async_client.spans.create( @@ -231,7 +231,7 @@ async def test_method_create(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_create_with_all_params(self, async_client: AsyncAgentex) -> None: span = await async_client.spans.create( @@ -247,7 +247,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncAgentex) - ) assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_create(self, async_client: AsyncAgentex) -> None: response = await async_client.spans.with_raw_response.create( @@ -261,7 +261,7 @@ async def test_raw_response_create(self, async_client: AsyncAgentex) -> None: span = await response.parse() assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_create(self, async_client: AsyncAgentex) -> None: async with async_client.spans.with_streaming_response.create( @@ -277,7 +277,7 @@ async def test_streaming_response_create(self, async_client: AsyncAgentex) -> No assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: span = await async_client.spans.retrieve( @@ -285,7 +285,7 @@ async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: response = await async_client.spans.with_raw_response.retrieve( @@ -297,7 +297,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: span = await response.parse() assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> None: async with async_client.spans.with_streaming_response.retrieve( @@ -311,7 +311,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `span_id` but received ''"): @@ -319,7 +319,7 @@ async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_update(self, async_client: AsyncAgentex) -> None: span = await async_client.spans.update( @@ -327,7 +327,7 @@ async def test_method_update(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_update_with_all_params(self, async_client: AsyncAgentex) -> None: span = await async_client.spans.update( @@ -343,7 +343,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAgentex) - ) assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_update(self, async_client: AsyncAgentex) -> None: response = await async_client.spans.with_raw_response.update( @@ -355,7 +355,7 @@ async def test_raw_response_update(self, async_client: AsyncAgentex) -> None: span = await response.parse() assert_matches_type(Span, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_update(self, async_client: AsyncAgentex) -> None: async with async_client.spans.with_streaming_response.update( @@ -369,7 +369,7 @@ async def test_streaming_response_update(self, async_client: AsyncAgentex) -> No assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_update(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `span_id` but received ''"): @@ -377,13 +377,13 @@ async def test_path_params_update(self, async_client: AsyncAgentex) -> None: span_id="", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list(self, async_client: AsyncAgentex) -> None: span = await async_client.spans.list() assert_matches_type(SpanListResponse, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> None: span = await async_client.spans.list( @@ -395,7 +395,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> ) assert_matches_type(SpanListResponse, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: response = await async_client.spans.with_raw_response.list() @@ -405,7 +405,7 @@ async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: span = await response.parse() assert_matches_type(SpanListResponse, span, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_list(self, async_client: AsyncAgentex) -> None: async with async_client.spans.with_streaming_response.list() as response: diff --git a/tests/api_resources/test_states.py b/tests/api_resources/test_states.py index 0b3193420..2e5e91a0c 100644 --- a/tests/api_resources/test_states.py +++ b/tests/api_resources/test_states.py @@ -18,7 +18,7 @@ class TestStates: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_create(self, client: Agentex) -> None: state = client.states.create( @@ -28,7 +28,7 @@ def test_method_create(self, client: Agentex) -> None: ) assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_create(self, client: Agentex) -> None: response = client.states.with_raw_response.create( @@ -42,7 +42,7 @@ def test_raw_response_create(self, client: Agentex) -> None: state = response.parse() assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_create(self, client: Agentex) -> None: with client.states.with_streaming_response.create( @@ -58,7 +58,7 @@ def test_streaming_response_create(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve(self, client: Agentex) -> None: state = client.states.retrieve( @@ -66,7 +66,7 @@ def test_method_retrieve(self, client: Agentex) -> None: ) assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_retrieve(self, client: Agentex) -> None: response = client.states.with_raw_response.retrieve( @@ -78,7 +78,7 @@ def test_raw_response_retrieve(self, client: Agentex) -> None: state = response.parse() assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_retrieve(self, client: Agentex) -> None: with client.states.with_streaming_response.retrieve( @@ -92,7 +92,7 @@ def test_streaming_response_retrieve(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_retrieve(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `state_id` but received ''"): @@ -100,7 +100,7 @@ def test_path_params_retrieve(self, client: Agentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_update(self, client: Agentex) -> None: state = client.states.update( @@ -111,7 +111,7 @@ def test_method_update(self, client: Agentex) -> None: ) assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_update(self, client: Agentex) -> None: response = client.states.with_raw_response.update( @@ -126,7 +126,7 @@ def test_raw_response_update(self, client: Agentex) -> None: state = response.parse() assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_update(self, client: Agentex) -> None: with client.states.with_streaming_response.update( @@ -143,7 +143,7 @@ def test_streaming_response_update(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_update(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `state_id` but received ''"): @@ -154,13 +154,13 @@ def test_path_params_update(self, client: Agentex) -> None: task_id="task_id", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list(self, client: Agentex) -> None: state = client.states.list() assert_matches_type(StateListResponse, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list_with_all_params(self, client: Agentex) -> None: state = client.states.list( @@ -173,7 +173,7 @@ def test_method_list_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(StateListResponse, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_list(self, client: Agentex) -> None: response = client.states.with_raw_response.list() @@ -183,7 +183,7 @@ def test_raw_response_list(self, client: Agentex) -> None: state = response.parse() assert_matches_type(StateListResponse, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_list(self, client: Agentex) -> None: with client.states.with_streaming_response.list() as response: @@ -195,7 +195,7 @@ def test_streaming_response_list(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_delete(self, client: Agentex) -> None: state = client.states.delete( @@ -203,7 +203,7 @@ def test_method_delete(self, client: Agentex) -> None: ) assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_delete(self, client: Agentex) -> None: response = client.states.with_raw_response.delete( @@ -215,7 +215,7 @@ def test_raw_response_delete(self, client: Agentex) -> None: state = response.parse() assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_delete(self, client: Agentex) -> None: with client.states.with_streaming_response.delete( @@ -229,7 +229,7 @@ def test_streaming_response_delete(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_delete(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `state_id` but received ''"): @@ -243,7 +243,7 @@ class TestAsyncStates: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_create(self, async_client: AsyncAgentex) -> None: state = await async_client.states.create( @@ -253,7 +253,7 @@ async def test_method_create(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_create(self, async_client: AsyncAgentex) -> None: response = await async_client.states.with_raw_response.create( @@ -267,7 +267,7 @@ async def test_raw_response_create(self, async_client: AsyncAgentex) -> None: state = await response.parse() assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_create(self, async_client: AsyncAgentex) -> None: async with async_client.states.with_streaming_response.create( @@ -283,7 +283,7 @@ async def test_streaming_response_create(self, async_client: AsyncAgentex) -> No assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: state = await async_client.states.retrieve( @@ -291,7 +291,7 @@ async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: response = await async_client.states.with_raw_response.retrieve( @@ -303,7 +303,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: state = await response.parse() assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> None: async with async_client.states.with_streaming_response.retrieve( @@ -317,7 +317,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `state_id` but received ''"): @@ -325,7 +325,7 @@ async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_update(self, async_client: AsyncAgentex) -> None: state = await async_client.states.update( @@ -336,7 +336,7 @@ async def test_method_update(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_update(self, async_client: AsyncAgentex) -> None: response = await async_client.states.with_raw_response.update( @@ -351,7 +351,7 @@ async def test_raw_response_update(self, async_client: AsyncAgentex) -> None: state = await response.parse() assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_update(self, async_client: AsyncAgentex) -> None: async with async_client.states.with_streaming_response.update( @@ -368,7 +368,7 @@ async def test_streaming_response_update(self, async_client: AsyncAgentex) -> No assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_update(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `state_id` but received ''"): @@ -379,13 +379,13 @@ async def test_path_params_update(self, async_client: AsyncAgentex) -> None: task_id="task_id", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list(self, async_client: AsyncAgentex) -> None: state = await async_client.states.list() assert_matches_type(StateListResponse, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> None: state = await async_client.states.list( @@ -398,7 +398,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> ) assert_matches_type(StateListResponse, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: response = await async_client.states.with_raw_response.list() @@ -408,7 +408,7 @@ async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: state = await response.parse() assert_matches_type(StateListResponse, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_list(self, async_client: AsyncAgentex) -> None: async with async_client.states.with_streaming_response.list() as response: @@ -420,7 +420,7 @@ async def test_streaming_response_list(self, async_client: AsyncAgentex) -> None assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_delete(self, async_client: AsyncAgentex) -> None: state = await async_client.states.delete( @@ -428,7 +428,7 @@ async def test_method_delete(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_delete(self, async_client: AsyncAgentex) -> None: response = await async_client.states.with_raw_response.delete( @@ -440,7 +440,7 @@ async def test_raw_response_delete(self, async_client: AsyncAgentex) -> None: state = await response.parse() assert_matches_type(State, state, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_delete(self, async_client: AsyncAgentex) -> None: async with async_client.states.with_streaming_response.delete( @@ -454,7 +454,7 @@ async def test_streaming_response_delete(self, async_client: AsyncAgentex) -> No assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_delete(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `state_id` but received ''"): diff --git a/tests/api_resources/test_tasks.py b/tests/api_resources/test_tasks.py index ce240badc..0f1dd591d 100644 --- a/tests/api_resources/test_tasks.py +++ b/tests/api_resources/test_tasks.py @@ -9,8 +9,10 @@ from agentex import Agentex, AsyncAgentex from agentex.types import ( + Task, TaskListResponse, TaskRetrieveResponse, + TaskQueryWorkflowResponse, TaskRetrieveByNameResponse, ) from agentex.types.shared import DeleteResponse @@ -23,7 +25,7 @@ class TestTasks: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve(self, client: Agentex) -> None: task = client.tasks.retrieve( @@ -31,7 +33,7 @@ def test_method_retrieve(self, client: Agentex) -> None: ) assert_matches_type(TaskRetrieveResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve_with_all_params(self, client: Agentex) -> None: task = client.tasks.retrieve( @@ -40,7 +42,7 @@ def test_method_retrieve_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(TaskRetrieveResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_retrieve(self, client: Agentex) -> None: response = client.tasks.with_raw_response.retrieve( @@ -52,7 +54,7 @@ def test_raw_response_retrieve(self, client: Agentex) -> None: task = response.parse() assert_matches_type(TaskRetrieveResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_retrieve(self, client: Agentex) -> None: with client.tasks.with_streaming_response.retrieve( @@ -66,7 +68,7 @@ def test_streaming_response_retrieve(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_retrieve(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): @@ -74,13 +76,13 @@ def test_path_params_retrieve(self, client: Agentex) -> None: task_id="", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list(self, client: Agentex) -> None: task = client.tasks.list() assert_matches_type(TaskListResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list_with_all_params(self, client: Agentex) -> None: task = client.tasks.list( @@ -94,7 +96,7 @@ def test_method_list_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(TaskListResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_list(self, client: Agentex) -> None: response = client.tasks.with_raw_response.list() @@ -104,7 +106,7 @@ def test_raw_response_list(self, client: Agentex) -> None: task = response.parse() assert_matches_type(TaskListResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_list(self, client: Agentex) -> None: with client.tasks.with_streaming_response.list() as response: @@ -116,7 +118,7 @@ def test_streaming_response_list(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_delete(self, client: Agentex) -> None: task = client.tasks.delete( @@ -124,7 +126,7 @@ def test_method_delete(self, client: Agentex) -> None: ) assert_matches_type(DeleteResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_delete(self, client: Agentex) -> None: response = client.tasks.with_raw_response.delete( @@ -136,7 +138,7 @@ def test_raw_response_delete(self, client: Agentex) -> None: task = response.parse() assert_matches_type(DeleteResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_delete(self, client: Agentex) -> None: with client.tasks.with_streaming_response.delete( @@ -150,7 +152,7 @@ def test_streaming_response_delete(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_delete(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): @@ -158,7 +160,109 @@ def test_path_params_delete(self, client: Agentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_cancel(self, client: Agentex) -> None: + task = client.tasks.cancel( + task_id="task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_cancel_with_all_params(self, client: Agentex) -> None: + task = client.tasks.cancel( + task_id="task_id", + reason="reason", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_cancel(self, client: Agentex) -> None: + response = client.tasks.with_raw_response.cancel( + task_id="task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_cancel(self, client: Agentex) -> None: + with client.tasks.with_streaming_response.cancel( + task_id="task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_cancel(self, client: Agentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + client.tasks.with_raw_response.cancel( + task_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_complete(self, client: Agentex) -> None: + task = client.tasks.complete( + task_id="task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_complete_with_all_params(self, client: Agentex) -> None: + task = client.tasks.complete( + task_id="task_id", + reason="reason", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_complete(self, client: Agentex) -> None: + response = client.tasks.with_raw_response.complete( + task_id="task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_complete(self, client: Agentex) -> None: + with client.tasks.with_streaming_response.complete( + task_id="task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_complete(self, client: Agentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + client.tasks.with_raw_response.complete( + task_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_delete_by_name(self, client: Agentex) -> None: task = client.tasks.delete_by_name( @@ -166,7 +270,7 @@ def test_method_delete_by_name(self, client: Agentex) -> None: ) assert_matches_type(DeleteResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_delete_by_name(self, client: Agentex) -> None: response = client.tasks.with_raw_response.delete_by_name( @@ -178,7 +282,7 @@ def test_raw_response_delete_by_name(self, client: Agentex) -> None: task = response.parse() assert_matches_type(DeleteResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_delete_by_name(self, client: Agentex) -> None: with client.tasks.with_streaming_response.delete_by_name( @@ -192,7 +296,7 @@ def test_streaming_response_delete_by_name(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_delete_by_name(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_name` but received ''"): @@ -200,7 +304,110 @@ def test_path_params_delete_by_name(self, client: Agentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_fail(self, client: Agentex) -> None: + task = client.tasks.fail( + task_id="task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_fail_with_all_params(self, client: Agentex) -> None: + task = client.tasks.fail( + task_id="task_id", + reason="reason", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_fail(self, client: Agentex) -> None: + response = client.tasks.with_raw_response.fail( + task_id="task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_fail(self, client: Agentex) -> None: + with client.tasks.with_streaming_response.fail( + task_id="task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_fail(self, client: Agentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + client.tasks.with_raw_response.fail( + task_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_query_workflow(self, client: Agentex) -> None: + task = client.tasks.query_workflow( + query_name="query_name", + task_id="task_id", + ) + assert_matches_type(TaskQueryWorkflowResponse, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_query_workflow(self, client: Agentex) -> None: + response = client.tasks.with_raw_response.query_workflow( + query_name="query_name", + task_id="task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = response.parse() + assert_matches_type(TaskQueryWorkflowResponse, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_query_workflow(self, client: Agentex) -> None: + with client.tasks.with_streaming_response.query_workflow( + query_name="query_name", + task_id="task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = response.parse() + assert_matches_type(TaskQueryWorkflowResponse, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_query_workflow(self, client: Agentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + client.tasks.with_raw_response.query_workflow( + query_name="query_name", + task_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `query_name` but received ''"): + client.tasks.with_raw_response.query_workflow( + query_name="", + task_id="task_id", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve_by_name(self, client: Agentex) -> None: task = client.tasks.retrieve_by_name( @@ -208,7 +415,7 @@ def test_method_retrieve_by_name(self, client: Agentex) -> None: ) assert_matches_type(TaskRetrieveByNameResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve_by_name_with_all_params(self, client: Agentex) -> None: task = client.tasks.retrieve_by_name( @@ -217,7 +424,7 @@ def test_method_retrieve_by_name_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(TaskRetrieveByNameResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_retrieve_by_name(self, client: Agentex) -> None: response = client.tasks.with_raw_response.retrieve_by_name( @@ -229,7 +436,7 @@ def test_raw_response_retrieve_by_name(self, client: Agentex) -> None: task = response.parse() assert_matches_type(TaskRetrieveByNameResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_retrieve_by_name(self, client: Agentex) -> None: with client.tasks.with_streaming_response.retrieve_by_name( @@ -243,7 +450,7 @@ def test_streaming_response_retrieve_by_name(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_retrieve_by_name(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_name` but received ''"): @@ -251,7 +458,7 @@ def test_path_params_retrieve_by_name(self, client: Agentex) -> None: task_name="", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_stream_events(self, client: Agentex) -> None: task_stream = client.tasks.stream_events( @@ -259,7 +466,7 @@ def test_method_stream_events(self, client: Agentex) -> None: ) task_stream.response.close() - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_stream_events(self, client: Agentex) -> None: response = client.tasks.with_raw_response.stream_events( @@ -270,7 +477,7 @@ def test_raw_response_stream_events(self, client: Agentex) -> None: stream = response.parse() stream.close() - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_stream_events(self, client: Agentex) -> None: with client.tasks.with_streaming_response.stream_events( @@ -284,7 +491,7 @@ def test_streaming_response_stream_events(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_stream_events(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): @@ -292,7 +499,7 @@ def test_path_params_stream_events(self, client: Agentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_stream_events_by_name(self, client: Agentex) -> None: task_stream = client.tasks.stream_events_by_name( @@ -300,7 +507,7 @@ def test_method_stream_events_by_name(self, client: Agentex) -> None: ) task_stream.response.close() - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_stream_events_by_name(self, client: Agentex) -> None: response = client.tasks.with_raw_response.stream_events_by_name( @@ -311,7 +518,7 @@ def test_raw_response_stream_events_by_name(self, client: Agentex) -> None: stream = response.parse() stream.close() - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_stream_events_by_name(self, client: Agentex) -> None: with client.tasks.with_streaming_response.stream_events_by_name( @@ -325,7 +532,7 @@ def test_streaming_response_stream_events_by_name(self, client: Agentex) -> None assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_stream_events_by_name(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_name` but received ''"): @@ -333,13 +540,217 @@ def test_path_params_stream_events_by_name(self, client: Agentex) -> None: "", ) + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_terminate(self, client: Agentex) -> None: + task = client.tasks.terminate( + task_id="task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_terminate_with_all_params(self, client: Agentex) -> None: + task = client.tasks.terminate( + task_id="task_id", + reason="reason", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_terminate(self, client: Agentex) -> None: + response = client.tasks.with_raw_response.terminate( + task_id="task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_terminate(self, client: Agentex) -> None: + with client.tasks.with_streaming_response.terminate( + task_id="task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_terminate(self, client: Agentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + client.tasks.with_raw_response.terminate( + task_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_timeout(self, client: Agentex) -> None: + task = client.tasks.timeout( + task_id="task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_timeout_with_all_params(self, client: Agentex) -> None: + task = client.tasks.timeout( + task_id="task_id", + reason="reason", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_timeout(self, client: Agentex) -> None: + response = client.tasks.with_raw_response.timeout( + task_id="task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_timeout(self, client: Agentex) -> None: + with client.tasks.with_streaming_response.timeout( + task_id="task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_timeout(self, client: Agentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + client.tasks.with_raw_response.timeout( + task_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update_by_id(self, client: Agentex) -> None: + task = client.tasks.update_by_id( + task_id="task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update_by_id_with_all_params(self, client: Agentex) -> None: + task = client.tasks.update_by_id( + task_id="task_id", + task_metadata={"foo": "bar"}, + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_update_by_id(self, client: Agentex) -> None: + response = client.tasks.with_raw_response.update_by_id( + task_id="task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_update_by_id(self, client: Agentex) -> None: + with client.tasks.with_streaming_response.update_by_id( + task_id="task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_update_by_id(self, client: Agentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + client.tasks.with_raw_response.update_by_id( + task_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update_by_name(self, client: Agentex) -> None: + task = client.tasks.update_by_name( + task_name="task_name", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_update_by_name_with_all_params(self, client: Agentex) -> None: + task = client.tasks.update_by_name( + task_name="task_name", + task_metadata={"foo": "bar"}, + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_update_by_name(self, client: Agentex) -> None: + response = client.tasks.with_raw_response.update_by_name( + task_name="task_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_update_by_name(self, client: Agentex) -> None: + with client.tasks.with_streaming_response.update_by_name( + task_name="task_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_update_by_name(self, client: Agentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_name` but received ''"): + client.tasks.with_raw_response.update_by_name( + task_name="", + ) + class TestAsyncTasks: parametrize = pytest.mark.parametrize( "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: task = await async_client.tasks.retrieve( @@ -347,7 +758,7 @@ async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(TaskRetrieveResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve_with_all_params(self, async_client: AsyncAgentex) -> None: task = await async_client.tasks.retrieve( @@ -356,7 +767,7 @@ async def test_method_retrieve_with_all_params(self, async_client: AsyncAgentex) ) assert_matches_type(TaskRetrieveResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: response = await async_client.tasks.with_raw_response.retrieve( @@ -368,7 +779,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: task = await response.parse() assert_matches_type(TaskRetrieveResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> None: async with async_client.tasks.with_streaming_response.retrieve( @@ -382,7 +793,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): @@ -390,13 +801,13 @@ async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: task_id="", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize 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(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> None: task = await async_client.tasks.list( @@ -410,7 +821,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> ) assert_matches_type(TaskListResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: response = await async_client.tasks.with_raw_response.list() @@ -420,7 +831,7 @@ async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: task = await response.parse() assert_matches_type(TaskListResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_list(self, async_client: AsyncAgentex) -> None: async with async_client.tasks.with_streaming_response.list() as response: @@ -432,7 +843,7 @@ async def test_streaming_response_list(self, async_client: AsyncAgentex) -> None assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_delete(self, async_client: AsyncAgentex) -> None: task = await async_client.tasks.delete( @@ -440,7 +851,7 @@ async def test_method_delete(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(DeleteResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_delete(self, async_client: AsyncAgentex) -> None: response = await async_client.tasks.with_raw_response.delete( @@ -452,7 +863,7 @@ async def test_raw_response_delete(self, async_client: AsyncAgentex) -> None: task = await response.parse() assert_matches_type(DeleteResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_delete(self, async_client: AsyncAgentex) -> None: async with async_client.tasks.with_streaming_response.delete( @@ -466,7 +877,7 @@ async def test_streaming_response_delete(self, async_client: AsyncAgentex) -> No assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_delete(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): @@ -474,7 +885,109 @@ async def test_path_params_delete(self, async_client: AsyncAgentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_cancel(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.cancel( + task_id="task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_cancel_with_all_params(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.cancel( + task_id="task_id", + reason="reason", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_cancel(self, async_client: AsyncAgentex) -> None: + response = await async_client.tasks.with_raw_response.cancel( + task_id="task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_cancel(self, async_client: AsyncAgentex) -> None: + async with async_client.tasks.with_streaming_response.cancel( + task_id="task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_cancel(self, async_client: AsyncAgentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + await async_client.tasks.with_raw_response.cancel( + task_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_complete(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.complete( + task_id="task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_complete_with_all_params(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.complete( + task_id="task_id", + reason="reason", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_complete(self, async_client: AsyncAgentex) -> None: + response = await async_client.tasks.with_raw_response.complete( + task_id="task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_complete(self, async_client: AsyncAgentex) -> None: + async with async_client.tasks.with_streaming_response.complete( + task_id="task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_complete(self, async_client: AsyncAgentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + await async_client.tasks.with_raw_response.complete( + task_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_delete_by_name(self, async_client: AsyncAgentex) -> None: task = await async_client.tasks.delete_by_name( @@ -482,7 +995,7 @@ async def test_method_delete_by_name(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(DeleteResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_delete_by_name(self, async_client: AsyncAgentex) -> None: response = await async_client.tasks.with_raw_response.delete_by_name( @@ -494,7 +1007,7 @@ async def test_raw_response_delete_by_name(self, async_client: AsyncAgentex) -> task = await response.parse() assert_matches_type(DeleteResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_delete_by_name(self, async_client: AsyncAgentex) -> None: async with async_client.tasks.with_streaming_response.delete_by_name( @@ -508,7 +1021,7 @@ async def test_streaming_response_delete_by_name(self, async_client: AsyncAgente assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_delete_by_name(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_name` but received ''"): @@ -516,7 +1029,110 @@ async def test_path_params_delete_by_name(self, async_client: AsyncAgentex) -> N "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_fail(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.fail( + task_id="task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_fail_with_all_params(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.fail( + task_id="task_id", + reason="reason", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_fail(self, async_client: AsyncAgentex) -> None: + response = await async_client.tasks.with_raw_response.fail( + task_id="task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_fail(self, async_client: AsyncAgentex) -> None: + async with async_client.tasks.with_streaming_response.fail( + task_id="task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_fail(self, async_client: AsyncAgentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + await async_client.tasks.with_raw_response.fail( + task_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_query_workflow(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.query_workflow( + query_name="query_name", + task_id="task_id", + ) + assert_matches_type(TaskQueryWorkflowResponse, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_query_workflow(self, async_client: AsyncAgentex) -> None: + response = await async_client.tasks.with_raw_response.query_workflow( + query_name="query_name", + task_id="task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert_matches_type(TaskQueryWorkflowResponse, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_query_workflow(self, async_client: AsyncAgentex) -> None: + async with async_client.tasks.with_streaming_response.query_workflow( + query_name="query_name", + task_id="task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert_matches_type(TaskQueryWorkflowResponse, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_query_workflow(self, async_client: AsyncAgentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + await async_client.tasks.with_raw_response.query_workflow( + query_name="query_name", + task_id="", + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `query_name` but received ''"): + await async_client.tasks.with_raw_response.query_workflow( + query_name="", + task_id="task_id", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve_by_name(self, async_client: AsyncAgentex) -> None: task = await async_client.tasks.retrieve_by_name( @@ -524,7 +1140,7 @@ async def test_method_retrieve_by_name(self, async_client: AsyncAgentex) -> None ) assert_matches_type(TaskRetrieveByNameResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve_by_name_with_all_params(self, async_client: AsyncAgentex) -> None: task = await async_client.tasks.retrieve_by_name( @@ -533,7 +1149,7 @@ async def test_method_retrieve_by_name_with_all_params(self, async_client: Async ) assert_matches_type(TaskRetrieveByNameResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_retrieve_by_name(self, async_client: AsyncAgentex) -> None: response = await async_client.tasks.with_raw_response.retrieve_by_name( @@ -545,7 +1161,7 @@ async def test_raw_response_retrieve_by_name(self, async_client: AsyncAgentex) - task = await response.parse() assert_matches_type(TaskRetrieveByNameResponse, task, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_retrieve_by_name(self, async_client: AsyncAgentex) -> None: async with async_client.tasks.with_streaming_response.retrieve_by_name( @@ -559,7 +1175,7 @@ async def test_streaming_response_retrieve_by_name(self, async_client: AsyncAgen assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_retrieve_by_name(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_name` but received ''"): @@ -567,7 +1183,7 @@ async def test_path_params_retrieve_by_name(self, async_client: AsyncAgentex) -> task_name="", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_stream_events(self, async_client: AsyncAgentex) -> None: task_stream = await async_client.tasks.stream_events( @@ -575,7 +1191,7 @@ async def test_method_stream_events(self, async_client: AsyncAgentex) -> None: ) await task_stream.response.aclose() - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_stream_events(self, async_client: AsyncAgentex) -> None: response = await async_client.tasks.with_raw_response.stream_events( @@ -586,7 +1202,7 @@ async def test_raw_response_stream_events(self, async_client: AsyncAgentex) -> N stream = await response.parse() await stream.close() - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_stream_events(self, async_client: AsyncAgentex) -> None: async with async_client.tasks.with_streaming_response.stream_events( @@ -600,7 +1216,7 @@ async def test_streaming_response_stream_events(self, async_client: AsyncAgentex assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_stream_events(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): @@ -608,7 +1224,7 @@ async def test_path_params_stream_events(self, async_client: AsyncAgentex) -> No "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_stream_events_by_name(self, async_client: AsyncAgentex) -> None: task_stream = await async_client.tasks.stream_events_by_name( @@ -616,7 +1232,7 @@ async def test_method_stream_events_by_name(self, async_client: AsyncAgentex) -> ) await task_stream.response.aclose() - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_stream_events_by_name(self, async_client: AsyncAgentex) -> None: response = await async_client.tasks.with_raw_response.stream_events_by_name( @@ -627,7 +1243,7 @@ async def test_raw_response_stream_events_by_name(self, async_client: AsyncAgent stream = await response.parse() await stream.close() - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_stream_events_by_name(self, async_client: AsyncAgentex) -> None: async with async_client.tasks.with_streaming_response.stream_events_by_name( @@ -641,10 +1257,214 @@ async def test_streaming_response_stream_events_by_name(self, async_client: Asyn assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_stream_events_by_name(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_name` but received ''"): await async_client.tasks.with_raw_response.stream_events_by_name( "", ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_terminate(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.terminate( + task_id="task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_terminate_with_all_params(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.terminate( + task_id="task_id", + reason="reason", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_terminate(self, async_client: AsyncAgentex) -> None: + response = await async_client.tasks.with_raw_response.terminate( + task_id="task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_terminate(self, async_client: AsyncAgentex) -> None: + async with async_client.tasks.with_streaming_response.terminate( + task_id="task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_terminate(self, async_client: AsyncAgentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + await async_client.tasks.with_raw_response.terminate( + task_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_timeout(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.timeout( + task_id="task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_timeout_with_all_params(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.timeout( + task_id="task_id", + reason="reason", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_timeout(self, async_client: AsyncAgentex) -> None: + response = await async_client.tasks.with_raw_response.timeout( + task_id="task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_timeout(self, async_client: AsyncAgentex) -> None: + async with async_client.tasks.with_streaming_response.timeout( + task_id="task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_timeout(self, async_client: AsyncAgentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + await async_client.tasks.with_raw_response.timeout( + task_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update_by_id(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.update_by_id( + task_id="task_id", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update_by_id_with_all_params(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.update_by_id( + task_id="task_id", + task_metadata={"foo": "bar"}, + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_update_by_id(self, async_client: AsyncAgentex) -> None: + response = await async_client.tasks.with_raw_response.update_by_id( + task_id="task_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_update_by_id(self, async_client: AsyncAgentex) -> None: + async with async_client.tasks.with_streaming_response.update_by_id( + task_id="task_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_update_by_id(self, async_client: AsyncAgentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_id` but received ''"): + await async_client.tasks.with_raw_response.update_by_id( + task_id="", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update_by_name(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.update_by_name( + task_name="task_name", + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_update_by_name_with_all_params(self, async_client: AsyncAgentex) -> None: + task = await async_client.tasks.update_by_name( + task_name="task_name", + task_metadata={"foo": "bar"}, + ) + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_update_by_name(self, async_client: AsyncAgentex) -> None: + response = await async_client.tasks.with_raw_response.update_by_name( + task_name="task_name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_update_by_name(self, async_client: AsyncAgentex) -> None: + async with async_client.tasks.with_streaming_response.update_by_name( + task_name="task_name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + task = await response.parse() + assert_matches_type(Task, task, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_update_by_name(self, async_client: AsyncAgentex) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `task_name` but received ''"): + await async_client.tasks.with_raw_response.update_by_name( + task_name="", + ) diff --git a/tests/api_resources/test_tracker.py b/tests/api_resources/test_tracker.py index ae4a3a918..d56f4b6db 100644 --- a/tests/api_resources/test_tracker.py +++ b/tests/api_resources/test_tracker.py @@ -18,7 +18,7 @@ class TestTracker: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_retrieve(self, client: Agentex) -> None: tracker = client.tracker.retrieve( @@ -26,7 +26,7 @@ def test_method_retrieve(self, client: Agentex) -> None: ) assert_matches_type(AgentTaskTracker, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_retrieve(self, client: Agentex) -> None: response = client.tracker.with_raw_response.retrieve( @@ -38,7 +38,7 @@ def test_raw_response_retrieve(self, client: Agentex) -> None: tracker = response.parse() assert_matches_type(AgentTaskTracker, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_retrieve(self, client: Agentex) -> None: with client.tracker.with_streaming_response.retrieve( @@ -52,7 +52,7 @@ def test_streaming_response_retrieve(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_retrieve(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `tracker_id` but received ''"): @@ -60,7 +60,7 @@ def test_path_params_retrieve(self, client: Agentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_update(self, client: Agentex) -> None: tracker = client.tracker.update( @@ -68,7 +68,7 @@ def test_method_update(self, client: Agentex) -> None: ) assert_matches_type(AgentTaskTracker, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_update_with_all_params(self, client: Agentex) -> None: tracker = client.tracker.update( @@ -79,7 +79,7 @@ def test_method_update_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(AgentTaskTracker, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_update(self, client: Agentex) -> None: response = client.tracker.with_raw_response.update( @@ -91,7 +91,7 @@ def test_raw_response_update(self, client: Agentex) -> None: tracker = response.parse() assert_matches_type(AgentTaskTracker, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_update(self, client: Agentex) -> None: with client.tracker.with_streaming_response.update( @@ -105,7 +105,7 @@ def test_streaming_response_update(self, client: Agentex) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_update(self, client: Agentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `tracker_id` but received ''"): @@ -113,13 +113,13 @@ def test_path_params_update(self, client: Agentex) -> None: tracker_id="", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list(self, client: Agentex) -> None: tracker = client.tracker.list() assert_matches_type(TrackerListResponse, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_list_with_all_params(self, client: Agentex) -> None: tracker = client.tracker.list( @@ -132,7 +132,7 @@ def test_method_list_with_all_params(self, client: Agentex) -> None: ) assert_matches_type(TrackerListResponse, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_raw_response_list(self, client: Agentex) -> None: response = client.tracker.with_raw_response.list() @@ -142,7 +142,7 @@ def test_raw_response_list(self, client: Agentex) -> None: tracker = response.parse() assert_matches_type(TrackerListResponse, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_streaming_response_list(self, client: Agentex) -> None: with client.tracker.with_streaming_response.list() as response: @@ -160,7 +160,7 @@ class TestAsyncTracker: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: tracker = await async_client.tracker.retrieve( @@ -168,7 +168,7 @@ async def test_method_retrieve(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(AgentTaskTracker, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: response = await async_client.tracker.with_raw_response.retrieve( @@ -180,7 +180,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncAgentex) -> None: tracker = await response.parse() assert_matches_type(AgentTaskTracker, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> None: async with async_client.tracker.with_streaming_response.retrieve( @@ -194,7 +194,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncAgentex) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `tracker_id` but received ''"): @@ -202,7 +202,7 @@ async def test_path_params_retrieve(self, async_client: AsyncAgentex) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_update(self, async_client: AsyncAgentex) -> None: tracker = await async_client.tracker.update( @@ -210,7 +210,7 @@ async def test_method_update(self, async_client: AsyncAgentex) -> None: ) assert_matches_type(AgentTaskTracker, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_update_with_all_params(self, async_client: AsyncAgentex) -> None: tracker = await async_client.tracker.update( @@ -221,7 +221,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncAgentex) - ) assert_matches_type(AgentTaskTracker, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_update(self, async_client: AsyncAgentex) -> None: response = await async_client.tracker.with_raw_response.update( @@ -233,7 +233,7 @@ async def test_raw_response_update(self, async_client: AsyncAgentex) -> None: tracker = await response.parse() assert_matches_type(AgentTaskTracker, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_update(self, async_client: AsyncAgentex) -> None: async with async_client.tracker.with_streaming_response.update( @@ -247,7 +247,7 @@ async def test_streaming_response_update(self, async_client: AsyncAgentex) -> No assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_update(self, async_client: AsyncAgentex) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `tracker_id` but received ''"): @@ -255,13 +255,13 @@ async def test_path_params_update(self, async_client: AsyncAgentex) -> None: tracker_id="", ) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list(self, async_client: AsyncAgentex) -> None: tracker = await async_client.tracker.list() assert_matches_type(TrackerListResponse, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> None: tracker = await async_client.tracker.list( @@ -274,7 +274,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncAgentex) -> ) assert_matches_type(TrackerListResponse, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: response = await async_client.tracker.with_raw_response.list() @@ -284,7 +284,7 @@ async def test_raw_response_list(self, async_client: AsyncAgentex) -> None: tracker = await response.parse() assert_matches_type(TrackerListResponse, tracker, path=["response"]) - @pytest.mark.skip(reason="Prism tests are disabled") + @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_streaming_response_list(self, async_client: AsyncAgentex) -> None: async with async_client.tracker.with_streaming_response.list() as response: diff --git a/tests/test_client.py b/tests/test_client.py index 6e709e654..c13db7d12 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -955,6 +955,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + # Delete in case our environment has any proxy env vars set + monkeypatch.delenv("HTTP_PROXY", raising=False) + monkeypatch.delenv("ALL_PROXY", raising=False) + monkeypatch.delenv("NO_PROXY", raising=False) + monkeypatch.delenv("http_proxy", raising=False) + monkeypatch.delenv("https_proxy", raising=False) + monkeypatch.delenv("all_proxy", raising=False) + monkeypatch.delenv("no_proxy", raising=False) client = DefaultHttpxClient() @@ -1912,6 +1920,14 @@ async def test_main() -> None: async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + # Delete in case our environment has any proxy env vars set + monkeypatch.delenv("HTTP_PROXY", raising=False) + monkeypatch.delenv("ALL_PROXY", raising=False) + monkeypatch.delenv("NO_PROXY", raising=False) + monkeypatch.delenv("http_proxy", raising=False) + monkeypatch.delenv("https_proxy", raising=False) + monkeypatch.delenv("all_proxy", raising=False) + monkeypatch.delenv("no_proxy", raising=False) client = DefaultAsyncHttpxClient() diff --git a/tests/test_utils/test_path.py b/tests/test_utils/test_path.py new file mode 100644 index 000000000..fdc41f1f8 --- /dev/null +++ b/tests/test_utils/test_path.py @@ -0,0 +1,89 @@ +from __future__ import annotations + +from typing import Any + +import pytest + +from agentex._utils._path import path_template + + +@pytest.mark.parametrize( + "template, kwargs, expected", + [ + ("/v1/{id}", dict(id="abc"), "/v1/abc"), + ("/v1/{a}/{b}", dict(a="x", b="y"), "/v1/x/y"), + ("/v1/{a}{b}/path/{c}?val={d}#{e}", dict(a="x", b="y", c="z", d="u", e="v"), "/v1/xy/path/z?val=u#v"), + ("/{w}/{w}", dict(w="echo"), "/echo/echo"), + ("/v1/static", {}, "/v1/static"), + ("", {}, ""), + ("/v1/?q={n}&count=10", dict(n=42), "/v1/?q=42&count=10"), + ("/v1/{v}", dict(v=None), "/v1/null"), + ("/v1/{v}", dict(v=True), "/v1/true"), + ("/v1/{v}", dict(v=False), "/v1/false"), + ("/v1/{v}", dict(v=".hidden"), "/v1/.hidden"), # dot prefix ok + ("/v1/{v}", dict(v="file.txt"), "/v1/file.txt"), # dot in middle ok + ("/v1/{v}", dict(v="..."), "/v1/..."), # triple dot ok + ("/v1/{a}{b}", dict(a=".", b="txt"), "/v1/.txt"), # dot var combining with adjacent to be ok + ("/items?q={v}#{f}", dict(v=".", f=".."), "/items?q=.#.."), # dots in query/fragment are fine + ( + "/v1/{a}?query={b}", + dict(a="../../other/endpoint", b="a&bad=true"), + "/v1/..%2F..%2Fother%2Fendpoint?query=a%26bad%3Dtrue", + ), + ("/v1/{val}", dict(val="a/b/c"), "/v1/a%2Fb%2Fc"), + ("/v1/{val}", dict(val="a/b/c?query=value"), "/v1/a%2Fb%2Fc%3Fquery=value"), + ("/v1/{val}", dict(val="a/b/c?query=value&bad=true"), "/v1/a%2Fb%2Fc%3Fquery=value&bad=true"), + ("/v1/{val}", dict(val="%20"), "/v1/%2520"), # escapes escape sequences in input + # Query: slash and ? are safe, # is not + ("/items?q={v}", dict(v="a/b"), "/items?q=a/b"), + ("/items?q={v}", dict(v="a?b"), "/items?q=a?b"), + ("/items?q={v}", dict(v="a#b"), "/items?q=a%23b"), + ("/items?q={v}", dict(v="a b"), "/items?q=a%20b"), + # Fragment: slash and ? are safe + ("/docs#{v}", dict(v="a/b"), "/docs#a/b"), + ("/docs#{v}", dict(v="a?b"), "/docs#a?b"), + # Path: slash, ? and # are all encoded + ("/v1/{v}", dict(v="a/b"), "/v1/a%2Fb"), + ("/v1/{v}", dict(v="a?b"), "/v1/a%3Fb"), + ("/v1/{v}", dict(v="a#b"), "/v1/a%23b"), + # same var encoded differently by component + ( + "/v1/{v}?q={v}#{v}", + dict(v="a/b?c#d"), + "/v1/a%2Fb%3Fc%23d?q=a/b?c%23d#a/b?c%23d", + ), + ("/v1/{val}", dict(val="x?admin=true"), "/v1/x%3Fadmin=true"), # query injection + ("/v1/{val}", dict(val="x#admin"), "/v1/x%23admin"), # fragment injection + ], +) +def test_interpolation(template: str, kwargs: dict[str, Any], expected: str) -> None: + assert path_template(template, **kwargs) == expected + + +def test_missing_kwarg_raises_key_error() -> None: + with pytest.raises(KeyError, match="org_id"): + path_template("/v1/{org_id}") + + +@pytest.mark.parametrize( + "template, kwargs", + [ + ("{a}/path", dict(a=".")), + ("{a}/path", dict(a="..")), + ("/v1/{a}", dict(a=".")), + ("/v1/{a}", dict(a="..")), + ("/v1/{a}/path", dict(a=".")), + ("/v1/{a}/path", dict(a="..")), + ("/v1/{a}{b}", dict(a=".", b=".")), # adjacent vars → ".." + ("/v1/{a}.", dict(a=".")), # var + static → ".." + ("/v1/{a}{b}", dict(a="", b=".")), # empty + dot → "." + ("/v1/%2e/{x}", dict(x="ok")), # encoded dot in static text + ("/v1/%2e./{x}", dict(x="ok")), # mixed encoded ".." in static + ("/v1/.%2E/{x}", dict(x="ok")), # mixed encoded ".." in static + ("/v1/{v}?q=1", dict(v="..")), + ("/v1/{v}#frag", dict(v="..")), + ], +) +def test_dot_segment_rejected(template: str, kwargs: dict[str, Any]) -> None: + with pytest.raises(ValueError, match="dot-segment"): + path_template(template, **kwargs)