Add unified CUA template with multi-provider fallback#143
Add unified CUA template with multi-provider fallback#143masnwilliams wants to merge 4 commits intomainfrom
Conversation
|
🔧 CI Fix Available |
Consolidates the separate anthropic-computer-use, openai-computer-use, and gemini-computer-use templates into a single "cua" template that supports all three providers with automatic fallback. - TypeScript and Python templates with identical structure - Provider selection via CUA_PROVIDER env var - Optional fallback chain via CUA_FALLBACK_PROVIDERS - Shared browser session lifecycle with replay support - Each provider adapter is self-contained and customizable - Registered as "cua" template in templates.go Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
99891de to
73255f9
Compare
| <IMPORTANT> | ||
| * When using Chromium, if a startup wizard appears, IGNORE IT. | ||
| * Click on the search bar and enter the appropriate URL there. | ||
| </IMPORTANT>`; |
There was a problem hiding this comment.
Anthropic system prompt date freezes at module load
Medium Severity
The SYSTEM_PROMPT's date is evaluated once at module load time, not per request, due to its definition as a module-level const template literal. This causes the date to become stale for long-running applications, potentially confusing the model on time-sensitive tasks. Other providers dynamically compute the date per-task.
Reviewed by Cursor Bugbot for commit 73255f9. Configure here.
| "scroll_at", "wait_5_seconds", "go_back", "go_forward", | ||
| "search", "navigate", "key_combination", "drag_and_drop", | ||
| "open_web_browser", | ||
| ] |
There was a problem hiding this comment.
Python Gemini drops screenshots, PREDEFINED_ACTIONS unused
Medium Severity
PREDEFINED_ACTIONS is defined but never referenced in the Python Gemini provider. In the TypeScript version, this list is used to conditionally include screenshot data in the functionResponse sent back to the model. The Python version captures screenshots in _execute_action but the screenshot key in the returned dict is completely ignored when constructing the FunctionResponsePart — only url is used. This is a likely incomplete port from the TypeScript implementation.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 73255f9. Configure here.
| "scroll_at", "wait_5_seconds", "go_back", "go_forward", | ||
| "search", "navigate", "key_combination", "drag_and_drop", | ||
| "open_web_browser", | ||
| ] |
There was a problem hiding this comment.
PREDEFINED_ACTIONS defined but never used in Python Gemini
Low Severity
PREDEFINED_ACTIONS is defined at module level but never referenced anywhere in the Python Gemini provider. The TypeScript counterpart attempts to use it when constructing function responses (to conditionally include screenshot data), but that usage is also ineffective since parts isn't a valid field on functionResponse. This appears to be leftover from an incomplete screenshot-forwarding implementation.
Reviewed by Cursor Bugbot for commit 73255f9. Configure here.
Provider resolution at module load crashes during Hypeman's build/discovery phase when env vars aren't available. Use lazy initialization so providers are resolved on first invocation instead. Also fix TS type errors: narrow candidate.content in Gemini provider, cast input items in OpenAI provider, simplify computer_call_output construction. Made-with: Cursor
…odel inputs - Bump all TS and Python deps to latest versions - Fix Anthropic computer use: use computer_20251124 with computer-use-2025-11-24 beta flag (claude-sonnet-4-6 requires the newer tool version) - Fix OpenAI: add missing screenshot action handler - Fix Python: correct SDK API (kernel.App), fix session.delete call, add missing openai dependency - Restore provider and model as per-request payload overrides (were dropped in rewrite). Provider uses a typed enum (anthropic | openai | gemini). Made-with: Cursor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 5 total unresolved issues (including 4 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e377d08. Configure here.
… API, session delete - Add missing screenshot action handler in Python OpenAI provider - Use Part.from_function_response() instead of FunctionResponsePart() in Python Gemini provider (pydantic extra_forbidden in google-genai >=1.71) - Fix session cleanup: use delete_by_id() instead of delete() Made-with: Cursor


Summary
cuatemplate (TypeScript + Python) that consolidates the separateanthropic-computer-use,openai-computer-use, andgemini-computer-usetemplates into a single multi-provider templateCUA_PROVIDERenv var, with automatic fallback viaCUA_FALLBACK_PROVIDERStemplates.gofor both TypeScript and PythonStructure
Test plan
go build ./...passesgo test ./pkg/create/...passeskernel createshows "Unified CUA" template for both TS and Python🤖 Generated with Claude Code
Note
Low Risk
Low risk: changes are additive (new
cuatemplates and template registry entries) with no modifications to existing runtime logic beyond surfacing the new option inkernel create. Main risk is template correctness and provider env configuration at deploy time.Overview
Adds a new Unified CUA template (
cua) for both TypeScript and Python and registers it inpkg/create/templates.gowith deploy/invoke samples.The new templates implement a multi-provider computer-use agent that selects a primary backend via
CUA_PROVIDER, optionally triesCUA_FALLBACK_PROVIDERSon failure, and supports optional browser replay recording (record_replay) via a shared session manager.Reviewed by Cursor Bugbot for commit 09ae143. Bugbot is set up for automated code reviews on this repo. Configure here.