Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .cursor/environment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"snapshot": "snapshot-20250522-bd1c3d88-262b-44dc-bd01-cb8e8b262337",
"install": "export GOPRIVATE=github.com/onkernel/kernel-go-sdk;\n\n/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"\n",
"terminals": []
}
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.3.0"
".": "0.4.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 10
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-3edc7a0eef4a0d4495782efbdb0d9b777a55aee058dab119f90de56019441326.yml
openapi_spec_hash: dff0b1efa1c1614cf770ed8327cefab2
config_hash: cb04a4d88ee9f530b303ca57ff7090b3
configured_endpoints: 11
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-64ccdff4ca5d73d79d89e817fe83ccfd3d529696df3e6818c3c75e586ae00801.yml
openapi_spec_hash: 21c7b8757fc0cc9415cda1bc06251de6
config_hash: b3fcacd707da56b21d31ce0baf4fb87d
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.4.0 (2025-05-28)

Full Changelog: [v0.3.0...v0.4.0](https://github.com/onkernel/kernel-python-sdk/compare/v0.3.0...v0.4.0)

### Features

* **api:** update via SDK Studio ([eda6c2c](https://github.com/onkernel/kernel-python-sdk/commit/eda6c2c9ec1f585b8546c629bb661f0f9a9e9c04))

## 0.3.0 (2025-05-22)

Full Changelog: [v0.2.0...v0.3.0](https://github.com/onkernel/kernel-python-sdk/compare/v0.2.0...v0.3.0)
Expand Down
7 changes: 6 additions & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,18 @@ Methods:
Types:

```python
from kernel.types.apps import InvocationCreateResponse, InvocationRetrieveResponse
from kernel.types.apps import (
InvocationCreateResponse,
InvocationRetrieveResponse,
InvocationUpdateResponse,
)
```

Methods:

- <code title="post /invocations">client.apps.invocations.<a href="./src/kernel/resources/apps/invocations.py">create</a>(\*\*<a href="src/kernel/types/apps/invocation_create_params.py">params</a>) -> <a href="./src/kernel/types/apps/invocation_create_response.py">InvocationCreateResponse</a></code>
- <code title="get /invocations/{id}">client.apps.invocations.<a href="./src/kernel/resources/apps/invocations.py">retrieve</a>(id) -> <a href="./src/kernel/types/apps/invocation_retrieve_response.py">InvocationRetrieveResponse</a></code>
- <code title="patch /invocations/{id}">client.apps.invocations.<a href="./src/kernel/resources/apps/invocations.py">update</a>(id, \*\*<a href="src/kernel/types/apps/invocation_update_params.py">params</a>) -> <a href="./src/kernel/types/apps/invocation_update_response.py">InvocationUpdateResponse</a></code>

# Browsers

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "kernel"
version = "0.3.0"
version = "0.4.0"
description = "The official Python library for the kernel API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/kernel/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "kernel"
__version__ = "0.3.0" # x-release-please-version
__version__ = "0.4.0" # x-release-please-version
119 changes: 118 additions & 1 deletion src/kernel/resources/apps/invocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from __future__ import annotations

from typing_extensions import Literal

import httpx

from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
Expand All @@ -14,9 +16,10 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from ...types.apps import invocation_create_params
from ...types.apps import invocation_create_params, invocation_update_params
from ..._base_client import make_request_options
from ...types.apps.invocation_create_response import InvocationCreateResponse
from ...types.apps.invocation_update_response import InvocationUpdateResponse
from ...types.apps.invocation_retrieve_response import InvocationRetrieveResponse

__all__ = ["InvocationsResource", "AsyncInvocationsResource"]
Expand Down Expand Up @@ -48,6 +51,7 @@ def create(
action_name: str,
app_name: str,
version: str,
async_: bool | NotGiven = NOT_GIVEN,
payload: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -66,6 +70,9 @@ def create(

version: Version of the application

async_: If true, invoke asynchronously. When set, the API responds 202 Accepted with
status "queued".

payload: Input data for the action, sent as a JSON string.

extra_headers: Send extra headers
Expand All @@ -83,6 +90,7 @@ def create(
"action_name": action_name,
"app_name": app_name,
"version": version,
"async_": async_,
"payload": payload,
},
invocation_create_params.InvocationCreateParams,
Expand Down Expand Up @@ -126,6 +134,52 @@ def retrieve(
cast_to=InvocationRetrieveResponse,
)

def update(
self,
id: str,
*,
status: Literal["succeeded", "failed"],
output: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> InvocationUpdateResponse:
"""
Update invocation status or output

Args:
status: New status for the invocation.

output: Updated output of the invocation rendered as JSON string.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._patch(
f"/invocations/{id}",
body=maybe_transform(
{
"status": status,
"output": output,
},
invocation_update_params.InvocationUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=InvocationUpdateResponse,
)


class AsyncInvocationsResource(AsyncAPIResource):
@cached_property
Expand Down Expand Up @@ -153,6 +207,7 @@ async def create(
action_name: str,
app_name: str,
version: str,
async_: bool | NotGiven = NOT_GIVEN,
payload: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -171,6 +226,9 @@ async def create(

version: Version of the application

async_: If true, invoke asynchronously. When set, the API responds 202 Accepted with
status "queued".

payload: Input data for the action, sent as a JSON string.

extra_headers: Send extra headers
Expand All @@ -188,6 +246,7 @@ async def create(
"action_name": action_name,
"app_name": app_name,
"version": version,
"async_": async_,
"payload": payload,
},
invocation_create_params.InvocationCreateParams,
Expand Down Expand Up @@ -231,6 +290,52 @@ async def retrieve(
cast_to=InvocationRetrieveResponse,
)

async def update(
self,
id: str,
*,
status: Literal["succeeded", "failed"],
output: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> InvocationUpdateResponse:
"""
Update invocation status or output

Args:
status: New status for the invocation.

output: Updated output of the invocation rendered as JSON string.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not id:
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._patch(
f"/invocations/{id}",
body=await async_maybe_transform(
{
"status": status,
"output": output,
},
invocation_update_params.InvocationUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=InvocationUpdateResponse,
)


class InvocationsResourceWithRawResponse:
def __init__(self, invocations: InvocationsResource) -> None:
Expand All @@ -242,6 +347,9 @@ def __init__(self, invocations: InvocationsResource) -> None:
self.retrieve = to_raw_response_wrapper(
invocations.retrieve,
)
self.update = to_raw_response_wrapper(
invocations.update,
)


class AsyncInvocationsResourceWithRawResponse:
Expand All @@ -254,6 +362,9 @@ def __init__(self, invocations: AsyncInvocationsResource) -> None:
self.retrieve = async_to_raw_response_wrapper(
invocations.retrieve,
)
self.update = async_to_raw_response_wrapper(
invocations.update,
)


class InvocationsResourceWithStreamingResponse:
Expand All @@ -266,6 +377,9 @@ def __init__(self, invocations: InvocationsResource) -> None:
self.retrieve = to_streamed_response_wrapper(
invocations.retrieve,
)
self.update = to_streamed_response_wrapper(
invocations.update,
)


class AsyncInvocationsResourceWithStreamingResponse:
Expand All @@ -278,3 +392,6 @@ def __init__(self, invocations: AsyncInvocationsResource) -> None:
self.retrieve = async_to_streamed_response_wrapper(
invocations.retrieve,
)
self.update = async_to_streamed_response_wrapper(
invocations.update,
)
2 changes: 2 additions & 0 deletions src/kernel/types/apps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

from .deployment_create_params import DeploymentCreateParams as DeploymentCreateParams
from .invocation_create_params import InvocationCreateParams as InvocationCreateParams
from .invocation_update_params import InvocationUpdateParams as InvocationUpdateParams
from .deployment_create_response import DeploymentCreateResponse as DeploymentCreateResponse
from .deployment_follow_response import DeploymentFollowResponse as DeploymentFollowResponse
from .invocation_create_response import InvocationCreateResponse as InvocationCreateResponse
from .invocation_update_response import InvocationUpdateResponse as InvocationUpdateResponse
from .invocation_retrieve_response import InvocationRetrieveResponse as InvocationRetrieveResponse
10 changes: 9 additions & 1 deletion src/kernel/types/apps/invocation_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

from __future__ import annotations

from typing_extensions import Required, TypedDict
from typing_extensions import Required, Annotated, TypedDict

from ..._utils import PropertyInfo

__all__ = ["InvocationCreateParams"]

Expand All @@ -17,5 +19,11 @@ class InvocationCreateParams(TypedDict, total=False):
version: Required[str]
"""Version of the application"""

async_: Annotated[bool, PropertyInfo(alias="async")]
"""If true, invoke asynchronously.

When set, the API responds 202 Accepted with status "queued".
"""

payload: str
"""Input data for the action, sent as a JSON string."""
15 changes: 15 additions & 0 deletions src/kernel/types/apps/invocation_update_params.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import Literal, Required, TypedDict

__all__ = ["InvocationUpdateParams"]


class InvocationUpdateParams(TypedDict, total=False):
status: Required[Literal["succeeded", "failed"]]
"""New status for the invocation."""

output: str
"""Updated output of the invocation rendered as JSON string."""
47 changes: 47 additions & 0 deletions src/kernel/types/apps/invocation_update_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from datetime import datetime
from typing_extensions import Literal

from ..._models import BaseModel

__all__ = ["InvocationUpdateResponse"]


class InvocationUpdateResponse(BaseModel):
id: str
"""ID of the invocation"""

action_name: str
"""Name of the action invoked"""

app_name: str
"""Name of the application"""

started_at: datetime
"""RFC 3339 Nanoseconds timestamp when the invocation started"""

status: Literal["queued", "running", "succeeded", "failed"]
"""Status of the invocation"""

finished_at: Optional[datetime] = None
"""
RFC 3339 Nanoseconds timestamp when the invocation finished (null if still
running)
"""

output: Optional[str] = None
"""Output produced by the action, rendered as a JSON string.

This could be: string, number, boolean, array, object, or null.
"""

payload: Optional[str] = None
"""Payload provided to the invocation.

This is a string that can be parsed as JSON.
"""

status_reason: Optional[str] = None
"""Status reason"""
Loading