-
Notifications
You must be signed in to change notification settings - Fork 9
Danny/kernel 685 add oagi cua python template to kernel cli #55
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
Changes from 13 commits
c7e0c70
fc7608d
e43f922
5c6d0a5
c4fdf45
281411a
b13461a
cddc3e8
727dd3b
2ecc055
2d5d8d5
e4c47d3
bf92804
80f6df3
7acb017
febd317
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,14 +8,15 @@ import ( | |
|
|
||
| // Template key constants | ||
| const ( | ||
| TemplateSampleApp = "sample-app" | ||
| TemplateCaptchaSolver = "captcha-solver" | ||
| TemplateComputerUse = "computer-use" | ||
| TemplateCUA = "cua" | ||
| TemplateMagnitude = "magnitude" | ||
| TemplateGeminiCUA = "gemini-cua" | ||
| TemplateBrowserUse = "browser-use" | ||
| TemplateStagehand = "stagehand" | ||
| TemplateSampleApp = "sample-app" | ||
| TemplateCaptchaSolver = "captcha-solver" | ||
| TemplateAnthropicComputerUse = "anthropic-computer-use" | ||
| TemplateOpenAIComputerUse = "openai-computer-use" | ||
| TemplateMagnitude = "magnitude" | ||
| TemplateGeminiComputerUse = "gemini-computer-use" | ||
| TemplateBrowserUse = "browser-use" | ||
| TemplateStagehand = "stagehand" | ||
| TemplateOpenAGIComputerUse = "openagi-computer-use" | ||
| ) | ||
|
|
||
| type TemplateInfo struct { | ||
|
|
@@ -42,24 +43,24 @@ var Templates = map[string]TemplateInfo{ | |
| Description: "Demo of Kernel's auto-CAPTCHA solving capability", | ||
| Languages: []string{LanguageTypeScript, LanguagePython}, | ||
| }, | ||
| TemplateComputerUse: { | ||
| Name: "Computer Use", | ||
| Description: "Implements the Anthropic Computer Use SDK", | ||
| TemplateAnthropicComputerUse: { | ||
| Name: "Anthropic Computer Use", | ||
| Description: "Implements an Anthropic computer use agent", | ||
| Languages: []string{LanguageTypeScript, LanguagePython}, | ||
| }, | ||
| TemplateCUA: { | ||
| Name: "CUA Sample", | ||
| Description: "Implements a Computer Use Agent (OpenAI CUA) sample", | ||
| TemplateOpenAIComputerUse: { | ||
| Name: "OpenAI Computer Use", | ||
| Description: "Implements an OpenAI computer use agent", | ||
| Languages: []string{LanguageTypeScript, LanguagePython}, | ||
| }, | ||
| TemplateMagnitude: { | ||
| Name: "Magnitude", | ||
| Description: "Implements the Magnitude.run SDK", | ||
| Languages: []string{LanguageTypeScript}, | ||
| }, | ||
| TemplateGeminiCUA: { | ||
| Name: "Gemini CUA", | ||
| Description: "Implements Gemini 2.5 Computer Use Agent", | ||
| TemplateGeminiComputerUse: { | ||
| Name: "Gemini Computer Use", | ||
| Description: "Implements a Gemini computer use agent", | ||
| Languages: []string{LanguageTypeScript}, | ||
| }, | ||
| TemplateBrowserUse: { | ||
|
|
@@ -72,6 +73,11 @@ var Templates = map[string]TemplateInfo{ | |
| Description: "Implements the Stagehand v3 SDK", | ||
| Languages: []string{LanguageTypeScript}, | ||
| }, | ||
| TemplateOpenAGIComputerUse: { | ||
| Name: "OpenAGI Computer Use", | ||
| Description: "Implements an OpenAGI computer use agent", | ||
| Languages: []string{LanguagePython}, | ||
| }, | ||
| } | ||
|
|
||
| // GetSupportedTemplatesForLanguage returns a list of all supported template names for a given language | ||
|
|
@@ -87,12 +93,23 @@ func GetSupportedTemplatesForLanguage(language string) TemplateKeyValues { | |
| } | ||
|
|
||
| sort.Slice(templates, func(i, j int) bool { | ||
| // Put computer-use first, then sort alphabetically | ||
| if templates[i].Key == TemplateComputerUse { | ||
| return true | ||
| // Put computer-use templates first (Anthropic/OpenAI/Gemini), then sort alphabetically. | ||
| priority := func(key string) int { | ||
| switch key { | ||
| case TemplateAnthropicComputerUse: | ||
| return 0 | ||
| case TemplateOpenAIComputerUse: | ||
| return 1 | ||
| case TemplateGeminiComputerUse: | ||
| return 2 | ||
| default: | ||
| return 10 | ||
| } | ||
| } | ||
| if templates[j].Key == TemplateComputerUse { | ||
| return false | ||
|
|
||
| pi, pj := priority(templates[i].Key), priority(templates[j].Key) | ||
| if pi != pj { | ||
| return pi < pj | ||
| } | ||
| return templates[i].Key < templates[j].Key | ||
| }) | ||
|
|
@@ -152,22 +169,22 @@ var Commands = map[string]map[string]DeployConfig{ | |
| NeedsEnvFile: true, | ||
| InvokeCommand: `kernel invoke ts-stagehand teamsize-task --payload '{"company": "Kernel"}'`, | ||
| }, | ||
| TemplateComputerUse: { | ||
| TemplateAnthropicComputerUse: { | ||
| EntryPoint: "index.ts", | ||
| NeedsEnvFile: true, | ||
| InvokeCommand: `kernel invoke ts-cu cu-task --payload '{"query": "Return the first url of a search result for NYC restaurant reviews Pete Wells"}'`, | ||
| InvokeCommand: `kernel invoke ts-anthropic-cua cua-task --payload '{"query": "Return the first url of a search result for NYC restaurant reviews Pete Wells"}'`, | ||
| }, | ||
| TemplateMagnitude: { | ||
| EntryPoint: "index.ts", | ||
| NeedsEnvFile: true, | ||
| InvokeCommand: `kernel invoke ts-magnitude mag-url-extract --payload '{"url": "https://en.wikipedia.org/wiki/Special:Random"}'`, | ||
| }, | ||
| TemplateCUA: { | ||
| TemplateOpenAIComputerUse: { | ||
| EntryPoint: "index.ts", | ||
| NeedsEnvFile: true, | ||
| InvokeCommand: `kernel invoke ts-cua cua-task --payload '{"task": "Go to https://news.ycombinator.com and get the top 5 articles"}'`, | ||
| InvokeCommand: `kernel invoke ts-openai-cua cua-task --payload '{"task": "Go to https://news.ycombinator.com and get the top 5 articles"}'`, | ||
| }, | ||
| TemplateGeminiCUA: { | ||
| TemplateGeminiComputerUse: { | ||
| EntryPoint: "index.ts", | ||
| NeedsEnvFile: true, | ||
| InvokeCommand: "kernel invoke ts-gemini-cua gemini-cua-task", | ||
|
|
@@ -189,15 +206,20 @@ var Commands = map[string]map[string]DeployConfig{ | |
| NeedsEnvFile: true, | ||
| InvokeCommand: `kernel invoke python-bu bu-task --payload '{"task": "Compare the price of gpt-4o and DeepSeek-V3"}'`, | ||
| }, | ||
| TemplateComputerUse: { | ||
| TemplateAnthropicComputerUse: { | ||
| EntryPoint: "main.py", | ||
| NeedsEnvFile: true, | ||
| InvokeCommand: `kernel invoke python-anthropic-cua cua-task --payload '{"query": "Return the first url of a search result for NYC restaurant reviews Pete Wells"}'`, | ||
| }, | ||
| TemplateOpenAIComputerUse: { | ||
| EntryPoint: "main.py", | ||
| NeedsEnvFile: true, | ||
| InvokeCommand: `kernel invoke python-cu cu-task --payload '{"query": "Return the first url of a search result for NYC restaurant reviews Pete Wells"}'`, | ||
| InvokeCommand: `kernel invoke python-openai-cua cua-task --payload '{"task": "Go to https://news.ycombinator.com and get the top 5 articles"}'`, | ||
| }, | ||
| TemplateCUA: { | ||
| TemplateOpenAGIComputerUse: { | ||
| EntryPoint: "main.py", | ||
| NeedsEnvFile: true, | ||
| InvokeCommand: `kernel invoke python-cua cua-task --payload '{"task": "Go to https://news.ycombinator.com and get the top 5 articles"}'`, | ||
| InvokeCommand: `kernel invoke python-openagi-cua openagi-default-task -p '{"instruction": "Navigate to https://agiopen.org and click the What is Computer Use? button", "record_replay": "True"}'`, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: JSON string instead of boolean for record_replay parameterThe Additional Locations (1)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh wait this might be valid |
||
| }, | ||
| }, | ||
| } | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ## OpenAGI API key (required) | ||
| OAGI_API_KEY= | ||
|
|
||
| ## Optional override (defaults to https://api.agiopen.org) | ||
| OAGI_BASE_URL=https://api.agiopen.org |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| # Kernel Python Sample App - OpenAGI Computer Use | ||
|
dprevoznik marked this conversation as resolved.
|
||
|
|
||
| This is a Kernel application that demonstrates using OpenAGI's Lux computer-use models for browser automation. | ||
|
|
||
| ## Overview | ||
|
|
||
| This template provides two agent types from the [OpenAGI SDK](https://github.com/onkernel/kernel-oagi): | ||
|
|
||
| ### AsyncDefaultAgent | ||
| Best for high-level tasks with immediate execution. Supports two models: | ||
| - `lux-actor-1`: Fast execution (~1s/step), simple linear tasks | ||
| - `lux-thinker-1`: Complex planning, comparison tasks, handling ambiguity | ||
|
|
||
| ### TaskerAgent | ||
| Best for structured workflows with predefined steps (todos). | ||
|
|
||
| ## Setup | ||
|
|
||
| 1. Get your API keys: | ||
| - **Kernel**: [dashboard.onkernel.com](https://dashboard.onkernel.com) | ||
| - **OpenAGI**: [developer.agiopen.org](https://developer.agiopen.org) | ||
|
|
||
| 2. Deploy the app: | ||
| ```bash | ||
| kernel login | ||
| cp .env.example .env | ||
| kernel deploy main.py --env-file .env | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ### AsyncDefaultAgent | ||
|
|
||
| Execute high-level tasks with optional model selection: | ||
|
|
||
| ```bash | ||
| # Default model (lux-actor-1) | ||
| kernel invoke python-openagi-cua openagi-default-task \ | ||
| -p '{"instruction": "Navigate to https://agiopen.org and click the What is Computer Use? button"}' | ||
|
|
||
| # With specific model | ||
| kernel invoke python-openagi-cua openagi-default-task \ | ||
| -p '{"instruction": "Navigate to https://developer.agiopen.org/docs and find the Lux model pricing page.", "model": "lux-thinker-1"}' | ||
| ``` | ||
|
|
||
| ### TaskerAgent | ||
|
|
||
| Execute structured workflows with predefined steps: | ||
|
|
||
| ```bash | ||
| kernel invoke python-openagi-cua openagi-tasker-task \ | ||
| -p '{"task": "Navigate to OAGI documentation and navigate to the What is Computer Use? section", "todos": ["Go to https://agiopen.org", "Click on the What is Computer Use? button", "Highlight point number 2 about computer use."]}' | ||
| ``` | ||
|
|
||
| ## Recording Replays | ||
|
|
||
| > **Note:** Replay recording is only available to Kernel users on paid plans. | ||
|
|
||
| Both actions support optional video replay recording. Add `"record_replay": "True"` to your payload to capture a video of the browser session: | ||
|
|
||
| ```bash | ||
| kernel invoke python-openagi-cua openagi-default-task \ | ||
| -p '{"instruction": "Navigate to https://agiopen.org", "record_replay": "True"}' | ||
| ``` | ||
|
|
||
| When enabled, the response will include a `replay_url` field with a link to view the recorded session. | ||
|
|
||
| ## Model Selection Guide | ||
|
|
||
| | Model | Best For | Avoid When | | ||
| |-------|----------|------------| | ||
| | `lux-actor-1` | Fast execution, simple linear tasks (10-20 steps) | Complex reasoning, comparison tasks | | ||
| | `lux-thinker-1` | Complex planning, comparison tasks, handling ambiguity | Low latency needs, simple click-paths | | ||
|
|
||
| ## Resources | ||
|
|
||
| - [OpenAGI Documentation](https://developer.agiopen.org) | ||
| - [Kernel Documentation](https://onkernel.com/docs/quickstart) | ||
| - [Kernel + OpenAGI Template Repository](https://github.com/onkernel/kernel-oagi) | ||
Uh oh!
There was an error while loading. Please reload this page.