Skip to content

Commit d54b3d5

Browse files
feat: Surface platform credits in the public API
1 parent beb0565 commit d54b3d5

5 files changed

Lines changed: 176 additions & 4 deletions

File tree

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 22
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta/warp-api-933dc0de5653397e66fc2618c9aeb6dc1b65bc327fe36346bb59f0bd0c25b2bd.yml
3-
openapi_spec_hash: fed1d156b2b419f2bee85db21d5870f5
4-
config_hash: ea21d91999803fd188cdbfdf2c654914
1+
configured_endpoints: 23
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/warp-bnavetta/warp-api-439930897f625c088be1b09e394f4053e45060cd2daab7454dfcf6c775cba1fb.yml
3+
openapi_spec_hash: f0382bea9210d76f906665e8a825a05b
4+
config_hash: 5a6e285f6e3a958a887b31b972a3f49c

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Methods:
9494
- <code title="put /agent/identities/{uid}">client.agent.agent.<a href="./src/oz_agent_sdk/resources/agent/agent_.py">update</a>(uid, \*\*<a href="src/oz_agent_sdk/types/agent/agent_update_params.py">params</a>) -> <a href="./src/oz_agent_sdk/types/agent/agent_response.py">AgentResponse</a></code>
9595
- <code title="get /agent/identities">client.agent.agent.<a href="./src/oz_agent_sdk/resources/agent/agent_.py">list</a>() -> <a href="./src/oz_agent_sdk/types/agent/list_agent_identities_response.py">ListAgentIdentitiesResponse</a></code>
9696
- <code title="delete /agent/identities/{uid}">client.agent.agent.<a href="./src/oz_agent_sdk/resources/agent/agent_.py">delete</a>(uid) -> None</code>
97+
- <code title="get /agent/identities/{uid}">client.agent.agent.<a href="./src/oz_agent_sdk/resources/agent/agent_.py">get</a>(uid) -> <a href="./src/oz_agent_sdk/types/agent/agent_response.py">AgentResponse</a></code>
9798

9899
## Sessions
99100

src/oz_agent_sdk/resources/agent/agent_.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,42 @@ def delete(
222222
cast_to=NoneType,
223223
)
224224

225+
def get(
226+
self,
227+
uid: str,
228+
*,
229+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
230+
# The extra values given here take precedence over values defined on the client or passed to this method.
231+
extra_headers: Headers | None = None,
232+
extra_query: Query | None = None,
233+
extra_body: Body | None = None,
234+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
235+
) -> AgentResponse:
236+
"""Retrieve a single agent by its unique identifier.
237+
238+
The response includes an
239+
`available` flag indicating whether the agent is within the team's plan limit
240+
and may be used for runs.
241+
242+
Args:
243+
extra_headers: Send extra headers
244+
245+
extra_query: Add additional query parameters to the request
246+
247+
extra_body: Add additional JSON properties to the request
248+
249+
timeout: Override the client-level default timeout for this request, in seconds
250+
"""
251+
if not uid:
252+
raise ValueError(f"Expected a non-empty value for `uid` but received {uid!r}")
253+
return self._get(
254+
path_template("/agent/identities/{uid}", uid=uid),
255+
options=make_request_options(
256+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
257+
),
258+
cast_to=AgentResponse,
259+
)
260+
225261

226262
class AsyncAgentResource(AsyncAPIResource):
227263
"""Operations for running and managing cloud agents"""
@@ -421,6 +457,42 @@ async def delete(
421457
cast_to=NoneType,
422458
)
423459

460+
async def get(
461+
self,
462+
uid: str,
463+
*,
464+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
465+
# The extra values given here take precedence over values defined on the client or passed to this method.
466+
extra_headers: Headers | None = None,
467+
extra_query: Query | None = None,
468+
extra_body: Body | None = None,
469+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
470+
) -> AgentResponse:
471+
"""Retrieve a single agent by its unique identifier.
472+
473+
The response includes an
474+
`available` flag indicating whether the agent is within the team's plan limit
475+
and may be used for runs.
476+
477+
Args:
478+
extra_headers: Send extra headers
479+
480+
extra_query: Add additional query parameters to the request
481+
482+
extra_body: Add additional JSON properties to the request
483+
484+
timeout: Override the client-level default timeout for this request, in seconds
485+
"""
486+
if not uid:
487+
raise ValueError(f"Expected a non-empty value for `uid` but received {uid!r}")
488+
return await self._get(
489+
path_template("/agent/identities/{uid}", uid=uid),
490+
options=make_request_options(
491+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
492+
),
493+
cast_to=AgentResponse,
494+
)
495+
424496

425497
class AgentResourceWithRawResponse:
426498
def __init__(self, agent: AgentResource) -> None:
@@ -438,6 +510,9 @@ def __init__(self, agent: AgentResource) -> None:
438510
self.delete = to_raw_response_wrapper(
439511
agent.delete,
440512
)
513+
self.get = to_raw_response_wrapper(
514+
agent.get,
515+
)
441516

442517

443518
class AsyncAgentResourceWithRawResponse:
@@ -456,6 +531,9 @@ def __init__(self, agent: AsyncAgentResource) -> None:
456531
self.delete = async_to_raw_response_wrapper(
457532
agent.delete,
458533
)
534+
self.get = async_to_raw_response_wrapper(
535+
agent.get,
536+
)
459537

460538

461539
class AgentResourceWithStreamingResponse:
@@ -474,6 +552,9 @@ def __init__(self, agent: AgentResource) -> None:
474552
self.delete = to_streamed_response_wrapper(
475553
agent.delete,
476554
)
555+
self.get = to_streamed_response_wrapper(
556+
agent.get,
557+
)
477558

478559

479560
class AsyncAgentResourceWithStreamingResponse:
@@ -492,3 +573,6 @@ def __init__(self, agent: AsyncAgentResource) -> None:
492573
self.delete = async_to_streamed_response_wrapper(
493574
agent.delete,
494575
)
576+
self.get = async_to_streamed_response_wrapper(
577+
agent.get,
578+
)

src/oz_agent_sdk/types/agent/run_item.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ class RequestUsage(BaseModel):
4444
inference_cost: Optional[float] = None
4545
"""Cost of LLM inference for the run"""
4646

47+
platform_cost: Optional[float] = None
48+
"""Cost of platform usage for the run"""
49+
4750

4851
class Schedule(BaseModel):
4952
"""

tests/api_resources/agent/test_agent_.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,48 @@ def test_path_params_delete(self, client: OzAPI) -> None:
189189
"",
190190
)
191191

192+
@pytest.mark.skip(reason="Mock server tests are disabled")
193+
@parametrize
194+
def test_method_get(self, client: OzAPI) -> None:
195+
agent = client.agent.agent.get(
196+
"uid",
197+
)
198+
assert_matches_type(AgentResponse, agent, path=["response"])
199+
200+
@pytest.mark.skip(reason="Mock server tests are disabled")
201+
@parametrize
202+
def test_raw_response_get(self, client: OzAPI) -> None:
203+
response = client.agent.agent.with_raw_response.get(
204+
"uid",
205+
)
206+
207+
assert response.is_closed is True
208+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
209+
agent = response.parse()
210+
assert_matches_type(AgentResponse, agent, path=["response"])
211+
212+
@pytest.mark.skip(reason="Mock server tests are disabled")
213+
@parametrize
214+
def test_streaming_response_get(self, client: OzAPI) -> None:
215+
with client.agent.agent.with_streaming_response.get(
216+
"uid",
217+
) as response:
218+
assert not response.is_closed
219+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
220+
221+
agent = response.parse()
222+
assert_matches_type(AgentResponse, agent, path=["response"])
223+
224+
assert cast(Any, response.is_closed) is True
225+
226+
@pytest.mark.skip(reason="Mock server tests are disabled")
227+
@parametrize
228+
def test_path_params_get(self, client: OzAPI) -> None:
229+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `uid` but received ''"):
230+
client.agent.agent.with_raw_response.get(
231+
"",
232+
)
233+
192234

193235
class TestAsyncAgent:
194236
parametrize = pytest.mark.parametrize(
@@ -363,3 +405,45 @@ async def test_path_params_delete(self, async_client: AsyncOzAPI) -> None:
363405
await async_client.agent.agent.with_raw_response.delete(
364406
"",
365407
)
408+
409+
@pytest.mark.skip(reason="Mock server tests are disabled")
410+
@parametrize
411+
async def test_method_get(self, async_client: AsyncOzAPI) -> None:
412+
agent = await async_client.agent.agent.get(
413+
"uid",
414+
)
415+
assert_matches_type(AgentResponse, agent, path=["response"])
416+
417+
@pytest.mark.skip(reason="Mock server tests are disabled")
418+
@parametrize
419+
async def test_raw_response_get(self, async_client: AsyncOzAPI) -> None:
420+
response = await async_client.agent.agent.with_raw_response.get(
421+
"uid",
422+
)
423+
424+
assert response.is_closed is True
425+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
426+
agent = await response.parse()
427+
assert_matches_type(AgentResponse, agent, path=["response"])
428+
429+
@pytest.mark.skip(reason="Mock server tests are disabled")
430+
@parametrize
431+
async def test_streaming_response_get(self, async_client: AsyncOzAPI) -> None:
432+
async with async_client.agent.agent.with_streaming_response.get(
433+
"uid",
434+
) as response:
435+
assert not response.is_closed
436+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
437+
438+
agent = await response.parse()
439+
assert_matches_type(AgentResponse, agent, path=["response"])
440+
441+
assert cast(Any, response.is_closed) is True
442+
443+
@pytest.mark.skip(reason="Mock server tests are disabled")
444+
@parametrize
445+
async def test_path_params_get(self, async_client: AsyncOzAPI) -> None:
446+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `uid` but received ''"):
447+
await async_client.agent.agent.with_raw_response.get(
448+
"",
449+
)

0 commit comments

Comments
 (0)