Skip to content

Commit bf85f0b

Browse files
feat: Add async_timeout_seconds to PostInvocations
1 parent eb837b5 commit bf85f0b

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 74
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-3db06d1628149b5ea8303f1c72250664dfd7cb4a14ceb6102f1ae6e85c92c038.yml
3-
openapi_spec_hash: e5b3da2da328eb26d2a70e2521744c62
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-003e9afa15f0765009d2c7d34e8eb62268d818e628e3c84361b21138e30cc423.yml
3+
openapi_spec_hash: c1b8309f60385bf2b02d245363ca47c1
44
config_hash: a4124701ae0a474e580d7416adbcfb00

src/kernel/resources/invocations.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def create(
5757
app_name: str,
5858
version: str,
5959
async_: bool | Omit = omit,
60+
async_timeout_seconds: int | Omit = omit,
6061
payload: str | Omit = omit,
6162
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6263
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -78,6 +79,9 @@ def create(
7879
async_: If true, invoke asynchronously. When set, the API responds 202 Accepted with
7980
status "queued".
8081
82+
async_timeout_seconds: Timeout in seconds for async invocations (min 10, max 3600). Only applies when
83+
async is true.
84+
8185
payload: Input data for the action, sent as a JSON string.
8286
8387
extra_headers: Send extra headers
@@ -96,6 +100,7 @@ def create(
96100
"app_name": app_name,
97101
"version": version,
98102
"async_": async_,
103+
"async_timeout_seconds": async_timeout_seconds,
99104
"payload": payload,
100105
},
101106
invocation_create_params.InvocationCreateParams,
@@ -370,6 +375,7 @@ async def create(
370375
app_name: str,
371376
version: str,
372377
async_: bool | Omit = omit,
378+
async_timeout_seconds: int | Omit = omit,
373379
payload: str | Omit = omit,
374380
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
375381
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -391,6 +397,9 @@ async def create(
391397
async_: If true, invoke asynchronously. When set, the API responds 202 Accepted with
392398
status "queued".
393399
400+
async_timeout_seconds: Timeout in seconds for async invocations (min 10, max 3600). Only applies when
401+
async is true.
402+
394403
payload: Input data for the action, sent as a JSON string.
395404
396405
extra_headers: Send extra headers
@@ -409,6 +418,7 @@ async def create(
409418
"app_name": app_name,
410419
"version": version,
411420
"async_": async_,
421+
"async_timeout_seconds": async_timeout_seconds,
412422
"payload": payload,
413423
},
414424
invocation_create_params.InvocationCreateParams,

src/kernel/types/invocation_create_params.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,11 @@ class InvocationCreateParams(TypedDict, total=False):
2525
When set, the API responds 202 Accepted with status "queued".
2626
"""
2727

28+
async_timeout_seconds: int
29+
"""Timeout in seconds for async invocations (min 10, max 3600).
30+
31+
Only applies when async is true.
32+
"""
33+
2834
payload: str
2935
"""Input data for the action, sent as a JSON string."""

tests/api_resources/test_invocations.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def test_method_create_with_all_params(self, client: Kernel) -> None:
4141
app_name="my-app",
4242
version="1.0.0",
4343
async_=True,
44+
async_timeout_seconds=600,
4445
payload='{"data":"example input"}',
4546
)
4647
assert_matches_type(InvocationCreateResponse, invocation, path=["response"])
@@ -332,6 +333,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncKernel) ->
332333
app_name="my-app",
333334
version="1.0.0",
334335
async_=True,
336+
async_timeout_seconds=600,
335337
payload='{"data":"example input"}',
336338
)
337339
assert_matches_type(InvocationCreateResponse, invocation, path=["response"])

0 commit comments

Comments
 (0)