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
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.4.0"
".": "0.5.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
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
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-4502c65bef0843a6ae96d23bba075433af6bab49b55b544b1522f63e7881c00c.yml
openapi_spec_hash: 3e67b77bbc8cd6155b8f66f3271f2643
config_hash: c6bab7ac8da570a5abbcfb19db119b6b
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 0.5.0 (2025-06-03)

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

### Features

* **api:** update via SDK Studio ([6bc85d1](https://github.com/onkernel/kernel-python-sdk/commit/6bc85d1fb74d7c496c02c1bde19129ae07892af7))
* **api:** update via SDK Studio ([007cb3c](https://github.com/onkernel/kernel-python-sdk/commit/007cb3cafc3697743131489bfd46651f246c2e87))
* **client:** add follow_redirects request option ([4db3b7f](https://github.com/onkernel/kernel-python-sdk/commit/4db3b7f7a19af62ac986fcf4482cfe0a5454ca50))


### Chores

* **docs:** remove reference to rye shell ([1f9ea78](https://github.com/onkernel/kernel-python-sdk/commit/1f9ea78913d336137e76aa4d8c83e708ee6b9fd6))

## 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)
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ $ rye sync --all-features
You can then run scripts using `rye run python script.py` or by activating the virtual environment:

```sh
$ rye shell
# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work
# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
$ source .venv/bin/activate

# now you can omit the `rye run` prefix
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.4.0"
version = "0.5.0"
description = "The official Python library for the kernel API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
6 changes: 6 additions & 0 deletions src/kernel/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,9 @@ def request(
if self.custom_auth is not None:
kwargs["auth"] = self.custom_auth

if options.follow_redirects is not None:
kwargs["follow_redirects"] = options.follow_redirects

log.debug("Sending HTTP Request: %s %s", request.method, request.url)

response = None
Expand Down Expand Up @@ -1460,6 +1463,9 @@ async def request(
if self.custom_auth is not None:
kwargs["auth"] = self.custom_auth

if options.follow_redirects is not None:
kwargs["follow_redirects"] = options.follow_redirects

log.debug("Sending HTTP Request: %s %s", request.method, request.url)

response = None
Expand Down
2 changes: 2 additions & 0 deletions src/kernel/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,7 @@ class FinalRequestOptionsInput(TypedDict, total=False):
idempotency_key: str
json_data: Body
extra_json: AnyMapping
follow_redirects: bool


@final
Expand All @@ -750,6 +751,7 @@ class FinalRequestOptions(pydantic.BaseModel):
files: Union[HttpxRequestFiles, None] = None
idempotency_key: Union[str, None] = None
post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven()
follow_redirects: Union[bool, None] = None

# It should be noted that we cannot use `json` here as that would override
# a BaseModel method in an incompatible fashion.
Expand Down
2 changes: 2 additions & 0 deletions src/kernel/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class RequestOptions(TypedDict, total=False):
params: Query
extra_json: AnyMapping
idempotency_key: str
follow_redirects: bool


# Sentinel class used until PEP 0661 is accepted
Expand Down Expand Up @@ -215,3 +216,4 @@ class _GenericAlias(Protocol):

class HttpxSendArgs(TypedDict, total=False):
auth: httpx.Auth
follow_redirects: bool
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.4.0" # x-release-please-version
__version__ = "0.5.0" # x-release-please-version
10 changes: 4 additions & 6 deletions src/kernel/resources/apps/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ def list(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AppListResponse:
"""List application versions for the authenticated user.
"""List applications.

Optionally filter by app
name and/or version label.
Optionally filter by app name and/or version label.

Args:
app_name: Filter results by application name.
Expand Down Expand Up @@ -154,10 +153,9 @@ async def list(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AppListResponse:
"""List application versions for the authenticated user.
"""List applications.

Optionally filter by app
name and/or version label.
Optionally filter by app name and/or version label.

Args:
app_name: Filter results by application name.
Expand Down
4 changes: 2 additions & 2 deletions src/kernel/resources/apps/deployments.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DeploymentCreateResponse:
"""
Deploy a new application
Deploy a new application and associated actions to Kernel.

Args:
entrypoint_rel_path: Relative path to the entrypoint of the application
Expand Down Expand Up @@ -190,7 +190,7 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DeploymentCreateResponse:
"""
Deploy a new application
Deploy a new application and associated actions to Kernel.

Args:
entrypoint_rel_path: Relative path to the entrypoint of the application
Expand Down
12 changes: 6 additions & 6 deletions src/kernel/resources/apps/invocations.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> InvocationCreateResponse:
"""
Invoke an application
Invoke an action.

Args:
action_name: Name of the action to invoke
Expand Down Expand Up @@ -113,7 +113,7 @@ def retrieve(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> InvocationRetrieveResponse:
"""
Get an app invocation by id
Get details about an invocation's status and output.

Args:
extra_headers: Send extra headers
Expand Down Expand Up @@ -148,7 +148,7 @@ def update(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> InvocationUpdateResponse:
"""
Update invocation status or output
Update an invocation's status or output.

Args:
status: New status for the invocation.
Expand Down Expand Up @@ -217,7 +217,7 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> InvocationCreateResponse:
"""
Invoke an application
Invoke an action.

Args:
action_name: Name of the action to invoke
Expand Down Expand Up @@ -269,7 +269,7 @@ async def retrieve(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> InvocationRetrieveResponse:
"""
Get an app invocation by id
Get details about an invocation's status and output.

Args:
extra_headers: Send extra headers
Expand Down Expand Up @@ -304,7 +304,7 @@ async def update(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> InvocationUpdateResponse:
"""
Update invocation status or output
Update an invocation's status or output.

Args:
status: New status for the invocation.
Expand Down
30 changes: 20 additions & 10 deletions src/kernel/resources/browsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def create(
*,
invocation_id: str,
persistence: BrowserPersistenceParam | NotGiven = NOT_GIVEN,
stealth: bool | 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,
Expand All @@ -57,13 +58,16 @@ def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> BrowserCreateResponse:
"""
Create Browser Session
Create a new browser session from within an action.

Args:
invocation_id: action invocation ID

persistence: Optional persistence configuration for the browser session.

stealth: If true, launches the browser in stealth mode to reduce detection by anti-bot
mechanisms.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -78,6 +82,7 @@ def create(
{
"invocation_id": invocation_id,
"persistence": persistence,
"stealth": stealth,
},
browser_create_params.BrowserCreateParams,
),
Expand All @@ -99,7 +104,7 @@ def retrieve(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> BrowserRetrieveResponse:
"""
Get Browser Session by ID
Get information about a browser session.

Args:
extra_headers: Send extra headers
Expand Down Expand Up @@ -130,7 +135,7 @@ def list(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> BrowserListResponse:
"""List active browser sessions for the authenticated user"""
"""List active browser sessions"""
return self._get(
"/browsers",
options=make_request_options(
Expand All @@ -151,7 +156,7 @@ def delete(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""
Delete a persistent browser session by persistent_id query parameter.
Delete a persistent browser session by its persistent_id.

Args:
persistent_id: Persistent browser identifier
Expand Down Expand Up @@ -189,7 +194,7 @@ def delete_by_id(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""
Delete Browser Session by ID
Delete a browser session by ID

Args:
extra_headers: Send extra headers
Expand Down Expand Up @@ -237,6 +242,7 @@ async def create(
*,
invocation_id: str,
persistence: BrowserPersistenceParam | NotGiven = NOT_GIVEN,
stealth: bool | 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,
Expand All @@ -245,13 +251,16 @@ async def create(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> BrowserCreateResponse:
"""
Create Browser Session
Create a new browser session from within an action.

Args:
invocation_id: action invocation ID

persistence: Optional persistence configuration for the browser session.

stealth: If true, launches the browser in stealth mode to reduce detection by anti-bot
mechanisms.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -266,6 +275,7 @@ async def create(
{
"invocation_id": invocation_id,
"persistence": persistence,
"stealth": stealth,
},
browser_create_params.BrowserCreateParams,
),
Expand All @@ -287,7 +297,7 @@ async def retrieve(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> BrowserRetrieveResponse:
"""
Get Browser Session by ID
Get information about a browser session.

Args:
extra_headers: Send extra headers
Expand Down Expand Up @@ -318,7 +328,7 @@ async def list(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> BrowserListResponse:
"""List active browser sessions for the authenticated user"""
"""List active browser sessions"""
return await self._get(
"/browsers",
options=make_request_options(
Expand All @@ -339,7 +349,7 @@ async def delete(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""
Delete a persistent browser session by persistent_id query parameter.
Delete a persistent browser session by its persistent_id.

Args:
persistent_id: Persistent browser identifier
Expand Down Expand Up @@ -379,7 +389,7 @@ async def delete_by_id(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> None:
"""
Delete Browser Session by ID
Delete a browser session by ID

Args:
extra_headers: Send extra headers
Expand Down
6 changes: 6 additions & 0 deletions src/kernel/types/browser_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ class BrowserCreateParams(TypedDict, total=False):

persistence: BrowserPersistenceParam
"""Optional persistence configuration for the browser session."""

stealth: bool
"""
If true, launches the browser in stealth mode to reduce detection by anti-bot
mechanisms.
"""
2 changes: 2 additions & 0 deletions tests/api_resources/test_browsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def test_method_create_with_all_params(self, client: Kernel) -> None:
browser = client.browsers.create(
invocation_id="rr33xuugxj9h0bkf1rdt2bet",
persistence={"id": "my-awesome-browser-for-user-1234"},
stealth=True,
)
assert_matches_type(BrowserCreateResponse, browser, path=["response"])

Expand Down Expand Up @@ -228,6 +229,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncKernel) ->
browser = await async_client.browsers.create(
invocation_id="rr33xuugxj9h0bkf1rdt2bet",
persistence={"id": "my-awesome-browser-for-user-1234"},
stealth=True,
)
assert_matches_type(BrowserCreateResponse, browser, path=["response"])

Expand Down
Loading