-
Notifications
You must be signed in to change notification settings - Fork 11
Replace Playwright with Kernel native API in OpenAI CUA templates #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
415546a
Replace Playwright with Kernel native API in OpenAI CUA templates
rgarcia dcb16c7
Improve OpenAI CUA template logging ergonomics and local runner parity.
rgarcia 6f67377
updates
rgarcia effb56c
Update OpenAI computer-use templates for clipboard URL reads and late…
rgarcia a611a9f
Fix remaining PR review issues in CUA templates.
rgarcia a7919d2
Fix URL-read side effects in computer-use templates.
rgarcia c76d318
Merge branch 'main' into rgarcia/cua-native-kernel-api
rgarcia 3f99e7f
Separate deploy entrypoints from local runners and share lifecycle lo…
rgarcia 0e81e18
Handle short drag paths safely in CUA templates.
rgarcia ff8d0c1
Fix key translation bypass in batch actions and add type validation f…
rgarcia 5c70593
Parameterize local CUA template tasks and centralize the computer too…
rgarcia e3b2dff
Fix TypeScript batch key payload modifiers.
rgarcia 44e1533
Align the TypeScript CUA template with the current Responses API.
rgarcia ab1934a
Align the Python CUA template with the current Responses API.
rgarcia 11595f9
Ignore dmux workspace state.
rgarcia eb5d6a1
Refine CUA drag batching guidance and quiet Python transport logs.
rgarcia 16536a0
Add optional replay recording to the OpenAI CUA templates.
rgarcia 9f0f9b5
Harden URL checks in the OpenAI CUA templates.
rgarcia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| # Copy this file to .env and fill in your API key | ||
| # Copy this file to .env and fill in your API keys | ||
| OPENAI_API_KEY=your_openai_api_key_here | ||
| KERNEL_API_KEY=your_kernel_api_key_here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,24 @@ | ||
| # Kernel Python Sample App - OpenAI Computer Use | ||
|
|
||
| This is a Kernel application that demonstrates using the Computer Use Agent (CUA) from OpenAI. | ||
| This is a Kernel application that demonstrates using the Computer Use Agent (CUA) from OpenAI with Kernel's native browser control API. | ||
|
|
||
| It generally follows the [OpenAI CUA Sample App Reference](https://github.com/openai/openai-cua-sample-app) and uses Playwright via Kernel for browser automation. | ||
| It uses Kernel's computer control endpoints (screenshot, click, type, scroll, batch, etc.) instead of Playwright, and includes a `batch_computer_actions` tool that executes multiple actions in a single API call for lower latency. | ||
|
|
||
| See the [docs](https://www.kernel.sh/docs/quickstart) for more information. | ||
| ## Local testing | ||
|
|
||
| You can test against a remote Kernel browser without deploying: | ||
|
|
||
| ```bash | ||
| cp .env.example .env | ||
| # Fill in OPENAI_API_KEY and KERNEL_API_KEY in .env | ||
| uv run test_local.py | ||
| ``` | ||
|
|
||
| ## Deploy to Kernel | ||
|
|
||
| ```bash | ||
| kernel deploy main.py --env-file .env | ||
| kernel invoke python-openai-cua cua-task -p '{"task":"go to https://news.ycombinator.com and list top 5 articles"}' | ||
| ``` | ||
|
|
||
| See the [docs](https://www.kernel.sh/docs/quickstart) for more information. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 2 additions & 6 deletions
8
pkg/templates/python/openai-computer-use/computers/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,7 @@ | ||
| from . import default | ||
| from . import contrib | ||
| from .kernel_computer import KernelComputer | ||
| from .computer import Computer | ||
| from .config import computers_config | ||
|
|
||
| __all__ = [ | ||
| "default", | ||
| "contrib", | ||
| "KernelComputer", | ||
| "Computer", | ||
| "computers_config", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,5 @@ | ||
| from .default import * | ||
| from .contrib import * | ||
| from .kernel_computer import KernelComputer | ||
|
|
||
| computers_config = { | ||
| "local-playwright": LocalPlaywrightBrowser, | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| "kernel": KernelPlaywrightBrowser, | ||
| "kernel": KernelComputer, | ||
| } | ||
2 changes: 0 additions & 2 deletions
2
pkg/templates/python/openai-computer-use/computers/default/__init__.py
This file was deleted.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
pkg/templates/python/openai-computer-use/computers/default/kernel.py
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.