Add cookbook: Playwright with computer use fallback - #540
Conversation
Documents three ways to hand a stuck playwright-mode agent off to computer use (trigger-tool budget, flat step-count budget, mixed toolset with a steering prompt) using @onkernel/browser-loop.
Avoid naming specific third-party AI products in prose outside a dedicated integration page.
There was a problem hiding this comment.
Stale comment
Risk assessment: Very Low
Decision: Approval stands (not re-approved; risk did not increase)
Re-evaluated after
ae2154a. The PR is still documentation-only: a new cookbook page (browsers/cua-fallback.mdx) and onedocs.jsonsidebar entry. No application code, API, auth, CI, or infrastructure changes.The new commit rewrites a single prose sentence to use generic wording instead of naming third-party agent SDKs. No new files, nav changes, or executable paths.
Factor Assessment Codepaths modified Docs content + sidebar nav only Blast radius New Intermediate cookbook page; existing pages unchanged Complexity Example TypeScript snippets for readers; not executed by this repo Infrastructure impact None Production / shared systems None CODEOWNERS No CODEOWNERSfile in the repoExample
systemPromptstrings in the cookbook are illustrative copy, not deployed model instructions for this site.Prior approval on
affd44cremains in effect. Risk did not increase, so approval is not dismissed and is not re-issued.Sent by Cursor Automation: Assign PR reviewers
Renames the file and aligns terminology throughout: "playwright mode" becomes "code mode" and "CUA mode" becomes "computer use", matching the new title.
There was a problem hiding this comment.
Stale comment
Risk assessment: Very Low
Decision: Approval stands (not re-approved; risk did not increase)
Re-evaluated after
fb68cc0. The PR remains documentation-only: one new cookbook page and onedocs.jsonsidebar entry. No application code, API, auth, CI, or infrastructure changes.The new commit renames
browsers/cua-fallback.mdx→browsers/code-mode-fallback.mdxand updates copy/identifiers (playwright mode→code mode,CUA→computer use, matchingdocs.jsonpath). Same page, same nav slot, no new executable paths.
Factor Assessment Codepaths modified Docs content + sidebar nav only Blast radius New Intermediate cookbook page; existing pages unchanged Complexity Example TypeScript snippets for readers; not executed by this repo Infrastructure impact None Production / shared systems None CODEOWNERS No CODEOWNERSfile in the repoExample
systemPromptstrings in the cookbook are illustrative copy, not deployed model instructions for this site.Prior approval on
affd44cremains in effect. Risk did not increase, so approval is not dismissed and is not re-issued.Sent by Cursor Automation: Assign PR reviewers
State plainly that this cookbook uses browser-loop and why its apply() swap enables the mid-session handoff, and note the same approach applies to any harness or toolset driving the browser.
There was a problem hiding this comment.
Stale comment
Risk assessment: Very Low
Decision: Approval stands (not re-approved; risk did not increase)
Re-evaluated after
8e9d59f. The PR remains documentation-only: one new cookbook page (browsers/code-mode-fallback.mdx) and onedocs.jsonsidebar entry after Playwright Execution. No application code, API, auth, CI, or infrastructure changes.The new commit rewrites two paragraphs in Picking a harness to describe
browser-loop/compiled.apply()as explanation rather than endorsement, and to state that the same handoff pattern applies to other harnesses. No new files, nav changes, or executable paths.
Factor Assessment Codepaths modified Docs content + sidebar nav only Blast radius New Intermediate cookbook page; existing pages unchanged Complexity Example TypeScript snippets for readers; not executed by this repo Infrastructure impact None Production / shared systems None CODEOWNERS No CODEOWNERSfile in the repoExample
systemPromptstrings in the cookbook are illustrative copy, not deployed model instructions for this site.Prior approval on
affd44cremains in effect. Risk did not increase, so approval is not dismissed and is not re-issued.Sent by Cursor Automation: Assign PR reviewers
…l framing Introduces code mode / computer use as the general concept, then establishes playwright mode / CUA mode as browser-loop's specific terms and uses them for the rest of the doc, matching the restored code. Code snippets are restored close to their original source, with internal-run-specific claims (exact tool-call counts, "verified directly" framing) generalized.
There was a problem hiding this comment.
Stale comment
Risk assessment: Very Low
Decision: Approval stands (not re-approved; risk did not increase)
Re-evaluated after
37cb336. The PR remains documentation-only: one new cookbook page (browsers/code-mode-fallback.mdx) and onedocs.jsonsidebar entry after Playwright Execution. No application code, API, auth, CI, or infrastructure changes.The new commit restores fuller
@onkernel/browser-loopexample snippets (replay start/stop, longer comments, playwright/CUA naming aligned with the library) and keeps the general code-mode / computer-use framing. Same page, same nav slot, no new files or executable paths in this repo.
Factor Assessment Codepaths modified Docs content + sidebar nav only Blast radius New Intermediate cookbook page; existing pages unchanged Complexity Example TypeScript snippets for readers; not executed by this repo Infrastructure impact None Production / shared systems None CODEOWNERS No CODEOWNERSfile in the repoExample
systemPromptstrings in the cookbook are illustrative copy, not deployed model instructions for this site.Prior approval on
affd44cremains in effect. Risk did not increase, so approval is not dismissed and is not re-issued.Sent by Cursor Automation: Assign PR reviewers
Playwright mode is browser-loop's specific implementation of the general code-mode approach, not a synonym introduced alongside it.
There was a problem hiding this comment.
Stale comment
Risk assessment: Very Low
Decision: Approval stands (not re-approved; risk did not increase)
Re-evaluated after
608db5c. The PR remains documentation-only: one new cookbook page (browsers/code-mode-fallback.mdx) and onedocs.jsonsidebar entry after Playwright Execution. No application code, API, auth, CI, or infrastructure changes.The new commit rewrites a single sentence in Code mode vs. computer use so code mode is framed as the general DOM-ref approach and playwright mode as
browser-loop's implementation of it. Same page, same nav slot, no new files or executable paths in this repo.
Factor Assessment Codepaths modified Docs content + sidebar nav only Blast radius New Intermediate cookbook page; existing pages unchanged Complexity Example TypeScript snippets for readers; not executed by this repo Infrastructure impact None Production / shared systems None CODEOWNERS No CODEOWNERSfile in the repoExample
systemPromptstrings in the cookbook are illustrative copy, not deployed model instructions for this site.Prior approval on
affd44cremains in effect. Risk did not increase, so approval is not dismissed and is not re-issued.Sent by Cursor Automation: Assign PR reviewers
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
| @@ -0,0 +1,507 @@ | |||
| --- | |||
| title: "Using Code Mode with Computer Use Fallback" | |||
There was a problem hiding this comment.
Hm I think the original version using "Playwright" is clearer, since raf defines code mode as give your agent the ability to write code. So I think we can write a separate guide focused on code mode and revert this all to Playwright, i'm going through now and will push up a commit
There was a problem hiding this comment.
Stale comment
Risk assessment: Very Low
Decision: Approval stands (not re-approved; risk did not increase)
Re-evaluated after
3ed9482. The PR remains documentation-only: one new cookbook page (browsers/playwright-cua-fallback.mdx) and onedocs.jsonsidebar entry after Playwright Execution. No application code, API, auth, CI, or infrastructure changes.The new commit renames
browsers/code-mode-fallback.mdx→browsers/playwright-cua-fallback.mdx, retitles the page to Using Playwright with CUA Fallback, and swaps remaining “code mode” wording to Playwright/CUA. It also adds a short Playwright intro. Same cookbook, same nav slot, no new executable paths in this repo.
Factor Assessment Codepaths modified Docs content + sidebar nav only Blast radius New Intermediate cookbook page; existing pages unchanged Complexity Example TypeScript snippets for readers; not executed by this repo Infrastructure impact None Production / shared systems None CODEOWNERS No CODEOWNERSfile in the repoExample
systemPromptstrings in the cookbook are illustrative copy, not deployed model instructions for this site.Prior approval on
affd44cremains in effect. Risk did not increase, so approval is not dismissed and is not re-issued.Sent by Cursor Automation: Assign PR reviewers
There was a problem hiding this comment.
Stale comment
Risk assessment: Very Low
Decision: Approval stands (not re-approved; risk did not increase)
Re-evaluated after
167fdb2. The PR remains documentation-only: one new cookbook page (browsers/playwright-cua-fallback.mdx) and onedocs.jsonsidebar entry after Playwright Execution. No application code, API, auth, CI, or infrastructure changes.The new commit rewords one intro sentence (
tools→frameworks) and adds a two-sentence definition of an agent tool vs. a toolset under Playwright vs. CUA. Same page, same nav slot, no new files or executable paths in this repo.
Factor Assessment Codepaths modified Docs content + sidebar nav only Blast radius New Intermediate cookbook page; existing pages unchanged Complexity Example TypeScript snippets for readers; not executed by this repo Infrastructure impact None Production / shared systems None CODEOWNERS No CODEOWNERSfile in the repoExample
systemPromptstrings in the cookbook are illustrative copy, not deployed model instructions for this site.Prior approval on
affd44cremains in effect. Risk did not increase, so approval is not dismissed and is not re-issued.Sent by Cursor Automation: Assign PR reviewers
There was a problem hiding this comment.
Stale comment
Risk assessment: Very Low
Decision: Approval stands (not re-approved; risk did not increase)
Re-evaluated after
b1a59b1. The PR remains documentation-only: one new cookbook page (browsers/playwright-cua-fallback.mdx) and onedocs.jsonsidebar entry after Playwright Execution. No application code, API, auth, CI, or infrastructure changes. NoCODEOWNERSfile in the repo.The new commit is copy and branding on that same page: title/description wording, CUA → Computer Use in headings and prose, Kernel → KERNEL in comments and example identifiers, and a short harness-section rewrite. Same cookbook, same nav slot, no new files or executable paths in this repo.
Factor Assessment Codepaths modified Docs content + sidebar nav only Blast radius New Intermediate cookbook page; existing pages unchanged Complexity Example TypeScript snippets for readers; not executed by this repo Infrastructure impact None Production / shared systems None CODEOWNERS No CODEOWNERSfile in the repoExample
systemPromptstrings in the cookbook are illustrative copy, not deployed model instructions for this site.Prior approval on
affd44cremains in effect. Risk did not increase, so approval is not dismissed and is not re-issued.Sent by Cursor Automation: Assign PR reviewers
There was a problem hiding this comment.
Stale comment
Risk assessment: Very Low
Decision: Approval stands (not re-approved; risk did not increase)
Re-evaluated after
5f33aa2. The PR remains documentation-only: one new cookbook page (browsers/playwright-computer-use-fallback.mdx) and onedocs.jsonsidebar entry after Playwright Execution. No application code, API, auth, CI, or infrastructure changes. NoCODEOWNERSfile in the repo.The new commit renames
browsers/playwright-cua-fallback.mdx→browsers/playwright-computer-use-fallback.mdx, updates the nav slug to match, and standardizes handoff wording (CUA → computer use; Approach A/B/C → Per-Tool Attempt Limit / Total Tool-Call Limit / Model-Directed Handoff). Example snippet identifiers, filenames, log labels, and variable names were renamed to match. Same cookbook, same nav slot, no new executable paths in this repo.
Factor Assessment Codepaths modified Docs content + sidebar nav only Blast radius New Intermediate cookbook page; existing pages unchanged Complexity Example TypeScript snippets for readers; not executed by this repo Infrastructure impact None Production / shared systems None CODEOWNERS No CODEOWNERSfile in the repoExample
systemPromptstrings in the cookbook are illustrative copy, not deployed model instructions for this site.Prior approval on
affd44cremains in effect. Risk did not increase, so approval is not dismissed and is not re-issued.Sent by Cursor Automation: Assign PR reviewers
AnnaXWang
left a comment
There was a problem hiding this comment.
I updated the Playwright fallback cookbook to make the terminology clearer. I renamed the three strategies to Per-Tool Limit, Total Tool-Call Limit, and Model-Directed Handoff, let's discuss in Slack if we want to update this more.
I also realized that CUA was an overloaded term. I replaced it everywhere with “computer use” or “computer-use tools” throughout the guide and code examples.
There was a problem hiding this comment.
Stale comment
Risk assessment: Very Low
Decision: Approval stands (not re-approved; risk did not increase)
Re-evaluated after
575fd95. The PR remains documentation-only: one new cookbook page (browsers/playwright-computer-use-fallback.mdx) and onedocs.jsonsidebar entry after Playwright Execution. No application code, API, auth, CI, or infrastructure changes. NoCODEOWNERSfile in the repo.The new commit is copy-only on that same page: Per-Tool Attempt Limit → Per-Tool Limit in headings, tables, prose, example comments, session IDs, and suggested filenames. Same cookbook, same nav slot, no new files or executable paths in this repo.
Factor Assessment Codepaths modified Docs content + sidebar nav only Blast radius New Intermediate cookbook page; existing pages unchanged Complexity Example TypeScript snippets for readers; not executed by this repo Infrastructure impact None Production / shared systems None CODEOWNERS No CODEOWNERSfile in the repoExample
systemPromptstrings in the cookbook are illustrative copy, not deployed model instructions for this site.Prior approval on
affd44cremains in effect. Risk did not increase, so approval is not dismissed and is not re-issued.Sent by Cursor Automation: Assign PR reviewers
Reframes the agent recommendation as starting with playwright execution and falling back to computer use, with a link to the new cookbook that shows the pattern.
There was a problem hiding this comment.
Stale comment
Risk assessment: Very Low
Decision: Approval stands (not re-approved; risk did not increase)
Re-evaluated after
c9b3c7e. The PR remains documentation-only. Current files:
- new cookbook page
browsers/playwright-computer-use-fallback.mdxdocs.jsonsidebar entry after Playwright Execution- one-sentence copy change on
introduction/control.mdxNo application code, API, auth, CI, or infrastructure changes. No
CODEOWNERSfile in the repo.The new commit only updates the Control intro lead: it points agents at Playwright first with a computer-use fallback, and adds a link to the new cookbook. Same docs surface (Mintlify pages + nav), no new executable paths in this repo.
Factor Assessment Codepaths modified Docs content + sidebar nav only Blast radius New Intermediate cookbook plus a one-line intro recommendation/link Complexity Example TypeScript snippets for readers; not executed by this repo Infrastructure impact None Production / shared systems None CODEOWNERS No CODEOWNERSfile in the repoExample
systemPromptstrings in the cookbook are illustrative copy, not deployed model instructions for this site.Prior approval on
affd44cremains in effect. Risk did not increase, so approval is not dismissed and is not re-issued.Sent by Cursor Automation: Assign PR reviewers
There was a problem hiding this comment.
Stale comment
Risk assessment: Very Low
Decision: Approval stands (not re-approved; risk did not increase)
Re-evaluated after
1f76b71(merge ofmaininto this branch). The PR remains documentation-only. Current files unique to this branch vsmain:
- new cookbook page
browsers/playwright-computer-use-fallback.mdxdocs.jsonsidebar entry after Playwright Execution- one-sentence copy change on
introduction/control.mdxNo application code, API, auth, CI, or infrastructure changes. No
CODEOWNERSfile in the repo.The new commit is a merge of already-landed
main(Foreman's Vercel KB link and related docs). It does not add files or behavior to this PR's unique surface.
Factor Assessment Codepaths modified Docs content + sidebar nav only Blast radius New Intermediate cookbook plus a one-line intro recommendation/link Complexity Example TypeScript snippets for readers; not executed by this repo Infrastructure impact None Production / shared systems None CODEOWNERS No CODEOWNERSfile in the repoExample
systemPromptstrings in the cookbook are illustrative copy, not deployed model instructions for this site.Prior approval on
affd44cremains in effect. Risk did not increase, so approval is not dismissed and is not re-issued.Sent by Cursor Automation: Assign PR reviewers
There was a problem hiding this comment.
Risk assessment: Very Low
Decision: Approval stands (not re-approved; risk did not increase)
Re-evaluated after 0bb8281. The PR remains documentation-only. Current files unique to this branch vs main:
- new cookbook page
browsers/playwright-computer-use-fallback.mdx docs.jsonsidebar entry after Playwright Execution- copy change on
introduction/control.mdx
No application code, API, auth, CI, or infrastructure changes. No CODEOWNERS file in the repo.
The new commit only rewords the Control intro link to the same cookbook (playwright w/ computer use fallback). Same docs surface (Mintlify pages + nav), no new executable paths in this repo.
| Factor | Assessment |
|---|---|
| Codepaths modified | Docs content + sidebar nav only |
| Blast radius | New Intermediate cookbook plus an intro recommendation/link |
| Complexity | Example TypeScript snippets for readers; not executed by this repo |
| Infrastructure impact | None |
| Production / shared systems | None |
| CODEOWNERS | No CODEOWNERS file in the repo |
Example systemPrompt strings in the cookbook are illustrative copy, not deployed model instructions for this site.
Prior approval on affd44c remains in effect. Risk did not increase, so approval is not dismissed and is not re-issued.
Sent by Cursor Automation: Assign PR reviewers
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0bb8281. Configure here.
| Kernel browsers expose four ways to drive a session. For agents, we recommend [computer use](/browsers/computer-controls) or [playwright execution](/browsers/playwright-execution) — both run co-located with the browser and avoid the bot-detection surface a direct CDP connection introduces. | ||
| Kernel browsers expose four ways to drive a session. For agents, we recommend starting with playwright execution and falling back to computer use, here's our guide: [playwright w/ computer use fallback](/browsers/playwright-computer-use-fallback). | ||
|
|
||
| Both run co-located with the browser and avoid the bot-detection surface a direct CDP connection introduces. |
There was a problem hiding this comment.
Control intro mislinks Playwright Execution
Medium Severity
The Control intro now recommends “playwright execution” and links to the new cookbook, but that page teaches @onkernel/browser-loop DOM tools (loop.toolsets.browser()), not kernel.browsers.playwright.execute(). The following “Both run co-located… avoid… CDP” sentence is no longer true of that path, and it contradicts this page’s later “computer controls for interaction, playwright execution for structured data” guidance.
Triggered by learned rule: Promote Playwright Execution API over direct CDP connections in examples
Reviewed by Cursor Bugbot for commit 0bb8281. Configure here.




Summary
browsers/playwright-computer-use-fallback.mdxto the docs navigation.Test plan
docs.jsonwithjq empty docs.json.PUPPETEER_SKIP_DOWNLOAD=true npx --yes mint broken-links.mint dev --port 3000and verify/browsers/playwright-computer-use-fallbackreturns HTTP 200 and renders all three approach names.Note
Low Risk
Documentation-only changes with no product or API behavior impact; the Control intro now favors Playwright-first guidance, which may diverge slightly from later sections on the same page that still describe computer-use-first patterns.
Overview
Adds a new cookbook at
/browsers/playwright-computer-use-fallbackthat documents using@onkernel/browser-loopto run DOM-based Playwright tools first and switch to screenshot-based computer-use tools when interactions (e.g. pointer drag-and-drop) fail silently. It walks through one magnitasks.com Kanban task and three handoff patterns: per-tool attempt limits, total Playwright tool-call limits, and model-directedloop.toolsets.mixed()with prompt steering, including full TypeScript samples (KERNEL browser, replay recording,compiled.apply(harness)).Navigation and positioning: registers the page in
docs.jsonunder Intermediate browser guides, and updatesintroduction/controlso the agent recommendation points at this guide (Playwright first, computer use fallback) instead of treating the two modes as peer equals in the opening paragraph.Reviewed by Cursor Bugbot for commit 0bb8281. Bugbot is set up for automated code reviews on this repo. Configure here.