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
8 changes: 6 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ const TEMPLATES: Record<TemplateKey, TemplateInfo> = {
name: "Persistent Browser",
description:
"Implements a persistent browser that maintains state across invocations",
languages: [LANGUAGE_TYPESCRIPT],
languages: [LANGUAGE_TYPESCRIPT, LANGUAGE_PYTHON],
},
[TEMPLATE_COMPUTER_USE]: {
name: "Computer Use",
description: "Implements the Anthropic Computer Use SDK",
languages: [LANGUAGE_TYPESCRIPT],
languages: [LANGUAGE_TYPESCRIPT, LANGUAGE_PYTHON],
},
};

Expand All @@ -96,6 +96,8 @@ const INVOKE_SAMPLES: Record<
'kernel invoke python-bu bu-task --payload \'{"task": "Compare the price of gpt-4o and DeepSeek-V3"}\'',
[TEMPLATE_PERSISTENT_BROWSER]:
'kernel invoke python-persistent-browser persistent-browser-task --payload \'{"url": "https://news.ycombinator.com/"}\'',
[TEMPLATE_COMPUTER_USE]:
'kernel invoke python-cu cu-task --payload \'{"query": "Return the first url of a search result for NYC restaurant reviews Pete Wells"}\'',
},
};

Expand Down Expand Up @@ -318,6 +320,8 @@ function printNextSteps(
? "kernel deploy main.py"
: language === LANGUAGE_PYTHON && template === TEMPLATE_BROWSER_USE
? "kernel deploy main.py --env OPENAI_API_KEY=XXX"
: language === LANGUAGE_PYTHON && template === TEMPLATE_COMPUTER_USE
? "kernel deploy main.py --env ANTHROPIC_API_KEY=XXX"
: "";

console.log(
Expand Down
3 changes: 3 additions & 0 deletions templates/python/browser-use/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ async def bu_task(ctx: kernel.KernelContext, input_data: TaskInput):

kernel_browser = client.browsers.create(invocation_id=ctx.invocation_id)
print("Kernel browser live view url: ", kernel_browser.browser_live_view_url)
#######################################
# Your Browser Use implementation here
#######################################
agent = Agent(
#task="Compare the price of gpt-4o and DeepSeek-V3",
task=input_data["task"],
Expand Down
2,854 changes: 1,427 additions & 1,427 deletions templates/python/browser-use/uv.lock

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions templates/python/computer-use/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Python
**/__pycache__/
**/*.py[cod]
**/*$py.class
*.so
__init__.py.bak
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
**/*.egg-info/
.installed.cfg
*.egg

# Virtual Environment
venv/
env/
ENV/
.venv/

# IDE
.idea/
.vscode/
*.swp
*.swo

# Testing
.coverage
htmlcov/
.pytest_cache/
.tox/

# Distribution
*.tar.gz
*.zip

# Logs
*.log

# Local development
.env
.env.local
.env.*.local
7 changes: 7 additions & 0 deletions templates/python/computer-use/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Kernel Python Sample App - Computer Use

This is a simple Kernel application that implements a prompt loop using Anthropic Computer Use.

It generally follows the [Anthropic Reference Implementation](https://github.com/anthropics/anthropic-quickstarts/tree/main/computer-use-demo) but replaces `xodotool` and `gnome-screenshot` with Playwright.

See the [docs](https://docs.onkernel.com/quickstart) for information.
Loading