66
77import httpx
88
9- from ..types import agent_list_params , agent_create_params
9+ from ..types import agent_list_params , agent_create_params , agent_list_public_params
1010from .._types import Body , Omit , Query , Headers , NotGiven , omit , not_given
1111from .._utils import path_template , maybe_transform , async_maybe_transform
1212from .._compat import cached_property
2020from ..pagination import SyncAgentsCursorIDPage , AsyncAgentsCursorIDPage
2121from .._base_client import AsyncPaginator , make_request_options
2222from ..types .agent_view import AgentView
23+ from ..types .agent_devbox_counts_view import AgentDevboxCountsView
2324from ..types .shared_params .agent_source import AgentSource
2425
2526__all__ = ["AgentsResource" , "AsyncAgentsResource" ]
@@ -202,6 +203,135 @@ def list(
202203 model = AgentView ,
203204 )
204205
206+ def delete (
207+ self ,
208+ id : str ,
209+ * ,
210+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
211+ # The extra values given here take precedence over values defined on the client or passed to this method.
212+ extra_headers : Headers | None = None ,
213+ extra_query : Query | None = None ,
214+ extra_body : Body | None = None ,
215+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
216+ idempotency_key : str | None = None ,
217+ ) -> object :
218+ """Delete an Agent by its unique identifier.
219+
220+ The Agent will be permanently removed.
221+
222+ Args:
223+ extra_headers: Send extra headers
224+
225+ extra_query: Add additional query parameters to the request
226+
227+ extra_body: Add additional JSON properties to the request
228+
229+ timeout: Override the client-level default timeout for this request, in seconds
230+
231+ idempotency_key: Specify a custom idempotency key for this request
232+ """
233+ if not id :
234+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
235+ return self ._post (
236+ path_template ("/v1/agents/{id}/delete" , id = id ),
237+ options = make_request_options (
238+ extra_headers = extra_headers ,
239+ extra_query = extra_query ,
240+ extra_body = extra_body ,
241+ timeout = timeout ,
242+ idempotency_key = idempotency_key ,
243+ ),
244+ cast_to = object ,
245+ )
246+
247+ def devbox_counts (
248+ self ,
249+ * ,
250+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
251+ # The extra values given here take precedence over values defined on the client or passed to this method.
252+ extra_headers : Headers | None = None ,
253+ extra_query : Query | None = None ,
254+ extra_body : Body | None = None ,
255+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
256+ ) -> AgentDevboxCountsView :
257+ """Returns devbox counts grouped by agent name.
258+
259+ This endpoint efficiently
260+ aggregates devbox counts for all agents in a single request, avoiding N+1 query
261+ patterns.
262+ """
263+ return self ._get (
264+ "/v1/agents/devbox_counts" ,
265+ options = make_request_options (
266+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
267+ ),
268+ cast_to = AgentDevboxCountsView ,
269+ )
270+
271+ def list_public (
272+ self ,
273+ * ,
274+ include_total_count : bool | Omit = omit ,
275+ limit : int | Omit = omit ,
276+ name : str | Omit = omit ,
277+ search : str | Omit = omit ,
278+ starting_after : str | Omit = omit ,
279+ version : str | Omit = omit ,
280+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
281+ # The extra values given here take precedence over values defined on the client or passed to this method.
282+ extra_headers : Headers | None = None ,
283+ extra_query : Query | None = None ,
284+ extra_body : Body | None = None ,
285+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
286+ ) -> SyncAgentsCursorIDPage [AgentView ]:
287+ """
288+ List all public Agents with pagination support.
289+
290+ Args:
291+ include_total_count: If true (default), includes total_count in the response. Set to false to skip
292+ the count query for better performance on large datasets.
293+
294+ limit: The limit of items to return. Default is 20. Max is 5000.
295+
296+ name: Filter agents by name (partial match supported).
297+
298+ search: Search by agent ID or name.
299+
300+ starting_after: Load the next page of data starting after the item with the given ID.
301+
302+ version: Filter by version. Use 'latest' to get the most recently created agent.
303+
304+ extra_headers: Send extra headers
305+
306+ extra_query: Add additional query parameters to the request
307+
308+ extra_body: Add additional JSON properties to the request
309+
310+ timeout: Override the client-level default timeout for this request, in seconds
311+ """
312+ return self ._get_api_list (
313+ "/v1/agents/list_public" ,
314+ page = SyncAgentsCursorIDPage [AgentView ],
315+ options = make_request_options (
316+ extra_headers = extra_headers ,
317+ extra_query = extra_query ,
318+ extra_body = extra_body ,
319+ timeout = timeout ,
320+ query = maybe_transform (
321+ {
322+ "include_total_count" : include_total_count ,
323+ "limit" : limit ,
324+ "name" : name ,
325+ "search" : search ,
326+ "starting_after" : starting_after ,
327+ "version" : version ,
328+ },
329+ agent_list_public_params .AgentListPublicParams ,
330+ ),
331+ ),
332+ model = AgentView ,
333+ )
334+
205335
206336class AsyncAgentsResource (AsyncAPIResource ):
207337 @cached_property
@@ -380,6 +510,135 @@ def list(
380510 model = AgentView ,
381511 )
382512
513+ async def delete (
514+ self ,
515+ id : str ,
516+ * ,
517+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
518+ # The extra values given here take precedence over values defined on the client or passed to this method.
519+ extra_headers : Headers | None = None ,
520+ extra_query : Query | None = None ,
521+ extra_body : Body | None = None ,
522+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
523+ idempotency_key : str | None = None ,
524+ ) -> object :
525+ """Delete an Agent by its unique identifier.
526+
527+ The Agent will be permanently removed.
528+
529+ Args:
530+ extra_headers: Send extra headers
531+
532+ extra_query: Add additional query parameters to the request
533+
534+ extra_body: Add additional JSON properties to the request
535+
536+ timeout: Override the client-level default timeout for this request, in seconds
537+
538+ idempotency_key: Specify a custom idempotency key for this request
539+ """
540+ if not id :
541+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
542+ return await self ._post (
543+ path_template ("/v1/agents/{id}/delete" , id = id ),
544+ options = make_request_options (
545+ extra_headers = extra_headers ,
546+ extra_query = extra_query ,
547+ extra_body = extra_body ,
548+ timeout = timeout ,
549+ idempotency_key = idempotency_key ,
550+ ),
551+ cast_to = object ,
552+ )
553+
554+ async def devbox_counts (
555+ self ,
556+ * ,
557+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
558+ # The extra values given here take precedence over values defined on the client or passed to this method.
559+ extra_headers : Headers | None = None ,
560+ extra_query : Query | None = None ,
561+ extra_body : Body | None = None ,
562+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
563+ ) -> AgentDevboxCountsView :
564+ """Returns devbox counts grouped by agent name.
565+
566+ This endpoint efficiently
567+ aggregates devbox counts for all agents in a single request, avoiding N+1 query
568+ patterns.
569+ """
570+ return await self ._get (
571+ "/v1/agents/devbox_counts" ,
572+ options = make_request_options (
573+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
574+ ),
575+ cast_to = AgentDevboxCountsView ,
576+ )
577+
578+ def list_public (
579+ self ,
580+ * ,
581+ include_total_count : bool | Omit = omit ,
582+ limit : int | Omit = omit ,
583+ name : str | Omit = omit ,
584+ search : str | Omit = omit ,
585+ starting_after : str | Omit = omit ,
586+ version : str | Omit = omit ,
587+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
588+ # The extra values given here take precedence over values defined on the client or passed to this method.
589+ extra_headers : Headers | None = None ,
590+ extra_query : Query | None = None ,
591+ extra_body : Body | None = None ,
592+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
593+ ) -> AsyncPaginator [AgentView , AsyncAgentsCursorIDPage [AgentView ]]:
594+ """
595+ List all public Agents with pagination support.
596+
597+ Args:
598+ include_total_count: If true (default), includes total_count in the response. Set to false to skip
599+ the count query for better performance on large datasets.
600+
601+ limit: The limit of items to return. Default is 20. Max is 5000.
602+
603+ name: Filter agents by name (partial match supported).
604+
605+ search: Search by agent ID or name.
606+
607+ starting_after: Load the next page of data starting after the item with the given ID.
608+
609+ version: Filter by version. Use 'latest' to get the most recently created agent.
610+
611+ extra_headers: Send extra headers
612+
613+ extra_query: Add additional query parameters to the request
614+
615+ extra_body: Add additional JSON properties to the request
616+
617+ timeout: Override the client-level default timeout for this request, in seconds
618+ """
619+ return self ._get_api_list (
620+ "/v1/agents/list_public" ,
621+ page = AsyncAgentsCursorIDPage [AgentView ],
622+ options = make_request_options (
623+ extra_headers = extra_headers ,
624+ extra_query = extra_query ,
625+ extra_body = extra_body ,
626+ timeout = timeout ,
627+ query = maybe_transform (
628+ {
629+ "include_total_count" : include_total_count ,
630+ "limit" : limit ,
631+ "name" : name ,
632+ "search" : search ,
633+ "starting_after" : starting_after ,
634+ "version" : version ,
635+ },
636+ agent_list_public_params .AgentListPublicParams ,
637+ ),
638+ ),
639+ model = AgentView ,
640+ )
641+
383642
384643class AgentsResourceWithRawResponse :
385644 def __init__ (self , agents : AgentsResource ) -> None :
@@ -394,6 +653,15 @@ def __init__(self, agents: AgentsResource) -> None:
394653 self .list = to_raw_response_wrapper (
395654 agents .list ,
396655 )
656+ self .delete = to_raw_response_wrapper (
657+ agents .delete ,
658+ )
659+ self .devbox_counts = to_raw_response_wrapper (
660+ agents .devbox_counts ,
661+ )
662+ self .list_public = to_raw_response_wrapper (
663+ agents .list_public ,
664+ )
397665
398666
399667class AsyncAgentsResourceWithRawResponse :
@@ -409,6 +677,15 @@ def __init__(self, agents: AsyncAgentsResource) -> None:
409677 self .list = async_to_raw_response_wrapper (
410678 agents .list ,
411679 )
680+ self .delete = async_to_raw_response_wrapper (
681+ agents .delete ,
682+ )
683+ self .devbox_counts = async_to_raw_response_wrapper (
684+ agents .devbox_counts ,
685+ )
686+ self .list_public = async_to_raw_response_wrapper (
687+ agents .list_public ,
688+ )
412689
413690
414691class AgentsResourceWithStreamingResponse :
@@ -424,6 +701,15 @@ def __init__(self, agents: AgentsResource) -> None:
424701 self .list = to_streamed_response_wrapper (
425702 agents .list ,
426703 )
704+ self .delete = to_streamed_response_wrapper (
705+ agents .delete ,
706+ )
707+ self .devbox_counts = to_streamed_response_wrapper (
708+ agents .devbox_counts ,
709+ )
710+ self .list_public = to_streamed_response_wrapper (
711+ agents .list_public ,
712+ )
427713
428714
429715class AsyncAgentsResourceWithStreamingResponse :
@@ -439,3 +725,12 @@ def __init__(self, agents: AsyncAgentsResource) -> None:
439725 self .list = async_to_streamed_response_wrapper (
440726 agents .list ,
441727 )
728+ self .delete = async_to_streamed_response_wrapper (
729+ agents .delete ,
730+ )
731+ self .devbox_counts = async_to_streamed_response_wrapper (
732+ agents .devbox_counts ,
733+ )
734+ self .list_public = async_to_streamed_response_wrapper (
735+ agents .list_public ,
736+ )
0 commit comments