nimble_python 0.22.0__py3-none-any.whl → 0.23.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. nimble_python/_client.py +38 -1
  2. nimble_python/_version.py +1 -1
  3. nimble_python/resources/__init__.py +14 -0
  4. nimble_python/resources/agent.py +4 -4
  5. nimble_python/resources/fast_serp.py +293 -0
  6. nimble_python/resources/jobs/jobs.py +8 -0
  7. nimble_python/resources/task_agent/runs.py +53 -21
  8. nimble_python/resources/task_agent/task_agent.py +72 -38
  9. nimble_python/resources/task_agent/templates.py +17 -12
  10. nimble_python/types/__init__.py +2 -0
  11. nimble_python/types/agent_generate_params.py +8 -8
  12. nimble_python/types/client_extract_async_params.py +2 -0
  13. nimble_python/types/client_extract_batch_params.py +4 -0
  14. nimble_python/types/client_extract_params.py +2 -0
  15. nimble_python/types/crawl_run_params.py +2 -0
  16. nimble_python/types/fast_serp_run_params.py +64 -0
  17. nimble_python/types/fast_serp_run_response.py +339 -0
  18. nimble_python/types/job_create_params.py +1 -0
  19. nimble_python/types/job_create_response.py +1 -0
  20. nimble_python/types/job_get_response.py +1 -0
  21. nimble_python/types/job_list_response.py +1 -0
  22. nimble_python/types/job_update_params.py +1 -0
  23. nimble_python/types/job_update_response.py +1 -0
  24. nimble_python/types/jobs/runs/artifact_get_response.py +1 -0
  25. nimble_python/types/jobs/runs/artifact_list_response.py +1 -0
  26. nimble_python/types/task_agent/run_get_response.py +20 -5
  27. nimble_python/types/task_agent/run_get_result_response.py +205 -77
  28. nimble_python/types/task_agent/run_list_params.py +5 -0
  29. nimble_python/types/task_agent/run_list_response.py +35 -11
  30. nimble_python/types/task_agent/template_get_response.py +2 -1
  31. nimble_python/types/task_agent/template_list_params.py +5 -4
  32. nimble_python/types/task_agent/template_list_response.py +2 -1
  33. nimble_python/types/task_agent_create_params.py +7 -3
  34. nimble_python/types/task_agent_create_response.py +9 -5
  35. nimble_python/types/task_agent_get_response.py +9 -5
  36. nimble_python/types/task_agent_list_params.py +6 -3
  37. nimble_python/types/task_agent_list_response.py +9 -5
  38. nimble_python/types/task_agent_run_params.py +9 -1
  39. nimble_python/types/task_agent_run_response.py +20 -5
  40. nimble_python/types/task_agent_update_params.py +16 -4
  41. nimble_python/types/task_agent_update_response.py +9 -5
  42. {nimble_python-0.22.0.dist-info → nimble_python-0.23.0.dist-info}/METADATA +1 -1
  43. {nimble_python-0.22.0.dist-info → nimble_python-0.23.0.dist-info}/RECORD +45 -42
  44. {nimble_python-0.22.0.dist-info → nimble_python-0.23.0.dist-info}/WHEEL +0 -0
  45. {nimble_python-0.22.0.dist-info → nimble_python-0.23.0.dist-info}/licenses/LICENSE +0 -0
nimble_python/_client.py CHANGED
@@ -61,13 +61,14 @@ from .types.extract_async_response import ExtractAsyncResponse
61
61
  from .types.extract_batch_response import ExtractBatchResponse
62
62
 
63
63
  if TYPE_CHECKING:
64
- from .resources import jobs, serp, agent, crawl, media, tasks, batches, task_agent, domain_knowledge
64
+ from .resources import jobs, serp, agent, crawl, media, tasks, batches, fast_serp, task_agent, domain_knowledge
65
65
  from .resources.serp import SerpResource, AsyncSerpResource
66
66
  from .resources.agent import AgentResource, AsyncAgentResource
67
67
  from .resources.crawl import CrawlResource, AsyncCrawlResource
68
68
  from .resources.media import MediaResource, AsyncMediaResource
69
69
  from .resources.tasks import TasksResource, AsyncTasksResource
70
70
  from .resources.batches import BatchesResource, AsyncBatchesResource
71
+ from .resources.fast_serp import FastSerpResource, AsyncFastSerpResource
71
72
  from .resources.jobs.jobs import JobsResource, AsyncJobsResource
72
73
  from .resources.domain_knowledge import DomainKnowledgeResource, AsyncDomainKnowledgeResource
73
74
  from .resources.task_agent.task_agent import TaskAgentResource, AsyncTaskAgentResource
@@ -185,6 +186,12 @@ class Nimble(SyncAPIClient):
185
186
 
186
187
  return SerpResource(self)
187
188
 
189
+ @cached_property
190
+ def fast_serp(self) -> FastSerpResource:
191
+ from .resources.fast_serp import FastSerpResource
192
+
193
+ return FastSerpResource(self)
194
+
188
195
  @cached_property
189
196
  def task_agent(self) -> TaskAgentResource:
190
197
  from .resources.task_agent import TaskAgentResource
@@ -3479,6 +3486,12 @@ class AsyncNimble(AsyncAPIClient):
3479
3486
 
3480
3487
  return AsyncSerpResource(self)
3481
3488
 
3489
+ @cached_property
3490
+ def fast_serp(self) -> AsyncFastSerpResource:
3491
+ from .resources.fast_serp import AsyncFastSerpResource
3492
+
3493
+ return AsyncFastSerpResource(self)
3494
+
3482
3495
  @cached_property
3483
3496
  def task_agent(self) -> AsyncTaskAgentResource:
3484
3497
  from .resources.task_agent import AsyncTaskAgentResource
@@ -6727,6 +6740,12 @@ class NimbleWithRawResponse:
6727
6740
 
6728
6741
  return SerpResourceWithRawResponse(self._client.serp)
6729
6742
 
6743
+ @cached_property
6744
+ def fast_serp(self) -> fast_serp.FastSerpResourceWithRawResponse:
6745
+ from .resources.fast_serp import FastSerpResourceWithRawResponse
6746
+
6747
+ return FastSerpResourceWithRawResponse(self._client.fast_serp)
6748
+
6730
6749
  @cached_property
6731
6750
  def task_agent(self) -> task_agent.TaskAgentResourceWithRawResponse:
6732
6751
  from .resources.task_agent import TaskAgentResourceWithRawResponse
@@ -6804,6 +6823,12 @@ class AsyncNimbleWithRawResponse:
6804
6823
 
6805
6824
  return AsyncSerpResourceWithRawResponse(self._client.serp)
6806
6825
 
6826
+ @cached_property
6827
+ def fast_serp(self) -> fast_serp.AsyncFastSerpResourceWithRawResponse:
6828
+ from .resources.fast_serp import AsyncFastSerpResourceWithRawResponse
6829
+
6830
+ return AsyncFastSerpResourceWithRawResponse(self._client.fast_serp)
6831
+
6807
6832
  @cached_property
6808
6833
  def task_agent(self) -> task_agent.AsyncTaskAgentResourceWithRawResponse:
6809
6834
  from .resources.task_agent import AsyncTaskAgentResourceWithRawResponse
@@ -6881,6 +6906,12 @@ class NimbleWithStreamedResponse:
6881
6906
 
6882
6907
  return SerpResourceWithStreamingResponse(self._client.serp)
6883
6908
 
6909
+ @cached_property
6910
+ def fast_serp(self) -> fast_serp.FastSerpResourceWithStreamingResponse:
6911
+ from .resources.fast_serp import FastSerpResourceWithStreamingResponse
6912
+
6913
+ return FastSerpResourceWithStreamingResponse(self._client.fast_serp)
6914
+
6884
6915
  @cached_property
6885
6916
  def task_agent(self) -> task_agent.TaskAgentResourceWithStreamingResponse:
6886
6917
  from .resources.task_agent import TaskAgentResourceWithStreamingResponse
@@ -6958,6 +6989,12 @@ class AsyncNimbleWithStreamedResponse:
6958
6989
 
6959
6990
  return AsyncSerpResourceWithStreamingResponse(self._client.serp)
6960
6991
 
6992
+ @cached_property
6993
+ def fast_serp(self) -> fast_serp.AsyncFastSerpResourceWithStreamingResponse:
6994
+ from .resources.fast_serp import AsyncFastSerpResourceWithStreamingResponse
6995
+
6996
+ return AsyncFastSerpResourceWithStreamingResponse(self._client.fast_serp)
6997
+
6961
6998
  @cached_property
6962
6999
  def task_agent(self) -> task_agent.AsyncTaskAgentResourceWithStreamingResponse:
6963
7000
  from .resources.task_agent import AsyncTaskAgentResourceWithStreamingResponse
nimble_python/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "nimble_python"
4
- __version__ = "0.22.0" # x-release-please-version
4
+ __version__ = "0.23.0" # x-release-please-version
@@ -56,6 +56,14 @@ from .batches import (
56
56
  BatchesResourceWithStreamingResponse,
57
57
  AsyncBatchesResourceWithStreamingResponse,
58
58
  )
59
+ from .fast_serp import (
60
+ FastSerpResource,
61
+ AsyncFastSerpResource,
62
+ FastSerpResourceWithRawResponse,
63
+ AsyncFastSerpResourceWithRawResponse,
64
+ FastSerpResourceWithStreamingResponse,
65
+ AsyncFastSerpResourceWithStreamingResponse,
66
+ )
59
67
  from .task_agent import (
60
68
  TaskAgentResource,
61
69
  AsyncTaskAgentResource,
@@ -116,6 +124,12 @@ __all__ = [
116
124
  "AsyncSerpResourceWithRawResponse",
117
125
  "SerpResourceWithStreamingResponse",
118
126
  "AsyncSerpResourceWithStreamingResponse",
127
+ "FastSerpResource",
128
+ "AsyncFastSerpResource",
129
+ "FastSerpResourceWithRawResponse",
130
+ "AsyncFastSerpResourceWithRawResponse",
131
+ "FastSerpResourceWithStreamingResponse",
132
+ "AsyncFastSerpResourceWithStreamingResponse",
119
133
  "TaskAgentResource",
120
134
  "AsyncTaskAgentResource",
121
135
  "TaskAgentResourceWithRawResponse",
@@ -121,7 +121,7 @@ class AgentResource(SyncAPIResource):
121
121
  prompt: str,
122
122
  url: str,
123
123
  input_schema: Dict[str, object] | Omit = omit,
124
- metadata: Optional[agent_generate_params.CreateAgentGenerationRequestMetadata] | Omit = omit,
124
+ metadata: Optional[agent_generate_params.CrustCreateAgentGenerationRequestMetadata] | Omit = omit,
125
125
  name: Optional[str] | Omit = omit,
126
126
  output_schema: Dict[str, object] | Omit = omit,
127
127
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -179,7 +179,7 @@ class AgentResource(SyncAPIResource):
179
179
  prompt: str,
180
180
  url: str | Omit = omit,
181
181
  input_schema: Dict[str, object] | Omit = omit,
182
- metadata: Optional[agent_generate_params.CreateAgentGenerationRequestMetadata] | Omit = omit,
182
+ metadata: Optional[agent_generate_params.CrustCreateAgentGenerationRequestMetadata] | Omit = omit,
183
183
  name: Optional[str] | Omit = omit,
184
184
  output_schema: Dict[str, object] | Omit = omit,
185
185
  from_agent: str | Omit = omit,
@@ -512,7 +512,7 @@ class AsyncAgentResource(AsyncAPIResource):
512
512
  prompt: str,
513
513
  url: str,
514
514
  input_schema: Dict[str, object] | Omit = omit,
515
- metadata: Optional[agent_generate_params.CreateAgentGenerationRequestMetadata] | Omit = omit,
515
+ metadata: Optional[agent_generate_params.CrustCreateAgentGenerationRequestMetadata] | Omit = omit,
516
516
  name: Optional[str] | Omit = omit,
517
517
  output_schema: Dict[str, object] | Omit = omit,
518
518
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -570,7 +570,7 @@ class AsyncAgentResource(AsyncAPIResource):
570
570
  prompt: str,
571
571
  url: str | Omit = omit,
572
572
  input_schema: Dict[str, object] | Omit = omit,
573
- metadata: Optional[agent_generate_params.CreateAgentGenerationRequestMetadata] | Omit = omit,
573
+ metadata: Optional[agent_generate_params.CrustCreateAgentGenerationRequestMetadata] | Omit = omit,
574
574
  name: Optional[str] | Omit = omit,
575
575
  output_schema: Dict[str, object] | Omit = omit,
576
576
  from_agent: str | Omit = omit,
@@ -0,0 +1,293 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Literal
6
+
7
+ import httpx
8
+
9
+ from ..types import fast_serp_run_params
10
+ from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
11
+ from .._utils import maybe_transform, async_maybe_transform
12
+ from .._compat import cached_property
13
+ from .._resource import SyncAPIResource, AsyncAPIResource
14
+ from .._response import (
15
+ to_raw_response_wrapper,
16
+ to_streamed_response_wrapper,
17
+ async_to_raw_response_wrapper,
18
+ async_to_streamed_response_wrapper,
19
+ )
20
+ from .._base_client import make_request_options
21
+ from ..types.fast_serp_run_response import FastSerpRunResponse
22
+
23
+ __all__ = ["FastSerpResource", "AsyncFastSerpResource"]
24
+
25
+
26
+ class FastSerpResource(SyncAPIResource):
27
+ @cached_property
28
+ def with_raw_response(self) -> FastSerpResourceWithRawResponse:
29
+ """
30
+ This property can be used as a prefix for any HTTP method call to return
31
+ the raw response object instead of the parsed content.
32
+
33
+ For more information, see https://www.github.com/Nimbleway/nimble-python#accessing-raw-response-data-eg-headers
34
+ """
35
+ return FastSerpResourceWithRawResponse(self)
36
+
37
+ @cached_property
38
+ def with_streaming_response(self) -> FastSerpResourceWithStreamingResponse:
39
+ """
40
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
41
+
42
+ For more information, see https://www.github.com/Nimbleway/nimble-python#with_streaming_response
43
+ """
44
+ return FastSerpResourceWithStreamingResponse(self)
45
+
46
+ def run(
47
+ self,
48
+ *,
49
+ search_engine: Literal[
50
+ "google_search",
51
+ "google_sge",
52
+ "google_aio",
53
+ "google_maps_search",
54
+ "google_maps_reviews",
55
+ "google_maps_place",
56
+ "google_news",
57
+ "google_images",
58
+ "bing_search",
59
+ "yandex_search",
60
+ ],
61
+ country: str | Omit = omit,
62
+ device: Literal["desktop", "mobile"] | Omit = omit,
63
+ domain: str | Omit = omit,
64
+ locale: str | Omit = omit,
65
+ location: str | Omit = omit,
66
+ num_results: int | Omit = omit,
67
+ page: int | Omit = omit,
68
+ parse: bool | Omit = omit,
69
+ query: str | Omit = omit,
70
+ render: bool | Omit = omit,
71
+ show_hidden_results: bool | Omit = omit,
72
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
73
+ # The extra values given here take precedence over values defined on the client or passed to this method.
74
+ extra_headers: Headers | None = None,
75
+ extra_query: Query | None = None,
76
+ extra_body: Body | None = None,
77
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
78
+ ) -> FastSerpRunResponse:
79
+ """
80
+ Fast SERP
81
+
82
+ Args:
83
+ search_engine: The search engine to query.
84
+
85
+ country: ISO Alpha-2 country code used to access the target search engine (e.g. US, DE,
86
+ GB).
87
+
88
+ device: Device type used for the search request.
89
+
90
+ domain: Top-level domain for the search engine (e.g. "com", "co.uk", "de").
91
+
92
+ locale: Locale used for the search request.
93
+
94
+ location: Geo-location for the search (canonical Google location name).
95
+
96
+ num_results: Number of results to return (1–100).
97
+
98
+ page: The result page number for pagination.
99
+
100
+ parse: When true, the SERP response is parsed into structured JSON.
101
+
102
+ query: The search keyword or phrase to query.
103
+
104
+ render: Whether to render the page in a browser before extracting.
105
+
106
+ show_hidden_results: When true, disables Google result filtering (filter=0) so omitted/duplicate and
107
+ highly similar pages are also returned. Applies to Google search engines.
108
+
109
+ extra_headers: Send extra headers
110
+
111
+ extra_query: Add additional query parameters to the request
112
+
113
+ extra_body: Add additional JSON properties to the request
114
+
115
+ timeout: Override the client-level default timeout for this request, in seconds
116
+ """
117
+ return self._post(
118
+ "/v1/fast-serp",
119
+ body=maybe_transform(
120
+ {
121
+ "search_engine": search_engine,
122
+ "country": country,
123
+ "device": device,
124
+ "domain": domain,
125
+ "locale": locale,
126
+ "location": location,
127
+ "num_results": num_results,
128
+ "page": page,
129
+ "parse": parse,
130
+ "query": query,
131
+ "render": render,
132
+ "show_hidden_results": show_hidden_results,
133
+ },
134
+ fast_serp_run_params.FastSerpRunParams,
135
+ ),
136
+ options=make_request_options(
137
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
138
+ ),
139
+ cast_to=FastSerpRunResponse,
140
+ )
141
+
142
+
143
+ class AsyncFastSerpResource(AsyncAPIResource):
144
+ @cached_property
145
+ def with_raw_response(self) -> AsyncFastSerpResourceWithRawResponse:
146
+ """
147
+ This property can be used as a prefix for any HTTP method call to return
148
+ the raw response object instead of the parsed content.
149
+
150
+ For more information, see https://www.github.com/Nimbleway/nimble-python#accessing-raw-response-data-eg-headers
151
+ """
152
+ return AsyncFastSerpResourceWithRawResponse(self)
153
+
154
+ @cached_property
155
+ def with_streaming_response(self) -> AsyncFastSerpResourceWithStreamingResponse:
156
+ """
157
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
158
+
159
+ For more information, see https://www.github.com/Nimbleway/nimble-python#with_streaming_response
160
+ """
161
+ return AsyncFastSerpResourceWithStreamingResponse(self)
162
+
163
+ async def run(
164
+ self,
165
+ *,
166
+ search_engine: Literal[
167
+ "google_search",
168
+ "google_sge",
169
+ "google_aio",
170
+ "google_maps_search",
171
+ "google_maps_reviews",
172
+ "google_maps_place",
173
+ "google_news",
174
+ "google_images",
175
+ "bing_search",
176
+ "yandex_search",
177
+ ],
178
+ country: str | Omit = omit,
179
+ device: Literal["desktop", "mobile"] | Omit = omit,
180
+ domain: str | Omit = omit,
181
+ locale: str | Omit = omit,
182
+ location: str | Omit = omit,
183
+ num_results: int | Omit = omit,
184
+ page: int | Omit = omit,
185
+ parse: bool | Omit = omit,
186
+ query: str | Omit = omit,
187
+ render: bool | Omit = omit,
188
+ show_hidden_results: bool | Omit = omit,
189
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
190
+ # The extra values given here take precedence over values defined on the client or passed to this method.
191
+ extra_headers: Headers | None = None,
192
+ extra_query: Query | None = None,
193
+ extra_body: Body | None = None,
194
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
195
+ ) -> FastSerpRunResponse:
196
+ """
197
+ Fast SERP
198
+
199
+ Args:
200
+ search_engine: The search engine to query.
201
+
202
+ country: ISO Alpha-2 country code used to access the target search engine (e.g. US, DE,
203
+ GB).
204
+
205
+ device: Device type used for the search request.
206
+
207
+ domain: Top-level domain for the search engine (e.g. "com", "co.uk", "de").
208
+
209
+ locale: Locale used for the search request.
210
+
211
+ location: Geo-location for the search (canonical Google location name).
212
+
213
+ num_results: Number of results to return (1–100).
214
+
215
+ page: The result page number for pagination.
216
+
217
+ parse: When true, the SERP response is parsed into structured JSON.
218
+
219
+ query: The search keyword or phrase to query.
220
+
221
+ render: Whether to render the page in a browser before extracting.
222
+
223
+ show_hidden_results: When true, disables Google result filtering (filter=0) so omitted/duplicate and
224
+ highly similar pages are also returned. Applies to Google search engines.
225
+
226
+ extra_headers: Send extra headers
227
+
228
+ extra_query: Add additional query parameters to the request
229
+
230
+ extra_body: Add additional JSON properties to the request
231
+
232
+ timeout: Override the client-level default timeout for this request, in seconds
233
+ """
234
+ return await self._post(
235
+ "/v1/fast-serp",
236
+ body=await async_maybe_transform(
237
+ {
238
+ "search_engine": search_engine,
239
+ "country": country,
240
+ "device": device,
241
+ "domain": domain,
242
+ "locale": locale,
243
+ "location": location,
244
+ "num_results": num_results,
245
+ "page": page,
246
+ "parse": parse,
247
+ "query": query,
248
+ "render": render,
249
+ "show_hidden_results": show_hidden_results,
250
+ },
251
+ fast_serp_run_params.FastSerpRunParams,
252
+ ),
253
+ options=make_request_options(
254
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
255
+ ),
256
+ cast_to=FastSerpRunResponse,
257
+ )
258
+
259
+
260
+ class FastSerpResourceWithRawResponse:
261
+ def __init__(self, fast_serp: FastSerpResource) -> None:
262
+ self._fast_serp = fast_serp
263
+
264
+ self.run = to_raw_response_wrapper(
265
+ fast_serp.run,
266
+ )
267
+
268
+
269
+ class AsyncFastSerpResourceWithRawResponse:
270
+ def __init__(self, fast_serp: AsyncFastSerpResource) -> None:
271
+ self._fast_serp = fast_serp
272
+
273
+ self.run = async_to_raw_response_wrapper(
274
+ fast_serp.run,
275
+ )
276
+
277
+
278
+ class FastSerpResourceWithStreamingResponse:
279
+ def __init__(self, fast_serp: FastSerpResource) -> None:
280
+ self._fast_serp = fast_serp
281
+
282
+ self.run = to_streamed_response_wrapper(
283
+ fast_serp.run,
284
+ )
285
+
286
+
287
+ class AsyncFastSerpResourceWithStreamingResponse:
288
+ def __init__(self, fast_serp: AsyncFastSerpResource) -> None:
289
+ self._fast_serp = fast_serp
290
+
291
+ self.run = async_to_streamed_response_wrapper(
292
+ fast_serp.run,
293
+ )
@@ -84,6 +84,8 @@ class JobsResource(SyncAPIResource):
84
84
 
85
85
  name: Job name.
86
86
 
87
+ description: Free-text description of the job.
88
+
87
89
  destination: Where a job writes its results.
88
90
 
89
91
  display_name: Human-friendly job name shown in the UI.
@@ -140,6 +142,8 @@ class JobsResource(SyncAPIResource):
140
142
  Update Job
141
143
 
142
144
  Args:
145
+ description: New description.
146
+
143
147
  destination: Where a job writes its results.
144
148
 
145
149
  display_name: New display name.
@@ -376,6 +380,8 @@ class AsyncJobsResource(AsyncAPIResource):
376
380
 
377
381
  name: Job name.
378
382
 
383
+ description: Free-text description of the job.
384
+
379
385
  destination: Where a job writes its results.
380
386
 
381
387
  display_name: Human-friendly job name shown in the UI.
@@ -432,6 +438,8 @@ class AsyncJobsResource(AsyncAPIResource):
432
438
  Update Job
433
439
 
434
440
  Args:
441
+ description: New description.
442
+
435
443
  destination: Where a job writes its results.
436
444
 
437
445
  display_name: New display name.
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Any, cast
5
+ from typing import Any, Optional, cast
6
6
 
7
7
  import httpx
8
8
 
@@ -51,6 +51,8 @@ class RunsResource(SyncAPIResource):
51
51
  *,
52
52
  limit: int | Omit = omit,
53
53
  offset: int | Omit = omit,
54
+ q: Optional[str] | Omit = omit,
55
+ status: Optional[str] | Omit = omit,
54
56
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
55
57
  # The extra values given here take precedence over values defined on the client or passed to this method.
56
58
  extra_headers: Headers | None = None,
@@ -59,7 +61,10 @@ class RunsResource(SyncAPIResource):
59
61
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
60
62
  ) -> RunListResponse:
61
63
  """
62
- List task runs for the caller's workspace and the given agent, newest first.
64
+ List runs for this instance.
65
+
66
+ `status` accepts a lowercase `TaskRunStatusValue` (e.g. "completed") or a
67
+ comma-separated list of them (e.g. "queued,running").
63
68
 
64
69
  Args:
65
70
  extra_headers: Send extra headers
@@ -83,6 +88,8 @@ class RunsResource(SyncAPIResource):
83
88
  {
84
89
  "limit": limit,
85
90
  "offset": offset,
91
+ "q": q,
92
+ "status": status,
86
93
  },
87
94
  run_list_params.RunListParams,
88
95
  ),
@@ -105,6 +112,9 @@ class RunsResource(SyncAPIResource):
105
112
  """
106
113
  Cancel an in-progress or queued run.
107
114
 
115
+ Verb is POST + `/cancel` action segment per the AGENTS-1666 spec (replaces the
116
+ old `DELETE …/runs/{run_id}`).
117
+
108
118
  Args:
109
119
  extra_headers: Send extra headers
110
120
 
@@ -139,9 +149,12 @@ class RunsResource(SyncAPIResource):
139
149
  extra_body: Body | None = None,
140
150
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
141
151
  ) -> RunGetResponse:
142
- """Poll run status.
152
+ """
153
+ Fetch a run by id, scoped to the instance.
143
154
 
144
- Repeat until status is 'completed', 'failed', or 'cancelled'.
155
+ A run resolves only when (run_id, agent_id) match — otherwise 404. This means a
156
+ stale URL with a swapped agent_id won't leak runs across instances even if the
157
+ run_id is real.
145
158
 
146
159
  Args:
147
160
  extra_headers: Send extra headers
@@ -176,10 +189,15 @@ class RunsResource(SyncAPIResource):
176
189
  extra_body: Body | None = None,
177
190
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
178
191
  ) -> RunGetResultResponse:
179
- """Fetch the result for a terminal run.
192
+ """
193
+ Fetch the result for a terminal run on this instance.
180
194
 
181
- Returns 408 if still active, 422 with
182
- `AgentRunFailedResult` if failed.
195
+ Mirrors the previous flat `GET /tasks/runs/:run_id/result` semantics:
196
+
197
+ - 404 when the run doesn't belong to the agent.
198
+ - 408 when the run is still active.
199
+ - 422 (with TaskRunFailedResult body) when the run failed or was cancelled.
200
+ - 200 (with TaskRunResult body) on success.
183
201
 
184
202
  Args:
185
203
  extra_headers: Send extra headers
@@ -219,10 +237,8 @@ class RunsResource(SyncAPIResource):
219
237
  extra_body: Body | None = None,
220
238
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
221
239
  ) -> object:
222
- """Server-Sent Events stream of real-time progress events for a run.
223
-
224
- The run must
225
- have been created with `enable_events=true`.
240
+ """
241
+ SSE stream of real-time progress events for a run on this instance.
226
242
 
227
243
  Args:
228
244
  extra_headers: Send extra headers
@@ -272,6 +288,8 @@ class AsyncRunsResource(AsyncAPIResource):
272
288
  *,
273
289
  limit: int | Omit = omit,
274
290
  offset: int | Omit = omit,
291
+ q: Optional[str] | Omit = omit,
292
+ status: Optional[str] | Omit = omit,
275
293
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
276
294
  # The extra values given here take precedence over values defined on the client or passed to this method.
277
295
  extra_headers: Headers | None = None,
@@ -280,7 +298,10 @@ class AsyncRunsResource(AsyncAPIResource):
280
298
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
281
299
  ) -> RunListResponse:
282
300
  """
283
- List task runs for the caller's workspace and the given agent, newest first.
301
+ List runs for this instance.
302
+
303
+ `status` accepts a lowercase `TaskRunStatusValue` (e.g. "completed") or a
304
+ comma-separated list of them (e.g. "queued,running").
284
305
 
285
306
  Args:
286
307
  extra_headers: Send extra headers
@@ -304,6 +325,8 @@ class AsyncRunsResource(AsyncAPIResource):
304
325
  {
305
326
  "limit": limit,
306
327
  "offset": offset,
328
+ "q": q,
329
+ "status": status,
307
330
  },
308
331
  run_list_params.RunListParams,
309
332
  ),
@@ -326,6 +349,9 @@ class AsyncRunsResource(AsyncAPIResource):
326
349
  """
327
350
  Cancel an in-progress or queued run.
328
351
 
352
+ Verb is POST + `/cancel` action segment per the AGENTS-1666 spec (replaces the
353
+ old `DELETE …/runs/{run_id}`).
354
+
329
355
  Args:
330
356
  extra_headers: Send extra headers
331
357
 
@@ -360,9 +386,12 @@ class AsyncRunsResource(AsyncAPIResource):
360
386
  extra_body: Body | None = None,
361
387
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
362
388
  ) -> RunGetResponse:
363
- """Poll run status.
389
+ """
390
+ Fetch a run by id, scoped to the instance.
364
391
 
365
- Repeat until status is 'completed', 'failed', or 'cancelled'.
392
+ A run resolves only when (run_id, agent_id) match — otherwise 404. This means a
393
+ stale URL with a swapped agent_id won't leak runs across instances even if the
394
+ run_id is real.
366
395
 
367
396
  Args:
368
397
  extra_headers: Send extra headers
@@ -397,10 +426,15 @@ class AsyncRunsResource(AsyncAPIResource):
397
426
  extra_body: Body | None = None,
398
427
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
399
428
  ) -> RunGetResultResponse:
400
- """Fetch the result for a terminal run.
429
+ """
430
+ Fetch the result for a terminal run on this instance.
401
431
 
402
- Returns 408 if still active, 422 with
403
- `AgentRunFailedResult` if failed.
432
+ Mirrors the previous flat `GET /tasks/runs/:run_id/result` semantics:
433
+
434
+ - 404 when the run doesn't belong to the agent.
435
+ - 408 when the run is still active.
436
+ - 422 (with TaskRunFailedResult body) when the run failed or was cancelled.
437
+ - 200 (with TaskRunResult body) on success.
404
438
 
405
439
  Args:
406
440
  extra_headers: Send extra headers
@@ -440,10 +474,8 @@ class AsyncRunsResource(AsyncAPIResource):
440
474
  extra_body: Body | None = None,
441
475
  timeout: float | httpx.Timeout | None | NotGiven = not_given,
442
476
  ) -> object:
443
- """Server-Sent Events stream of real-time progress events for a run.
444
-
445
- The run must
446
- have been created with `enable_events=true`.
477
+ """
478
+ SSE stream of real-time progress events for a run on this instance.
447
479
 
448
480
  Args:
449
481
  extra_headers: Send extra headers