22
33from __future__ import annotations
44
5+ from typing import Iterable
6+ from typing_extensions import Literal
7+
58import httpx
69
710from .runs import (
@@ -70,7 +73,9 @@ def with_streaming_response(self) -> AgentResourceWithStreamingResponse:
7073 def list (
7174 self ,
7275 * ,
76+ refresh : bool | Omit = omit ,
7377 repo : str | Omit = omit ,
78+ sort_by : Literal ["name" , "last_run" ] | Omit = omit ,
7479 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
7580 # The extra values given here take precedence over values defined on the client or passed to this method.
7681 extra_headers : Headers | None = None ,
@@ -83,9 +88,17 @@ def list(
8388 Agents are discovered from environments or a specific repository.
8489
8590 Args:
91+ refresh: When true, clears the agent list cache before fetching. Use this to force a
92+ refresh of the available agents.
93+
8694 repo: Optional repository specification to list agents from (format: "owner/repo"). If
8795 not provided, lists agents from all accessible environments.
8896
97+ sort_by: Sort order for the returned agents.
98+
99+ - "name": Sort alphabetically by name (default)
100+ - "last_run": Sort by most recently used
101+
89102 extra_headers: Send extra headers
90103
91104 extra_query: Add additional query parameters to the request
@@ -101,16 +114,26 @@ def list(
101114 extra_query = extra_query ,
102115 extra_body = extra_body ,
103116 timeout = timeout ,
104- query = maybe_transform ({"repo" : repo }, agent_list_params .AgentListParams ),
117+ query = maybe_transform (
118+ {
119+ "refresh" : refresh ,
120+ "repo" : repo ,
121+ "sort_by" : sort_by ,
122+ },
123+ agent_list_params .AgentListParams ,
124+ ),
105125 ),
106126 cast_to = AgentListResponse ,
107127 )
108128
109129 def run (
110130 self ,
111131 * ,
112- prompt : str ,
113132 config : AmbientAgentConfigParam | Omit = omit ,
133+ conversation_id : str | Omit = omit ,
134+ images : Iterable [agent_run_params .Image ] | Omit = omit ,
135+ prompt : str | Omit = omit ,
136+ skill : str | Omit = omit ,
114137 team : bool | Omit = omit ,
115138 title : str | Omit = omit ,
116139 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -120,17 +143,33 @@ def run(
120143 extra_body : Body | None = None ,
121144 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
122145 ) -> AgentRunResponse :
123- """Spawn an ambient agent with a prompt and optional configuration.
146+ """Spawn an cloud agent with a prompt and optional configuration.
124147
125- The agent will
126- be queued for execution and assigned a unique run ID.
148+ The agent will be
149+ queued for execution and assigned a unique run ID.
127150
128151 Args:
129- prompt: The prompt/instruction for the agent to execute
152+ config: Configuration for an cloud agent run
153+
154+ conversation_id: Optional conversation ID to continue an existing conversation. If provided, the
155+ agent will continue from where the previous run left off.
130156
131- config: Configuration for an ambient agent run
157+ images: Optional images to include with the prompt (max 5). Images are uploaded to cloud
158+ storage and made available to the agent.
132159
133- team: Make the run visible to all team members, not only the calling user
160+ prompt: The prompt/instruction for the agent to execute. Required unless a skill is
161+ specified via the skill field or config.skill_spec.
162+
163+ skill:
164+ Skill specification to use as the base prompt for the agent. Supported formats:
165+
166+ - "repo:skill_name" - Simple name in specific repo
167+ - "repo:skill_path" - Full path in specific repo
168+ - "org/repo:skill_name" - Simple name with org and repo
169+ - "org/repo:skill_path" - Full path with org and repo When provided, this takes
170+ precedence over config.skill_spec.
171+
172+ team: Whether to create a team-owned run. Defaults to true for users on a single team.
134173
135174 title: Custom title for the run (auto-generated if not provided)
136175
@@ -146,8 +185,11 @@ def run(
146185 "/agent/run" ,
147186 body = maybe_transform (
148187 {
149- "prompt" : prompt ,
150188 "config" : config ,
189+ "conversation_id" : conversation_id ,
190+ "images" : images ,
191+ "prompt" : prompt ,
192+ "skill" : skill ,
151193 "team" : team ,
152194 "title" : title ,
153195 },
@@ -191,7 +233,9 @@ def with_streaming_response(self) -> AsyncAgentResourceWithStreamingResponse:
191233 async def list (
192234 self ,
193235 * ,
236+ refresh : bool | Omit = omit ,
194237 repo : str | Omit = omit ,
238+ sort_by : Literal ["name" , "last_run" ] | Omit = omit ,
195239 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
196240 # The extra values given here take precedence over values defined on the client or passed to this method.
197241 extra_headers : Headers | None = None ,
@@ -204,9 +248,17 @@ async def list(
204248 Agents are discovered from environments or a specific repository.
205249
206250 Args:
251+ refresh: When true, clears the agent list cache before fetching. Use this to force a
252+ refresh of the available agents.
253+
207254 repo: Optional repository specification to list agents from (format: "owner/repo"). If
208255 not provided, lists agents from all accessible environments.
209256
257+ sort_by: Sort order for the returned agents.
258+
259+ - "name": Sort alphabetically by name (default)
260+ - "last_run": Sort by most recently used
261+
210262 extra_headers: Send extra headers
211263
212264 extra_query: Add additional query parameters to the request
@@ -222,16 +274,26 @@ async def list(
222274 extra_query = extra_query ,
223275 extra_body = extra_body ,
224276 timeout = timeout ,
225- query = await async_maybe_transform ({"repo" : repo }, agent_list_params .AgentListParams ),
277+ query = await async_maybe_transform (
278+ {
279+ "refresh" : refresh ,
280+ "repo" : repo ,
281+ "sort_by" : sort_by ,
282+ },
283+ agent_list_params .AgentListParams ,
284+ ),
226285 ),
227286 cast_to = AgentListResponse ,
228287 )
229288
230289 async def run (
231290 self ,
232291 * ,
233- prompt : str ,
234292 config : AmbientAgentConfigParam | Omit = omit ,
293+ conversation_id : str | Omit = omit ,
294+ images : Iterable [agent_run_params .Image ] | Omit = omit ,
295+ prompt : str | Omit = omit ,
296+ skill : str | Omit = omit ,
235297 team : bool | Omit = omit ,
236298 title : str | Omit = omit ,
237299 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -241,17 +303,33 @@ async def run(
241303 extra_body : Body | None = None ,
242304 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
243305 ) -> AgentRunResponse :
244- """Spawn an ambient agent with a prompt and optional configuration.
306+ """Spawn an cloud agent with a prompt and optional configuration.
245307
246- The agent will
247- be queued for execution and assigned a unique run ID.
308+ The agent will be
309+ queued for execution and assigned a unique run ID.
248310
249311 Args:
250- prompt: The prompt/instruction for the agent to execute
312+ config: Configuration for an cloud agent run
313+
314+ conversation_id: Optional conversation ID to continue an existing conversation. If provided, the
315+ agent will continue from where the previous run left off.
316+
317+ images: Optional images to include with the prompt (max 5). Images are uploaded to cloud
318+ storage and made available to the agent.
251319
252- config: Configuration for an ambient agent run
320+ prompt: The prompt/instruction for the agent to execute. Required unless a skill is
321+ specified via the skill field or config.skill_spec.
253322
254- team: Make the run visible to all team members, not only the calling user
323+ skill:
324+ Skill specification to use as the base prompt for the agent. Supported formats:
325+
326+ - "repo:skill_name" - Simple name in specific repo
327+ - "repo:skill_path" - Full path in specific repo
328+ - "org/repo:skill_name" - Simple name with org and repo
329+ - "org/repo:skill_path" - Full path with org and repo When provided, this takes
330+ precedence over config.skill_spec.
331+
332+ team: Whether to create a team-owned run. Defaults to true for users on a single team.
255333
256334 title: Custom title for the run (auto-generated if not provided)
257335
@@ -267,8 +345,11 @@ async def run(
267345 "/agent/run" ,
268346 body = await async_maybe_transform (
269347 {
270- "prompt" : prompt ,
271348 "config" : config ,
349+ "conversation_id" : conversation_id ,
350+ "images" : images ,
351+ "prompt" : prompt ,
352+ "skill" : skill ,
272353 "team" : team ,
273354 "title" : title ,
274355 },
0 commit comments