showcase/integrations/mastra/qa/browser-use.md
Mastra-only, real-LLM demo. The agent drives a real LOCAL headless
browser (Playwright Chromium — no Browserbase / hosted-browser API key) via
the browse_web tool and summarizes the results back into the CopilotKit chat.
playwright is a package dependency, but the browser binary is not bundled.
Install it once before running the demo:
npx playwright install chromium
The demo needs a real OPENAI_API_KEY (the agent runs a live LLM) and live
network access (it fetches real pages).
The demo's Docker image must run npx playwright install chromium (and the
matching OS libraries) for the browse to work in a deployed container. If the
binary is missing, browse_web returns a structured error and the agent
relays it — the run does not crash, but no results render.
Browser navigation is non-deterministic: the top Hacker News stories and
any live page's contents change on every request, so there is nothing stable
to record-and-replay under aimock. This cell is therefore surfaced as a
Mastra-only, real-LLM demo, not a D6 aimock cell. The e2e spec
(tests/e2e/browser-use.spec.ts) is a lightweight smoke test (page loads,
pills render, input enabled) and does NOT drive a real browse.
npx playwright install chromium (once)/demos/browser-useuseRenderTool on browse_web) renders a
BrowseResultsCard with a loading state, a results list, and — if the local
browser could not launch — a clear error banner (data-testid="browse-error").