Skip to content

Commit d7a6ec8

Browse files
Danny/kernel 685 add oagi cua python template to kernel cli (#55)
## Summary - Add new **OpenAGI Computer Use** Python template powered by OpenAGI's Lux models (`lux-actor-1` and `lux-thinker-1`), featuring two agent types: `AsyncDefaultAgent` for high-level immediate execution and `TaskerAgent` for structured workflows with predefined steps > **Note:** Required mocking `pyautogui` and `mouseinfo` modules to prevent X11 connection attempts at import time—the OAGI SDK imports these internally, but they're unused in Kernel's deployed environment. - Standardize computer use template naming convention across all providers (e.g., `cua` → `openai-computer-use`, `computer-use` → `anthropic-computer-use`, `gemini-cua` → `gemini-computer-use`) - Unify template descriptions and action names for consistency (e.g., `cu-task` → `cua-task`) > **Note:** If preferred, I can split this PR into two separate PRs—one for the naming convention changes and one for the OpenAGI template addition. Let me know! ## Test plan - [x] Verify `kernel create` shows the new OpenAGI template in Python language options - [x] Test creating a new project with the OpenAGI template: `kernel create --template openagi-computer-use --language python` - [ ] Confirm renamed templates still work correctly (`anthropic-computer-use`, `openai-computer-use`, `gemini-computer-use`) - [x] Anthropic - [x] OpenAI - [ ] Gemini -> Seems to fail due to using stagehand v3 library version now when it's built for stagehand v2. I believe this is unrelated to the changes in this repo though as the deployment builds and the invocation starts as expected before failing. Planning to fix in another PR if that works. - [x] Deploy and invoke the OpenAGI template with both agent types: kernel invoke python-openagi-cua openagi-default-task -p '{"instruction": "Navigate to https://agiopen.org"}' kernel invoke python-openagi-cua openagi-tasker-task -p '{"task": "...", "todos": [...]}' <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds a new Python OpenAGI computer-use template and renames/standardizes Anthropic/OpenAI/Gemini computer-use templates (incl. actions, app names, and commands) across code, docs, and tests. > > - **Templates**: > - **New**: `python/openagi-computer-use` (AsyncDefaultAgent, TaskerAgent, replay recording; requires `OAGI_API_KEY`). > - **Standardization/Renames**: > - `computer-use` → `anthropic-computer-use` (TS/Python). > - `cua` → `openai-computer-use` (TS/Python). > - `gemini-cua` → `gemini-computer-use` (TS only). > - Unified action name `cu-task` → `cua-task`; app/package names updated (e.g., `ts-cu` → `ts-anthropic-cua`, `python-cua` → `python-openai-cua`). > - **CLI/Code**: > - Update template constants/map, display ordering (prioritize Anthropic/OpenAI/Gemini), and per-template deploy/invoke commands. > - Adjust file copy tests to new template keys; fix tests for Gemini availability on Python. > - **Docs**: > - README and QA guide: refreshed template matrix, create/deploy/invoke commands, env vars; added optional automated runtime testing; checklist updated to 13 apps including OpenAGI. > - **Template Sources**: > - TS/Python template files updated to new app IDs and action names; Gemini/OpenAI/Anthropic READMEs retitled. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit febd317. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor Agent <[email protected]>
1 parent 91cafac commit d7a6ec8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+2737
-99
lines changed

.cursor/commands/qa.md

Lines changed: 84 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,21 @@ Use the built CLI binary with non-interactive flags. The command format is:
4848

4949
Here are all valid language + template combinations:
5050

51-
| Language | Template | Folder Name | Needs Env File | Required Env Vars |
52-
| ---------- | -------------- | ----------------- | -------------- | ------------------------------ |
53-
| typescript | sample-app | ts-sample-app | No | - |
54-
| typescript | captcha-solver | ts-captcha-solver | No | - |
55-
| typescript | stagehand | ts-stagehand | Yes | OPENAI_API_KEY |
56-
| typescript | computer-use | ts-computer-use | Yes | ANTHROPIC_API_KEY |
57-
| typescript | magnitude | ts-magnitude | Yes | ANTHROPIC_API_KEY |
58-
| typescript | cua | ts-cua | Yes | OPENAI_API_KEY |
59-
| typescript | gemini-cua | ts-gemini-cua | Yes | GOOGLE_API_KEY, OPENAI_API_KEY |
60-
| python | sample-app | py-sample-app | No | - |
61-
| python | captcha-solver | py-captcha-solver | No | - |
62-
| python | browser-use | py-browser-use | Yes | OPENAI_API_KEY |
63-
| python | computer-use | py-computer-use | Yes | ANTHROPIC_API_KEY |
64-
| python | cua | py-cua | Yes | OPENAI_API_KEY |
51+
| Language | Template | Folder Name | Deployed App Name | Needs Env File | Required Env Vars |
52+
| ---------- | ---------------------- | ----------------- | --------------------- | -------------- | ------------------------------ |
53+
| typescript | sample-app | ts-sample-app | ts-basic | No | - |
54+
| typescript | captcha-solver | ts-captcha-solver | ts-captcha-solver | No | - |
55+
| typescript | stagehand | ts-stagehand | ts-stagehand | Yes | OPENAI_API_KEY |
56+
| typescript | anthropic-computer-use | ts-anthropic-cua | ts-anthropic-cua | Yes | ANTHROPIC_API_KEY |
57+
| typescript | magnitude | ts-magnitude | ts-magnitude | Yes | ANTHROPIC_API_KEY |
58+
| typescript | openai-computer-use | ts-openai-cua | ts-openai-cua | Yes | OPENAI_API_KEY |
59+
| typescript | gemini-computer-use | ts-gemini-cua | ts-gemini-cua | Yes | GOOGLE_API_KEY, OPENAI_API_KEY |
60+
| python | sample-app | py-sample-app | python-basic | No | - |
61+
| python | captcha-solver | py-captcha-solver | python-captcha-solver | No | - |
62+
| python | browser-use | py-browser-use | python-bu | Yes | OPENAI_API_KEY |
63+
| python | anthropic-computer-use | py-anthropic-cua | python-anthropic-cua | Yes | ANTHROPIC_API_KEY |
64+
| python | openai-computer-use | py-openai-cua | python-openai-cua | Yes | OPENAI_API_KEY |
65+
| python | openagi-computer-use | py-openagi-cua | python-openagi-cua | Yes | OAGI_API_KEY |
6566

6667
### Create Commands
6768

@@ -72,17 +73,18 @@ Run each of these (they are non-interactive when all flags are provided):
7273
../bin/kernel create -n ts-sample-app -l typescript -t sample-app
7374
../bin/kernel create -n ts-captcha-solver -l typescript -t captcha-solver
7475
../bin/kernel create -n ts-stagehand -l typescript -t stagehand
75-
../bin/kernel create -n ts-computer-use -l typescript -t computer-use
76+
../bin/kernel create -n ts-anthropic-cua -l typescript -t anthropic-computer-use
7677
../bin/kernel create -n ts-magnitude -l typescript -t magnitude
77-
../bin/kernel create -n ts-cua -l typescript -t cua
78-
../bin/kernel create -n ts-gemini-cua -l typescript -t gemini-cua
78+
../bin/kernel create -n ts-openai-cua -l typescript -t openai-computer-use
79+
../bin/kernel create -n ts-gemini-cua -l typescript -t gemini-computer-use
7980

8081
# Python templates
8182
../bin/kernel create -n py-sample-app -l python -t sample-app
8283
../bin/kernel create -n py-captcha-solver -l python -t captcha-solver
8384
../bin/kernel create -n py-browser-use -l python -t browser-use
84-
../bin/kernel create -n py-computer-use -l python -t computer-use
85-
../bin/kernel create -n py-cua -l python -t cua
85+
../bin/kernel create -n py-anthropic-cua -l python -t anthropic-computer-use
86+
../bin/kernel create -n py-openai-cua -l python -t openai-computer-use
87+
../bin/kernel create -n py-openagi-cua -l python -t openagi-computer-use
8688
```
8789

8890
## Step 5: Deploy Each Template
@@ -125,10 +127,10 @@ echo "OPENAI_API_KEY=<value from human>" > .env
125127
cd ..
126128
```
127129

128-
**ts-computer-use** (needs ANTHROPIC_API_KEY):
130+
**ts-anthropic-cua** (needs ANTHROPIC_API_KEY):
129131

130132
```bash
131-
cd ts-computer-use
133+
cd ts-anthropic-cua
132134
echo "ANTHROPIC_API_KEY=<value from human>" > .env
133135
../bin/kernel deploy index.ts --env-file .env
134136
cd ..
@@ -143,10 +145,10 @@ echo "ANTHROPIC_API_KEY=<value from human>" > .env
143145
cd ..
144146
```
145147

146-
**ts-cua** (needs OPENAI_API_KEY):
148+
**ts-openai-cua** (needs OPENAI_API_KEY):
147149

148150
```bash
149-
cd ts-cua
151+
cd ts-openai-cua
150152
echo "OPENAI_API_KEY=<value from human>" > .env
151153
../bin/kernel deploy index.ts --env-file .env
152154
cd ..
@@ -173,24 +175,33 @@ echo "OPENAI_API_KEY=<value from human>" > .env
173175
cd ..
174176
```
175177

176-
**py-computer-use** (needs ANTHROPIC_API_KEY):
178+
**py-anthropic-cua** (needs ANTHROPIC_API_KEY):
177179

178180
```bash
179-
cd py-computer-use
181+
cd py-anthropic-cua
180182
echo "ANTHROPIC_API_KEY=<value from human>" > .env
181183
../bin/kernel deploy main.py --env-file .env
182184
cd ..
183185
```
184186

185-
**py-cua** (needs OPENAI_API_KEY):
187+
**py-openai-cua** (needs OPENAI_API_KEY):
186188

187189
```bash
188-
cd py-cua
190+
cd py-openai-cua
189191
echo "OPENAI_API_KEY=<value from human>" > .env
190192
../bin/kernel deploy main.py --env-file .env
191193
cd ..
192194
```
193195

196+
**py-openagi-cua** (needs OAGI_API_KEY):
197+
198+
```bash
199+
cd py-openagi-cua
200+
echo "OAGI_API_KEY=<value from human>" > .env
201+
../bin/kernel deploy main.py --env-file .env
202+
cd ..
203+
```
204+
194205
## Step 6: Provide Invoke Commands
195206

196207
Once all deployments are complete, present the human with these invoke commands to test manually:
@@ -200,28 +211,67 @@ Once all deployments are complete, present the human with these invoke commands
200211
kernel invoke ts-basic get-page-title --payload '{"url": "https://www.google.com"}'
201212
kernel invoke ts-captcha-solver test-captcha-solver
202213
kernel invoke ts-stagehand teamsize-task --payload '{"company": "Kernel"}'
203-
kernel invoke ts-cu cu-task --payload '{"query": "Return the first url of a search result for NYC restaurant reviews Pete Wells"}'
214+
kernel invoke ts-anthropic-cua cua-task --payload '{"query": "Return the first url of a search result for NYC restaurant reviews Pete Wells"}'
204215
kernel invoke ts-magnitude mag-url-extract --payload '{"url": "https://en.wikipedia.org/wiki/Special:Random"}'
205-
kernel invoke ts-cua cua-task --payload '{"task": "Go to https://news.ycombinator.com and get the top 5 articles"}'
216+
kernel invoke ts-openai-cua cua-task --payload '{"task": "Go to https://news.ycombinator.com and get the top 5 articles"}'
206217
kernel invoke ts-gemini-cua gemini-cua-task
207218

208219
# Python apps
209220
kernel invoke python-basic get-page-title --payload '{"url": "https://www.google.com"}'
210221
kernel invoke python-captcha-solver test-captcha-solver
211222
kernel invoke python-bu bu-task --payload '{"task": "Compare the price of gpt-4o and DeepSeek-V3"}'
212-
kernel invoke python-cu cu-task --payload '{"query": "Return the first url of a search result for NYC restaurant reviews Pete Wells"}'
213-
kernel invoke python-cua cua-task --payload '{"task": "Go to https://news.ycombinator.com and get the top 5 articles"}'
223+
kernel invoke python-anthropic-cua cua-task --payload '{"query": "Return the first url of a search result for NYC restaurant reviews Pete Wells"}'
224+
kernel invoke python-openai-cua cua-task --payload '{"task": "Go to https://news.ycombinator.com and get the top 5 articles"}'
225+
kernel invoke python-openagi-cua openagi-default-task -p '{"instruction": "Navigate to https://agiopen.org and click the What is Computer Use? button"}'
214226
```
215227

228+
## Step 7: Automated Runtime Testing (Optional)
229+
230+
**STOP and ask the human:** "Would you like me to automatically invoke all 13 templates and report back on their runtime status?"
231+
232+
If the human agrees, invoke each template and collect results. Present findings in this format:
233+
234+
### Testing Guidelines
235+
236+
- **Timeout:** Cancel each invocation after 90 seconds if it has not completed. Mark the status as `TIMEOUT` in the results table.
237+
- **Parallel execution:** You may run multiple invocations in parallel to speed up testing.
238+
- **Error handling:** Capture any runtime errors and include them in the Notes column.
239+
240+
### Test Results
241+
242+
| Template | App Name | Status | Notes |
243+
| ----------------- | --------------------- | ------- | ----- |
244+
| ts-sample-app | ts-basic | | |
245+
| ts-captcha-solver | ts-captcha-solver | | |
246+
| ts-stagehand | ts-stagehand | | |
247+
| ts-anthropic-cua | ts-anthropic-cua | | |
248+
| ts-magnitude | ts-magnitude | | |
249+
| ts-openai-cua | ts-openai-cua | | |
250+
| ts-gemini-cua | ts-gemini-cua | | |
251+
| py-sample-app | python-basic | | |
252+
| py-captcha-solver | python-captcha-solver | | |
253+
| py-browser-use | python-bu | | |
254+
| py-anthropic-cua | python-anthropic-cua | | |
255+
| py-openai-cua | python-openai-cua | | |
256+
| py-openagi-cua | python-openagi-cua | | |
257+
258+
Status values:
259+
- **SUCCESS**: App started and returned a result
260+
- **FAILED**: App encountered a runtime error
261+
- **TIMEOUT**: App did not complete within 90 seconds (cancelled)
262+
263+
Notes should include brief error messages for failures or confirmation of successful output.
264+
216265
## Summary Checklist
217266

218267
- [ ] Built CLI with `make build`
219268
- [ ] Created QA directory
220269
- [ ] Got KERNEL_API_KEY from human
221-
- [ ] Created all 12 template variations
222-
- [ ] Got required API keys from human (OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY)
223-
- [ ] Deployed all 12 apps
270+
- [ ] Created all 13 template variations
271+
- [ ] Got required API keys from human (OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY, OAGI_API_KEY)
272+
- [ ] Deployed all 13 apps
224273
- [ ] Provided invoke commands to human for manual testing
274+
- [ ] (Optional) Ran automated runtime testing and reviewed results
225275

226276
## Cleanup
227277

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,13 @@ Create an API key from the [Kernel dashboard](https://dashboard.onkernel.com).
116116
- `--language <language>`, `-l` - Sepecify app language: `typescript`, or `python`
117117
- `--template <template>`, `-t` - Template to use:
118118
- `sample-app` - Basic template with Playwright integration
119-
- `advanced-sample` - Sample apps using advanced Kernel configs
119+
- `captcha-solver` - Template demonstrating Kernel's auto-CAPTCHA solver
120120
- `stagehand` - Template with Stagehand SDK (TypeScript only)
121121
- `browser-use` - Template with Browser Use SDK (Python only)
122-
- `computer-use` - Anthropic Computer Use prompt loop
123-
- `cua` - OpenAI Computer Using Agent (CUA) sample
124-
- `gemini-cua` - Google Gemini CUA sample (TypeScript only)
122+
- `anthropic-computer-use` - Anthropic Computer Use prompt loop
123+
- `openai-computer-use` - OpenAI Computer Use Agent sample
124+
- `gemini-computer-use` - Gemini Computer Use Agent sample (TypeScript only)
125+
- `openagi-computer-use` - OpenAGI Lux computer-use models (Python only)
125126
- `magnitude` - Magnitude framework sample (TypeScript only)
126127

127128
### App Deployment
@@ -393,7 +394,7 @@ kernel create --name my-scraper --language python --template browser-use
393394
kernel create --name my-agent --language ts --template stagehand
394395

395396
# Create a Python Computer Use app
396-
kernel create --name my-cu-app --language py --template computer-use
397+
kernel create --name my-cu-app --language py --template anthropic-computer-use
397398
```
398399

399400
### Deploy with environment variables

cmd/create_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,10 @@ func TestCreateCommand_InvalidLanguageTemplateCombinations(t *testing.T) {
440440
errContains: "template not found: python/magnitude",
441441
},
442442
{
443-
name: "gemini-cua not available for python",
443+
name: "gemini-computer-use not available for python",
444444
language: create.LanguagePython,
445-
template: create.TemplateGeminiCUA,
446-
errContains: "template not found: python/gemini-cua",
445+
template: create.TemplateGeminiComputerUse,
446+
errContains: "template not found: python/gemini-computer-use",
447447
},
448448
{
449449
name: "invalid language",
@@ -558,7 +558,7 @@ func TestCreateCommand_TemplateNotAvailableForLanguage(t *testing.T) {
558558
create.TemplateBrowserUse: {create.LanguageTypeScript},
559559
create.TemplateStagehand: {create.LanguagePython},
560560
create.TemplateMagnitude: {create.LanguagePython},
561-
create.TemplateGeminiCUA: {create.LanguagePython},
561+
create.TemplateGeminiComputerUse: {create.LanguagePython},
562562
}
563563

564564
for template, unavailableLanguages := range unavailableCombinations {

pkg/create/copy_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ func TestCopyTemplateFiles_PreservesDirectoryStructure(t *testing.T) {
179179
require.NoError(t, err)
180180

181181
// Use a template that has subdirectories
182-
err = CopyTemplateFiles(appPath, LanguageTypeScript, TemplateComputerUse)
182+
err = CopyTemplateFiles(appPath, LanguageTypeScript, TemplateAnthropicComputerUse)
183183
require.NoError(t, err)
184184

185-
// Verify that subdirectories are created (computer-use has src/ directory)
185+
// Verify that subdirectories are created (anthropic-computer-use has src/ directory)
186186
srcDir := filepath.Join(appPath, "src")
187187
if _, err := os.Stat(srcDir); err == nil {
188188
assert.DirExists(t, srcDir, "Subdirectories should be preserved")

0 commit comments

Comments
 (0)