diff --git a/README.md b/README.md index 8df711d..54e4132 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,8 @@ create-kernel-app [app-name] [options] - `sample-app`: Basic template with Playwright integration - `browser-use`: Template with Browser Use SDK (Python only) - `stagehand`: Template with Stagehand SDK (Typescript only) + - `persistent-browser`: Implements `sample-app` using a persistent browser + - `computer-use`: Implements a prompt loop using Anthropic Computer Use ### Examples @@ -51,6 +53,11 @@ Create a Typescript application with Stagehand template: npx @onkernel/create-kernel-app my-app --language typescript --template stagehand ``` +Create a Typescript application with Computer Use template: +```bash +npx @onkernel/create-kernel-app my-app --language typescript --template computer-use +``` + Create a Python application with a sample app: ```bash npx @onkernel/create-kernel-app my-app --language python --template sample-app @@ -60,6 +67,7 @@ Create a Python application with Browser Use template: ```bash npx @onkernel/create-kernel-app my-app --language python --template browser-use ``` +``` ## Next Steps @@ -82,7 +90,7 @@ export KERNEL_API_KEY= 4. Deploy your application: ```bash # Typscript -kernel deploy index.ts # --env OPENAI_API_KEY=XXX if Stagehand +kernel deploy index.ts # --env OPENAI_API_KEY=XXX if Stagehand; --env ANTHROPIC_API_KEY=XXX if Computer Use # Python kernel deploy main.py # --env OPENAI_API_KEY=XXX if Browser Use @@ -98,6 +106,9 @@ kernel invoke ts-basic get-page-title --payload '{"url": "https://www.google.com # Typescript + Stagehand kernel invoke ts-stagehand stagehand-task --payload '{"query": "Best wired earbuds"}' +# Typescript + Computer Use +kernel invoke ts-cu cu-task --payload '{"query": "Search for the top 3 restaurants in NYC according to Pete Wells"}' + # Python + Sample App kernel invoke python-basic get-page-title --payload '{"url": "https://www.google.com"}' @@ -114,6 +125,8 @@ These are the sample apps currently available when you run `npx @onkernel/create | **sample-app** | Returns the page title of a specified URL | Playwright | `{ url }` | | **browser-use** | Completes a specified task | Browser Use | `{ task }` | | **stagehand** | Returns the first result of a specified Google search | Stagehand | `{ query }` | +| **persistent-browser** | Implements `sample-app` using a persistent browser | Playwright | `{ url }` | +| **computer-use** | Implements a prompt loop | Anthropic Computer Use API | `{ query }` | ## Documentation diff --git a/index.ts b/index.ts index 5201291..6727c41 100644 --- a/index.ts +++ b/index.ts @@ -17,7 +17,8 @@ type TemplateKey = | "sample-app" | "browser-use" | "stagehand" - | "persistent-browser"; + | "persistent-browser" + | "computer-use"; type LanguageInfo = { name: string; shorthand: string }; type TemplateInfo = { name: string; @@ -32,6 +33,7 @@ const TEMPLATE_SAMPLE_APP = "sample-app"; const TEMPLATE_BROWSER_USE = "browser-use"; const TEMPLATE_STAGEHAND = "stagehand"; const TEMPLATE_PERSISTENT_BROWSER = "persistent-browser"; +const TEMPLATE_COMPUTER_USE = "computer-use"; const LANGUAGE_SHORTHAND_TS = "ts"; const LANGUAGE_SHORTHAND_PY = "py"; @@ -66,6 +68,11 @@ const TEMPLATES: Record = { "Implements a persistent browser that maintains state across invocations", languages: [LANGUAGE_TYPESCRIPT], }, + [TEMPLATE_COMPUTER_USE]: { + name: "Computer Use", + description: "Implements the Anthropic Computer Use SDK", + languages: [LANGUAGE_TYPESCRIPT], + }, }; const INVOKE_SAMPLES: Record< @@ -79,6 +86,8 @@ const INVOKE_SAMPLES: Record< 'kernel invoke ts-stagehand stagehand-task --payload \'{"query": "Best wired earbuds"}\'', [TEMPLATE_PERSISTENT_BROWSER]: 'kernel invoke ts-persistent-browser persistent-browser-task --payload \'{"url": "https://news.ycombinator.com/"}\'', + [TEMPLATE_COMPUTER_USE]: + 'kernel invoke ts-cu cu-task --payload \'{"query": "Return the first url of a search result for NYC restaurant reviews Pete Wells"}\'', }, [LANGUAGE_PYTHON]: { [TEMPLATE_SAMPLE_APP]: @@ -299,10 +308,12 @@ function printNextSteps( ): void { // Determine which sample command to show based on language and template const deployCommand = - language === LANGUAGE_TYPESCRIPT && template === TEMPLATE_SAMPLE_APP + language === LANGUAGE_TYPESCRIPT && (template === TEMPLATE_SAMPLE_APP || template === TEMPLATE_PERSISTENT_BROWSER) ? "kernel deploy index.ts" : language === LANGUAGE_TYPESCRIPT && template === TEMPLATE_STAGEHAND ? "kernel deploy index.ts --env OPENAI_API_KEY=XXX" + : language === LANGUAGE_TYPESCRIPT && template === TEMPLATE_COMPUTER_USE + ? "kernel deploy index.ts --env ANTHROPIC_API_KEY=XXX" : language === LANGUAGE_PYTHON && template === TEMPLATE_SAMPLE_APP ? "kernel deploy main.py" : language === LANGUAGE_PYTHON && template === TEMPLATE_BROWSER_USE @@ -341,7 +352,7 @@ program ) .option( "-t, --template