Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 1.35 KB

File metadata and controls

30 lines (21 loc) · 1.35 KB

Kernel Python Sample App - OpenAI Computer Use

This is a Kernel application that demonstrates using the Computer Use Agent (CUA) from OpenAI with Kernel's native browser control API.

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.

Local testing

You can test against a remote Kernel browser without deploying:

cp .env.example .env
# Fill in OPENAI_API_KEY and KERNEL_API_KEY in .env
uv run run_local.py
# JSONL event output
uv run run_local.py --output jsonl

The local runner defaults to concise CUA-style logs (text), including kernel> backend SDK call lines with elapsed timing and agent> model output lines. Use --output jsonl for one structured event per line (including backend events). Add --debug to include verbose in-flight events.

Deploy to Kernel

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"}'
# JSONL logs for invocation
kernel invoke python-openai-cua cua-task -p '{"task":"go to https://news.ycombinator.com and list top 5 articles","output":"jsonl"}'

See the docs for more information.