diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index a713055..d52d2b9 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.12.0"
+ ".": "0.13.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 2cb0b3b..8a04b2b 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 22
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta/warp-api-1fecc5f5d6ee664d804b81bd1aa6eec4d3f170ffa788d214fead4f7e95ab9d4e.yml
-openapi_spec_hash: 82990b03bd5a93e45bfc79db56ae7fc0
-config_hash: f52e7636f248f25c4ea0b086e7326816
+configured_endpoints: 23
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta/warp-api-d662aff074fd108261bcfc38540e31dbbbd86c4e94a798ebe58714650c21cb87.yml
+openapi_spec_hash: 7065b44212d19f637200a4b5da97c2e2
+config_hash: 5a6e285f6e3a958a887b31b972a3f49c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4431ffa..3c2aa5a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,25 @@
# Changelog
+## 0.13.0 (2026-05-11)
+
+Full Changelog: [v0.12.0...v0.13.0](https://github.com/warpdotdev/oz-sdk-python/compare/v0.12.0...v0.13.0)
+
+### Features
+
+* **agents:** add prompt property to agent identity data model ([520c835](https://github.com/warpdotdev/oz-sdk-python/commit/520c8350b5b7850242adc082fe83a7ae666e6da6))
+* **api:** api update ([2730eea](https://github.com/warpdotdev/oz-sdk-python/commit/2730eea19d91df998de5ef1b5da4989670a5889a))
+* **api:** api update ([af81ef3](https://github.com/warpdotdev/oz-sdk-python/commit/af81ef3a2d48f378209cf69a3074997cb02b1b6c))
+* **api:** api update ([99b2d31](https://github.com/warpdotdev/oz-sdk-python/commit/99b2d31ba1a4c2c3d79fc11c5eb8d611c55613b8))
+* **internal/types:** support eagerly validating pydantic iterators ([a588f0e](https://github.com/warpdotdev/oz-sdk-python/commit/a588f0e5ba27503659b5abf01d0ebc01f652950d))
+* **memory:** agent identity memory store attachments — API layer ([94b5348](https://github.com/warpdotdev/oz-sdk-python/commit/94b5348152c6b0bfb03b0d3887366c4a65e397fb))
+* **memory:** wire memory stores into run pipeline and add listing endpoint ([6bb74c2](https://github.com/warpdotdev/oz-sdk-python/commit/6bb74c2b695cd268fe8466fc6099f082370ba54e))
+* Retrieve memories in third party harnesses ([7689e12](https://github.com/warpdotdev/oz-sdk-python/commit/7689e121d6f22efad3d81828721f8ed900b9cd28))
+
+
+### Bug Fixes
+
+* **client:** add missing f-string prefix in file type error message ([17a8e5b](https://github.com/warpdotdev/oz-sdk-python/commit/17a8e5bf17b882a440a067fee1569caf679f8b55))
+
## 0.12.0 (2026-05-07)
Full Changelog: [v0.11.0...v0.12.0](https://github.com/warpdotdev/oz-sdk-python/compare/v0.11.0...v0.12.0)
diff --git a/api.md b/api.md
index bd33474..e82443c 100644
--- a/api.md
+++ b/api.md
@@ -94,6 +94,7 @@ Methods:
- client.agent.agent.update(uid, \*\*params) -> AgentResponse
- client.agent.agent.list() -> ListAgentIdentitiesResponse
- client.agent.agent.delete(uid) -> None
+- client.agent.agent.get(uid) -> AgentResponse
## Sessions
diff --git a/pyproject.toml b/pyproject.toml
index 367b68a..533a8e4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
[project]
name = "oz-agent-sdk"
-version = "0.12.0"
+version = "0.13.0"
description = "The official Python library for the oz-api API"
dynamic = ["readme"]
license = "Apache-2.0"
diff --git a/src/oz_agent_sdk/_files.py b/src/oz_agent_sdk/_files.py
index 0fdce17..76da9e0 100644
--- a/src/oz_agent_sdk/_files.py
+++ b/src/oz_agent_sdk/_files.py
@@ -99,7 +99,7 @@ async def async_to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles
elif is_sequence_t(files):
files = [(key, await _async_transform_file(file)) for key, file in files]
else:
- raise TypeError("Unexpected file type input {type(files)}, expected mapping or sequence")
+ raise TypeError(f"Unexpected file type input {type(files)}, expected mapping or sequence")
return files
diff --git a/src/oz_agent_sdk/_models.py b/src/oz_agent_sdk/_models.py
index e22dd2a..69f41a6 100644
--- a/src/oz_agent_sdk/_models.py
+++ b/src/oz_agent_sdk/_models.py
@@ -25,7 +25,9 @@
ClassVar,
Protocol,
Required,
+ Annotated,
ParamSpec,
+ TypeAlias,
TypedDict,
TypeGuard,
final,
@@ -79,7 +81,15 @@
from ._constants import RAW_RESPONSE_HEADER
if TYPE_CHECKING:
+ from pydantic import GetCoreSchemaHandler, ValidatorFunctionWrapHandler
+ from pydantic_core import CoreSchema, core_schema
from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema
+else:
+ try:
+ from pydantic_core import CoreSchema, core_schema
+ except ImportError:
+ CoreSchema = None
+ core_schema = None
__all__ = ["BaseModel", "GenericModel"]
@@ -396,6 +406,76 @@ def model_dump_json(
)
+class _EagerIterable(list[_T], Generic[_T]):
+ """
+ Accepts any Iterable[T] input (including generators), consumes it
+ eagerly, and validates all items upfront.
+
+ Validation preserves the original container type where possible
+ (e.g. a set[T] stays a set[T]). Serialization (model_dump / JSON)
+ always emits a list — round-tripping through model_dump() will not
+ restore the original container type.
+ """
+
+ @classmethod
+ def __get_pydantic_core_schema__(
+ cls,
+ source_type: Any,
+ handler: GetCoreSchemaHandler,
+ ) -> CoreSchema:
+ (item_type,) = get_args(source_type) or (Any,)
+ item_schema: CoreSchema = handler.generate_schema(item_type)
+ list_of_items_schema: CoreSchema = core_schema.list_schema(item_schema)
+
+ return core_schema.no_info_wrap_validator_function(
+ cls._validate,
+ list_of_items_schema,
+ serialization=core_schema.plain_serializer_function_ser_schema(
+ cls._serialize,
+ info_arg=False,
+ ),
+ )
+
+ @staticmethod
+ def _validate(v: Iterable[_T], handler: "ValidatorFunctionWrapHandler") -> Any:
+ original_type: type[Any] = type(v)
+
+ # Normalize to list so list_schema can validate each item
+ if isinstance(v, list):
+ items: list[_T] = v
+ else:
+ try:
+ items = list(v)
+ except TypeError as e:
+ raise TypeError("Value is not iterable") from e
+
+ # Validate items against the inner schema
+ validated: list[_T] = handler(items)
+
+ # Reconstruct original container type
+ if original_type is list:
+ return validated
+ # str(list) produces the list's repr, not a string built from items,
+ # so skip reconstruction for str and its subclasses.
+ if issubclass(original_type, str):
+ return validated
+ try:
+ return original_type(validated)
+ except (TypeError, ValueError):
+ # If the type cannot be reconstructed, just return the validated list
+ return validated
+
+ @staticmethod
+ def _serialize(v: Iterable[_T]) -> list[_T]:
+ """Always serialize as a list so Pydantic's JSON encoder is happy."""
+ if isinstance(v, list):
+ return v
+ return list(v)
+
+
+EagerIterable: TypeAlias = Annotated[Iterable[_T], _EagerIterable]
+
+
def _construct_field(value: object, field: FieldInfo, key: str) -> object:
if value is None:
return field_get_default(field)
diff --git a/src/oz_agent_sdk/_version.py b/src/oz_agent_sdk/_version.py
index b96fedf..1762ab1 100644
--- a/src/oz_agent_sdk/_version.py
+++ b/src/oz_agent_sdk/_version.py
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
__title__ = "oz_agent_sdk"
-__version__ = "0.12.0" # x-release-please-version
+__version__ = "0.13.0" # x-release-please-version
diff --git a/src/oz_agent_sdk/resources/agent/agent_.py b/src/oz_agent_sdk/resources/agent/agent_.py
index ab7835e..2be98e7 100644
--- a/src/oz_agent_sdk/resources/agent/agent_.py
+++ b/src/oz_agent_sdk/resources/agent/agent_.py
@@ -50,7 +50,9 @@ def create(
self,
*,
name: str,
+ base_model: Optional[str] | Omit = omit,
description: Optional[str] | Omit = omit,
+ prompt: Optional[str] | Omit = omit,
secrets: Iterable[agent_create_params.Secret] | Omit = omit,
skills: SequenceNotStr[str] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -68,8 +70,12 @@ def create(
Args:
name: A name for the agent
+ base_model: Optional base model for runs executed by this agent.
+
description: Optional description of the agent
+ prompt: Optional base prompt for this agent
+
secrets: Optional list of secrets associated with the agent. Duplicate names within a
single request are rejected. Each entry is unioned into the run-time secret
scope when the agent executes.
@@ -94,7 +100,9 @@ def create(
body=maybe_transform(
{
"name": name,
+ "base_model": base_model,
"description": description,
+ "prompt": prompt,
"secrets": secrets,
"skills": skills,
},
@@ -110,8 +118,10 @@ def update(
self,
uid: str,
*,
+ base_model: Optional[str] | Omit = omit,
description: Optional[str] | Omit = omit,
name: str | Omit = omit,
+ prompt: Optional[str] | Omit = omit,
secrets: Optional[Iterable[agent_update_params.Secret]] | Omit = omit,
skills: Optional[SequenceNotStr[str]] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -124,13 +134,19 @@ def update(
"""Update an existing agent.
Args:
- description: Replacement description.
+ base_model: Replacement base model.
+
+ Omit or pass `null` to leave unchanged, or pass an empty
+ string to clear.
- Omit or pass `null` to leave unchanged, or use an empty
+ description: Replacement description. Omit or pass `null` to leave unchanged, or use an empty
value to clear.
name: The new name for the agent
+ prompt: Replacement prompt. Omit or pass `null` to leave unchanged, or use an empty
+ value to clear.
+
secrets: Replacement list of secrets. Omit to leave unchanged, pass an empty array to
clear, or pass a non-empty array to replace. Duplicate names are rejected.
@@ -151,8 +167,10 @@ def update(
path_template("/agent/identities/{uid}", uid=uid),
body=maybe_transform(
{
+ "base_model": base_model,
"description": description,
"name": name,
+ "prompt": prompt,
"secrets": secrets,
"skills": skills,
},
@@ -222,6 +240,42 @@ def delete(
cast_to=NoneType,
)
+ def get(
+ self,
+ uid: 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,
+ ) -> AgentResponse:
+ """Retrieve a single agent by its unique identifier.
+
+ The response includes an
+ `available` flag indicating whether the agent is within the team's plan limit
+ and may be used for runs.
+
+ 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 uid:
+ raise ValueError(f"Expected a non-empty value for `uid` but received {uid!r}")
+ return self._get(
+ path_template("/agent/identities/{uid}", uid=uid),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=AgentResponse,
+ )
+
class AsyncAgentResource(AsyncAPIResource):
"""Operations for running and managing cloud agents"""
@@ -249,7 +303,9 @@ async def create(
self,
*,
name: str,
+ base_model: Optional[str] | Omit = omit,
description: Optional[str] | Omit = omit,
+ prompt: Optional[str] | Omit = omit,
secrets: Iterable[agent_create_params.Secret] | Omit = omit,
skills: SequenceNotStr[str] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -267,8 +323,12 @@ async def create(
Args:
name: A name for the agent
+ base_model: Optional base model for runs executed by this agent.
+
description: Optional description of the agent
+ prompt: Optional base prompt for this agent
+
secrets: Optional list of secrets associated with the agent. Duplicate names within a
single request are rejected. Each entry is unioned into the run-time secret
scope when the agent executes.
@@ -293,7 +353,9 @@ async def create(
body=await async_maybe_transform(
{
"name": name,
+ "base_model": base_model,
"description": description,
+ "prompt": prompt,
"secrets": secrets,
"skills": skills,
},
@@ -309,8 +371,10 @@ async def update(
self,
uid: str,
*,
+ base_model: Optional[str] | Omit = omit,
description: Optional[str] | Omit = omit,
name: str | Omit = omit,
+ prompt: Optional[str] | Omit = omit,
secrets: Optional[Iterable[agent_update_params.Secret]] | Omit = omit,
skills: Optional[SequenceNotStr[str]] | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -323,13 +387,19 @@ async def update(
"""Update an existing agent.
Args:
- description: Replacement description.
+ base_model: Replacement base model.
- Omit or pass `null` to leave unchanged, or use an empty
+ Omit or pass `null` to leave unchanged, or pass an empty
+ string to clear.
+
+ description: Replacement description. Omit or pass `null` to leave unchanged, or use an empty
value to clear.
name: The new name for the agent
+ prompt: Replacement prompt. Omit or pass `null` to leave unchanged, or use an empty
+ value to clear.
+
secrets: Replacement list of secrets. Omit to leave unchanged, pass an empty array to
clear, or pass a non-empty array to replace. Duplicate names are rejected.
@@ -350,8 +420,10 @@ async def update(
path_template("/agent/identities/{uid}", uid=uid),
body=await async_maybe_transform(
{
+ "base_model": base_model,
"description": description,
"name": name,
+ "prompt": prompt,
"secrets": secrets,
"skills": skills,
},
@@ -421,6 +493,42 @@ async def delete(
cast_to=NoneType,
)
+ async def get(
+ self,
+ uid: 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,
+ ) -> AgentResponse:
+ """Retrieve a single agent by its unique identifier.
+
+ The response includes an
+ `available` flag indicating whether the agent is within the team's plan limit
+ and may be used for runs.
+
+ 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 uid:
+ raise ValueError(f"Expected a non-empty value for `uid` but received {uid!r}")
+ return await self._get(
+ path_template("/agent/identities/{uid}", uid=uid),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=AgentResponse,
+ )
+
class AgentResourceWithRawResponse:
def __init__(self, agent: AgentResource) -> None:
@@ -438,6 +546,9 @@ def __init__(self, agent: AgentResource) -> None:
self.delete = to_raw_response_wrapper(
agent.delete,
)
+ self.get = to_raw_response_wrapper(
+ agent.get,
+ )
class AsyncAgentResourceWithRawResponse:
@@ -456,6 +567,9 @@ def __init__(self, agent: AsyncAgentResource) -> None:
self.delete = async_to_raw_response_wrapper(
agent.delete,
)
+ self.get = async_to_raw_response_wrapper(
+ agent.get,
+ )
class AgentResourceWithStreamingResponse:
@@ -474,6 +588,9 @@ def __init__(self, agent: AgentResource) -> None:
self.delete = to_streamed_response_wrapper(
agent.delete,
)
+ self.get = to_streamed_response_wrapper(
+ agent.get,
+ )
class AsyncAgentResourceWithStreamingResponse:
@@ -492,3 +609,6 @@ def __init__(self, agent: AsyncAgentResource) -> None:
self.delete = async_to_streamed_response_wrapper(
agent.delete,
)
+ self.get = async_to_streamed_response_wrapper(
+ agent.get,
+ )
diff --git a/src/oz_agent_sdk/types/agent/agent_create_params.py b/src/oz_agent_sdk/types/agent/agent_create_params.py
index 5f31e19..2cff9e1 100644
--- a/src/oz_agent_sdk/types/agent/agent_create_params.py
+++ b/src/oz_agent_sdk/types/agent/agent_create_params.py
@@ -14,9 +14,15 @@ class AgentCreateParams(TypedDict, total=False):
name: Required[str]
"""A name for the agent"""
+ base_model: Optional[str]
+ """Optional base model for runs executed by this agent."""
+
description: Optional[str]
"""Optional description of the agent"""
+ prompt: Optional[str]
+ """Optional base prompt for this agent"""
+
secrets: Iterable[Secret]
"""
Optional list of secrets associated with the agent. Duplicate names within a
diff --git a/src/oz_agent_sdk/types/agent/agent_response.py b/src/oz_agent_sdk/types/agent/agent_response.py
index 8b46c85..4713b5f 100644
--- a/src/oz_agent_sdk/types/agent/agent_response.py
+++ b/src/oz_agent_sdk/types/agent/agent_response.py
@@ -37,5 +37,18 @@ class AgentResponse(BaseModel):
uid: str
"""Unique identifier for the agent"""
+ base_model: Optional[str] = None
+ """Base model for runs executed by this agent.
+
+ The precedence order for model resolution is:
+
+ 1. The model specified on the run itself
+ 2. The agent's base model
+ 3. The team's default model
+ """
+
description: Optional[str] = None
"""Optional description of the agent"""
+
+ prompt: Optional[str] = None
+ """Optional base prompt for this agent"""
diff --git a/src/oz_agent_sdk/types/agent/agent_update_params.py b/src/oz_agent_sdk/types/agent/agent_update_params.py
index d3cc68a..a918697 100644
--- a/src/oz_agent_sdk/types/agent/agent_update_params.py
+++ b/src/oz_agent_sdk/types/agent/agent_update_params.py
@@ -11,6 +11,12 @@
class AgentUpdateParams(TypedDict, total=False):
+ base_model: Optional[str]
+ """Replacement base model.
+
+ Omit or pass `null` to leave unchanged, or pass an empty string to clear.
+ """
+
description: Optional[str]
"""Replacement description.
@@ -20,6 +26,12 @@ class AgentUpdateParams(TypedDict, total=False):
name: str
"""The new name for the agent"""
+ prompt: Optional[str]
+ """Replacement prompt.
+
+ Omit or pass `null` to leave unchanged, or use an empty value to clear.
+ """
+
secrets: Optional[Iterable[Secret]]
"""Replacement list of secrets.
diff --git a/src/oz_agent_sdk/types/agent/run_item.py b/src/oz_agent_sdk/types/agent/run_item.py
index 5b802d8..4293ce2 100644
--- a/src/oz_agent_sdk/types/agent/run_item.py
+++ b/src/oz_agent_sdk/types/agent/run_item.py
@@ -44,6 +44,9 @@ class RequestUsage(BaseModel):
inference_cost: Optional[float] = None
"""Cost of LLM inference for the run"""
+ platform_cost: Optional[float] = None
+ """Cost of platform usage for the run"""
+
class Schedule(BaseModel):
"""
diff --git a/src/oz_agent_sdk/types/agent/scheduled_agent_item.py b/src/oz_agent_sdk/types/agent/scheduled_agent_item.py
index d307d25..d66ddfa 100644
--- a/src/oz_agent_sdk/types/agent/scheduled_agent_item.py
+++ b/src/oz_agent_sdk/types/agent/scheduled_agent_item.py
@@ -41,9 +41,6 @@ class ScheduledAgentItem(BaseModel):
agent_config: Optional[AmbientAgentConfig] = None
"""Configuration for a cloud agent run"""
- agent_uid: Optional[str] = None
- """UID of the agent that this schedule runs as"""
-
created_by: Optional[UserProfile] = None
environment: Optional[CloudEnvironmentConfig] = None
diff --git a/tests/api_resources/agent/test_agent_.py b/tests/api_resources/agent/test_agent_.py
index a23b05e..86fce6e 100644
--- a/tests/api_resources/agent/test_agent_.py
+++ b/tests/api_resources/agent/test_agent_.py
@@ -33,7 +33,9 @@ def test_method_create(self, client: OzAPI) -> None:
def test_method_create_with_all_params(self, client: OzAPI) -> None:
agent = client.agent.agent.create(
name="name",
+ base_model="base_model",
description="description",
+ prompt="prompt",
secrets=[{"name": "name"}],
skills=["string"],
)
@@ -78,8 +80,10 @@ def test_method_update(self, client: OzAPI) -> None:
def test_method_update_with_all_params(self, client: OzAPI) -> None:
agent = client.agent.agent.update(
uid="uid",
+ base_model="base_model",
description="description",
name="name",
+ prompt="prompt",
secrets=[{"name": "name"}],
skills=["string"],
)
@@ -189,6 +193,48 @@ def test_path_params_delete(self, client: OzAPI) -> None:
"",
)
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_method_get(self, client: OzAPI) -> None:
+ agent = client.agent.agent.get(
+ "uid",
+ )
+ assert_matches_type(AgentResponse, agent, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_raw_response_get(self, client: OzAPI) -> None:
+ response = client.agent.agent.with_raw_response.get(
+ "uid",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ agent = response.parse()
+ assert_matches_type(AgentResponse, agent, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_streaming_response_get(self, client: OzAPI) -> None:
+ with client.agent.agent.with_streaming_response.get(
+ "uid",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ agent = response.parse()
+ assert_matches_type(AgentResponse, agent, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ def test_path_params_get(self, client: OzAPI) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `uid` but received ''"):
+ client.agent.agent.with_raw_response.get(
+ "",
+ )
+
class TestAsyncAgent:
parametrize = pytest.mark.parametrize(
@@ -208,7 +254,9 @@ async def test_method_create(self, async_client: AsyncOzAPI) -> None:
async def test_method_create_with_all_params(self, async_client: AsyncOzAPI) -> None:
agent = await async_client.agent.agent.create(
name="name",
+ base_model="base_model",
description="description",
+ prompt="prompt",
secrets=[{"name": "name"}],
skills=["string"],
)
@@ -253,8 +301,10 @@ async def test_method_update(self, async_client: AsyncOzAPI) -> None:
async def test_method_update_with_all_params(self, async_client: AsyncOzAPI) -> None:
agent = await async_client.agent.agent.update(
uid="uid",
+ base_model="base_model",
description="description",
name="name",
+ prompt="prompt",
secrets=[{"name": "name"}],
skills=["string"],
)
@@ -363,3 +413,45 @@ async def test_path_params_delete(self, async_client: AsyncOzAPI) -> None:
await async_client.agent.agent.with_raw_response.delete(
"",
)
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_method_get(self, async_client: AsyncOzAPI) -> None:
+ agent = await async_client.agent.agent.get(
+ "uid",
+ )
+ assert_matches_type(AgentResponse, agent, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_raw_response_get(self, async_client: AsyncOzAPI) -> None:
+ response = await async_client.agent.agent.with_raw_response.get(
+ "uid",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ agent = await response.parse()
+ assert_matches_type(AgentResponse, agent, path=["response"])
+
+ @pytest.mark.skip(reason="Mock server tests are disabled")
+ @parametrize
+ async def test_streaming_response_get(self, async_client: AsyncOzAPI) -> None:
+ async with async_client.agent.agent.with_streaming_response.get(
+ "uid",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ agent = await response.parse()
+ assert_matches_type(AgentResponse, agent, 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_get(self, async_client: AsyncOzAPI) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `uid` but received ''"):
+ await async_client.agent.agent.with_raw_response.get(
+ "",
+ )
diff --git a/tests/api_resources/agent/test_schedules.py b/tests/api_resources/agent/test_schedules.py
index 0bf7d09..0beb0e2 100644
--- a/tests/api_resources/agent/test_schedules.py
+++ b/tests/api_resources/agent/test_schedules.py
@@ -59,7 +59,7 @@ def test_method_create_with_all_params(self, client: OzAPI) -> None:
"skill_spec": "skill_spec",
"worker_host": "worker_host",
},
- agent_uid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ agent_uid="agent_uid",
enabled=True,
mode="normal",
prompt="Review open pull requests and provide feedback",
@@ -179,7 +179,7 @@ def test_method_update_with_all_params(self, client: OzAPI) -> None:
"skill_spec": "skill_spec",
"worker_host": "worker_host",
},
- agent_uid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ agent_uid="agent_uid",
mode="normal",
prompt="prompt",
)
@@ -426,7 +426,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncOzAPI) ->
"skill_spec": "skill_spec",
"worker_host": "worker_host",
},
- agent_uid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ agent_uid="agent_uid",
enabled=True,
mode="normal",
prompt="Review open pull requests and provide feedback",
@@ -546,7 +546,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncOzAPI) ->
"skill_spec": "skill_spec",
"worker_host": "worker_host",
},
- agent_uid="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ agent_uid="agent_uid",
mode="normal",
prompt="prompt",
)
diff --git a/tests/test_models.py b/tests/test_models.py
index c0b225d..ae6ec09 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -1,7 +1,8 @@
import json
-from typing import TYPE_CHECKING, Any, Dict, List, Union, Optional, cast
+from typing import TYPE_CHECKING, Any, Dict, List, Union, Iterable, Optional, cast
from datetime import datetime, timezone
-from typing_extensions import Literal, Annotated, TypeAliasType
+from collections import deque
+from typing_extensions import Literal, Annotated, TypedDict, TypeAliasType
import pytest
import pydantic
@@ -9,7 +10,7 @@
from oz_agent_sdk._utils import PropertyInfo
from oz_agent_sdk._compat import PYDANTIC_V1, parse_obj, model_dump, model_json
-from oz_agent_sdk._models import DISCRIMINATOR_CACHE, BaseModel, construct_type
+from oz_agent_sdk._models import DISCRIMINATOR_CACHE, BaseModel, EagerIterable, construct_type
class BasicModel(BaseModel):
@@ -961,3 +962,56 @@ def __getattr__(self, attr: str) -> Item: ...
assert model.a.prop == 1
assert isinstance(model.a, Item)
assert model.other == "foo"
+
+
+# NOTE: Workaround for Pydantic Iterable behavior.
+# Iterable fields are replaced with a ValidatorIterator and may be consumed
+# during serialization, which can cause subsequent dumps to return empty data.
+# See: https://github.com/pydantic/pydantic/issues/9541
+@pytest.mark.parametrize(
+ "data, expected_validated",
+ [
+ ([1, 2, 3], [1, 2, 3]),
+ ((1, 2, 3), (1, 2, 3)),
+ (set([1, 2, 3]), set([1, 2, 3])),
+ (iter([1, 2, 3]), [1, 2, 3]),
+ ([], []),
+ ((x for x in [1, 2, 3]), [1, 2, 3]),
+ (map(lambda x: x, [1, 2, 3]), [1, 2, 3]),
+ (frozenset([1, 2, 3]), frozenset([1, 2, 3])),
+ (deque([1, 2, 3]), deque([1, 2, 3])),
+ ],
+ ids=["list", "tuple", "set", "iterator", "empty", "generator", "map", "frozenset", "deque"],
+)
+@pytest.mark.skipif(PYDANTIC_V1, reason="this is only supported in pydantic v2")
+def test_iterable_construction(data: Iterable[int], expected_validated: Iterable[int]) -> None:
+ class TypeWithIterable(TypedDict):
+ items: EagerIterable[int]
+
+ class Model(BaseModel):
+ data: TypeWithIterable
+
+ m = Model.model_validate({"data": {"items": data}})
+ assert m.data["items"] == expected_validated
+
+ # Verify repeated dumps don't lose data (the original bug)
+ assert m.model_dump()["data"]["items"] == list(expected_validated)
+ assert m.model_dump()["data"]["items"] == list(expected_validated)
+
+
+@pytest.mark.skipif(PYDANTIC_V1, reason="this is only supported in pydantic v2")
+def test_iterable_construction_str_falls_back_to_list() -> None:
+ # str is iterable (over chars), but str(list_of_chars) produces the list's repr
+ # rather than reconstructing a string from items. We special-case str to fall
+ # back to list instead of attempting reconstruction.
+ class TypeWithIterable(TypedDict):
+ items: EagerIterable[str]
+
+ class Model(BaseModel):
+ data: TypeWithIterable
+
+ m = Model.model_validate({"data": {"items": "hello"}})
+
+ # falls back to list of chars rather than calling str(["h", "e", "l", "l", "o"])
+ assert m.data["items"] == ["h", "e", "l", "l", "o"]
+ assert m.model_dump()["data"]["items"] == ["h", "e", "l", "l", "o"]