1515 RunsResourceWithStreamingResponse ,
1616 AsyncRunsResourceWithStreamingResponse ,
1717)
18- from ...types import agent_run_params , agent_list_params
18+ from ...types import agent_run_params , agent_list_params , agent_list_environments_params
1919from ..._types import Body , Omit , Query , Headers , NotGiven , omit , not_given
2020from ..._utils import path_template , maybe_transform , async_maybe_transform
2121from .sessions import (
4747from ...types .agent_list_response import AgentListResponse
4848from ...types .ambient_agent_config_param import AmbientAgentConfigParam
4949from ...types .agent_get_artifact_response import AgentGetArtifactResponse
50+ from ...types .agent_list_environments_response import AgentListEnvironmentsResponse
5051
5152__all__ = ["AgentResource" , "AsyncAgentResource" ]
5253
@@ -163,8 +164,9 @@ def get_artifact(
163164 ) -> AgentGetArtifactResponse :
164165 """Retrieve an artifact by its UUID.
165166
166- For supported downloadable artifacts, returns
167- a time-limited signed download URL.
167+ For downloadable file-like artifacts, returns
168+ a time-limited signed download URL. For plan artifacts, returns the current plan
169+ content inline.
168170
169171 Args:
170172 extra_headers: Send extra headers
@@ -190,6 +192,49 @@ def get_artifact(
190192 ),
191193 )
192194
195+ def list_environments (
196+ self ,
197+ * ,
198+ sort_by : Literal ["name" , "last_updated" ] | Omit = omit ,
199+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
200+ # The extra values given here take precedence over values defined on the client or passed to this method.
201+ extra_headers : Headers | None = None ,
202+ extra_query : Query | None = None ,
203+ extra_body : Body | None = None ,
204+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
205+ ) -> AgentListEnvironmentsResponse :
206+ """Retrieve cloud environments accessible to the authenticated principal.
207+
208+ Returns
209+ environments the caller owns, has been granted guest access to, or has accessed
210+ via link sharing.
211+
212+ Args:
213+ sort_by: Sort order for the returned environments.
214+
215+ - `name`: alphabetical by environment name
216+ - `last_updated`: most recently updated first (default)
217+
218+ extra_headers: Send extra headers
219+
220+ extra_query: Add additional query parameters to the request
221+
222+ extra_body: Add additional JSON properties to the request
223+
224+ timeout: Override the client-level default timeout for this request, in seconds
225+ """
226+ return self ._get (
227+ "/agent/environments" ,
228+ options = make_request_options (
229+ extra_headers = extra_headers ,
230+ extra_query = extra_query ,
231+ extra_body = extra_body ,
232+ timeout = timeout ,
233+ query = maybe_transform ({"sort_by" : sort_by }, agent_list_environments_params .AgentListEnvironmentsParams ),
234+ ),
235+ cast_to = AgentListEnvironmentsResponse ,
236+ )
237+
193238 def run (
194239 self ,
195240 * ,
@@ -392,8 +437,9 @@ async def get_artifact(
392437 ) -> AgentGetArtifactResponse :
393438 """Retrieve an artifact by its UUID.
394439
395- For supported downloadable artifacts, returns
396- a time-limited signed download URL.
440+ For downloadable file-like artifacts, returns
441+ a time-limited signed download URL. For plan artifacts, returns the current plan
442+ content inline.
397443
398444 Args:
399445 extra_headers: Send extra headers
@@ -419,6 +465,51 @@ async def get_artifact(
419465 ),
420466 )
421467
468+ async def list_environments (
469+ self ,
470+ * ,
471+ sort_by : Literal ["name" , "last_updated" ] | Omit = omit ,
472+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
473+ # The extra values given here take precedence over values defined on the client or passed to this method.
474+ extra_headers : Headers | None = None ,
475+ extra_query : Query | None = None ,
476+ extra_body : Body | None = None ,
477+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
478+ ) -> AgentListEnvironmentsResponse :
479+ """Retrieve cloud environments accessible to the authenticated principal.
480+
481+ Returns
482+ environments the caller owns, has been granted guest access to, or has accessed
483+ via link sharing.
484+
485+ Args:
486+ sort_by: Sort order for the returned environments.
487+
488+ - `name`: alphabetical by environment name
489+ - `last_updated`: most recently updated first (default)
490+
491+ extra_headers: Send extra headers
492+
493+ extra_query: Add additional query parameters to the request
494+
495+ extra_body: Add additional JSON properties to the request
496+
497+ timeout: Override the client-level default timeout for this request, in seconds
498+ """
499+ return await self ._get (
500+ "/agent/environments" ,
501+ options = make_request_options (
502+ extra_headers = extra_headers ,
503+ extra_query = extra_query ,
504+ extra_body = extra_body ,
505+ timeout = timeout ,
506+ query = await async_maybe_transform (
507+ {"sort_by" : sort_by }, agent_list_environments_params .AgentListEnvironmentsParams
508+ ),
509+ ),
510+ cast_to = AgentListEnvironmentsResponse ,
511+ )
512+
422513 async def run (
423514 self ,
424515 * ,
@@ -519,6 +610,9 @@ def __init__(self, agent: AgentResource) -> None:
519610 self .get_artifact = to_raw_response_wrapper (
520611 agent .get_artifact ,
521612 )
613+ self .list_environments = to_raw_response_wrapper (
614+ agent .list_environments ,
615+ )
522616 self .run = to_raw_response_wrapper (
523617 agent .run ,
524618 )
@@ -549,6 +643,9 @@ def __init__(self, agent: AsyncAgentResource) -> None:
549643 self .get_artifact = async_to_raw_response_wrapper (
550644 agent .get_artifact ,
551645 )
646+ self .list_environments = async_to_raw_response_wrapper (
647+ agent .list_environments ,
648+ )
552649 self .run = async_to_raw_response_wrapper (
553650 agent .run ,
554651 )
@@ -579,6 +676,9 @@ def __init__(self, agent: AgentResource) -> None:
579676 self .get_artifact = to_streamed_response_wrapper (
580677 agent .get_artifact ,
581678 )
679+ self .list_environments = to_streamed_response_wrapper (
680+ agent .list_environments ,
681+ )
582682 self .run = to_streamed_response_wrapper (
583683 agent .run ,
584684 )
@@ -609,6 +709,9 @@ def __init__(self, agent: AsyncAgentResource) -> None:
609709 self .get_artifact = async_to_streamed_response_wrapper (
610710 agent .get_artifact ,
611711 )
712+ self .list_environments = async_to_streamed_response_wrapper (
713+ agent .list_environments ,
714+ )
612715 self .run = async_to_streamed_response_wrapper (
613716 agent .run ,
614717 )
0 commit comments