1818from ...types import agent_run_params , agent_list_params
1919from ..._types import Body , Omit , Query , Headers , NotGiven , omit , not_given
2020from ..._utils import maybe_transform , async_maybe_transform
21+ from .sessions import (
22+ SessionsResource ,
23+ AsyncSessionsResource ,
24+ SessionsResourceWithRawResponse ,
25+ AsyncSessionsResourceWithRawResponse ,
26+ SessionsResourceWithStreamingResponse ,
27+ AsyncSessionsResourceWithStreamingResponse ,
28+ )
2129from ..._compat import cached_property
2230from .schedules import (
2331 SchedulesResource ,
3846from ...types .agent_run_response import AgentRunResponse
3947from ...types .agent_list_response import AgentListResponse
4048from ...types .ambient_agent_config_param import AmbientAgentConfigParam
49+ from ...types .agent_get_artifact_response import AgentGetArtifactResponse
4150
4251__all__ = ["AgentResource" , "AsyncAgentResource" ]
4352
@@ -51,6 +60,10 @@ def runs(self) -> RunsResource:
5160 def schedules (self ) -> SchedulesResource :
5261 return SchedulesResource (self ._client )
5362
63+ @cached_property
64+ def sessions (self ) -> SessionsResource :
65+ return SessionsResource (self ._client )
66+
5467 @cached_property
5568 def with_raw_response (self ) -> AgentResourceWithRawResponse :
5669 """
@@ -126,6 +139,41 @@ def list(
126139 cast_to = AgentListResponse ,
127140 )
128141
142+ def get_artifact (
143+ self ,
144+ artifact_uid : str ,
145+ * ,
146+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
147+ # The extra values given here take precedence over values defined on the client or passed to this method.
148+ extra_headers : Headers | None = None ,
149+ extra_query : Query | None = None ,
150+ extra_body : Body | None = None ,
151+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
152+ ) -> AgentGetArtifactResponse :
153+ """Retrieve an artifact by its UUID.
154+
155+ For screenshot artifacts, returns a
156+ time-limited signed download URL.
157+
158+ Args:
159+ extra_headers: Send extra headers
160+
161+ extra_query: Add additional query parameters to the request
162+
163+ extra_body: Add additional JSON properties to the request
164+
165+ timeout: Override the client-level default timeout for this request, in seconds
166+ """
167+ if not artifact_uid :
168+ raise ValueError (f"Expected a non-empty value for `artifact_uid` but received { artifact_uid !r} " )
169+ return self ._get (
170+ f"/agent/artifacts/{ artifact_uid } " ,
171+ options = make_request_options (
172+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
173+ ),
174+ cast_to = AgentGetArtifactResponse ,
175+ )
176+
129177 def run (
130178 self ,
131179 * ,
@@ -211,6 +259,10 @@ def runs(self) -> AsyncRunsResource:
211259 def schedules (self ) -> AsyncSchedulesResource :
212260 return AsyncSchedulesResource (self ._client )
213261
262+ @cached_property
263+ def sessions (self ) -> AsyncSessionsResource :
264+ return AsyncSessionsResource (self ._client )
265+
214266 @cached_property
215267 def with_raw_response (self ) -> AsyncAgentResourceWithRawResponse :
216268 """
@@ -286,6 +338,41 @@ async def list(
286338 cast_to = AgentListResponse ,
287339 )
288340
341+ async def get_artifact (
342+ self ,
343+ artifact_uid : str ,
344+ * ,
345+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
346+ # The extra values given here take precedence over values defined on the client or passed to this method.
347+ extra_headers : Headers | None = None ,
348+ extra_query : Query | None = None ,
349+ extra_body : Body | None = None ,
350+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
351+ ) -> AgentGetArtifactResponse :
352+ """Retrieve an artifact by its UUID.
353+
354+ For screenshot artifacts, returns a
355+ time-limited signed download URL.
356+
357+ Args:
358+ extra_headers: Send extra headers
359+
360+ extra_query: Add additional query parameters to the request
361+
362+ extra_body: Add additional JSON properties to the request
363+
364+ timeout: Override the client-level default timeout for this request, in seconds
365+ """
366+ if not artifact_uid :
367+ raise ValueError (f"Expected a non-empty value for `artifact_uid` but received { artifact_uid !r} " )
368+ return await self ._get (
369+ f"/agent/artifacts/{ artifact_uid } " ,
370+ options = make_request_options (
371+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
372+ ),
373+ cast_to = AgentGetArtifactResponse ,
374+ )
375+
289376 async def run (
290377 self ,
291378 * ,
@@ -369,6 +456,9 @@ def __init__(self, agent: AgentResource) -> None:
369456 self .list = to_raw_response_wrapper (
370457 agent .list ,
371458 )
459+ self .get_artifact = to_raw_response_wrapper (
460+ agent .get_artifact ,
461+ )
372462 self .run = to_raw_response_wrapper (
373463 agent .run ,
374464 )
@@ -381,6 +471,10 @@ def runs(self) -> RunsResourceWithRawResponse:
381471 def schedules (self ) -> SchedulesResourceWithRawResponse :
382472 return SchedulesResourceWithRawResponse (self ._agent .schedules )
383473
474+ @cached_property
475+ def sessions (self ) -> SessionsResourceWithRawResponse :
476+ return SessionsResourceWithRawResponse (self ._agent .sessions )
477+
384478
385479class AsyncAgentResourceWithRawResponse :
386480 def __init__ (self , agent : AsyncAgentResource ) -> None :
@@ -389,6 +483,9 @@ def __init__(self, agent: AsyncAgentResource) -> None:
389483 self .list = async_to_raw_response_wrapper (
390484 agent .list ,
391485 )
486+ self .get_artifact = async_to_raw_response_wrapper (
487+ agent .get_artifact ,
488+ )
392489 self .run = async_to_raw_response_wrapper (
393490 agent .run ,
394491 )
@@ -401,6 +498,10 @@ def runs(self) -> AsyncRunsResourceWithRawResponse:
401498 def schedules (self ) -> AsyncSchedulesResourceWithRawResponse :
402499 return AsyncSchedulesResourceWithRawResponse (self ._agent .schedules )
403500
501+ @cached_property
502+ def sessions (self ) -> AsyncSessionsResourceWithRawResponse :
503+ return AsyncSessionsResourceWithRawResponse (self ._agent .sessions )
504+
404505
405506class AgentResourceWithStreamingResponse :
406507 def __init__ (self , agent : AgentResource ) -> None :
@@ -409,6 +510,9 @@ def __init__(self, agent: AgentResource) -> None:
409510 self .list = to_streamed_response_wrapper (
410511 agent .list ,
411512 )
513+ self .get_artifact = to_streamed_response_wrapper (
514+ agent .get_artifact ,
515+ )
412516 self .run = to_streamed_response_wrapper (
413517 agent .run ,
414518 )
@@ -421,6 +525,10 @@ def runs(self) -> RunsResourceWithStreamingResponse:
421525 def schedules (self ) -> SchedulesResourceWithStreamingResponse :
422526 return SchedulesResourceWithStreamingResponse (self ._agent .schedules )
423527
528+ @cached_property
529+ def sessions (self ) -> SessionsResourceWithStreamingResponse :
530+ return SessionsResourceWithStreamingResponse (self ._agent .sessions )
531+
424532
425533class AsyncAgentResourceWithStreamingResponse :
426534 def __init__ (self , agent : AsyncAgentResource ) -> None :
@@ -429,6 +537,9 @@ def __init__(self, agent: AsyncAgentResource) -> None:
429537 self .list = async_to_streamed_response_wrapper (
430538 agent .list ,
431539 )
540+ self .get_artifact = async_to_streamed_response_wrapper (
541+ agent .get_artifact ,
542+ )
432543 self .run = async_to_streamed_response_wrapper (
433544 agent .run ,
434545 )
@@ -440,3 +551,7 @@ def runs(self) -> AsyncRunsResourceWithStreamingResponse:
440551 @cached_property
441552 def schedules (self ) -> AsyncSchedulesResourceWithStreamingResponse :
442553 return AsyncSchedulesResourceWithStreamingResponse (self ._agent .schedules )
554+
555+ @cached_property
556+ def sessions (self ) -> AsyncSessionsResourceWithStreamingResponse :
557+ return AsyncSessionsResourceWithStreamingResponse (self ._agent .sessions )
0 commit comments