improvement(browser-use,stagehand): expose live session URLs#4314
improvement(browser-use,stagehand): expose live session URLs#4314waleedlatif1 merged 6 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Stagehand agent gains run controls and live view output. The agent API and tool add Reviewed by Cursor Bugbot for commit 03d87ee. Configure here. |
Greptile SummaryThis PR extends the Browser Use and Stagehand integrations: Browser Use aligns with the v2 camelCase OpenAPI spec and adds several new parameters (startUrl, maxSteps, allowedDomains, vision, flashMode, etc.), while Stagehand adds mode/maxSteps and bumps to
Confidence Score: 5/5Safe to merge — changes are well-scoped, previously flagged issues are resolved, and the two remaining observations are minor efficiency concerns. No P0 or P1 issues found. The previous thread's concerns about sessionId availability and premature live URL fetching are properly addressed. The two P2 findings (unconditional share URL creation and unbounded extra poll-loop API calls) are low-risk and don't affect correctness. apps/sim/tools/browser_use/run_task.ts — the polling loop's repeated liveUrl fetch and the unconditional createShareUrl call are worth a second look. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Block as BrowserUse/Stagehand Block
participant Tool as Tool Config
participant API as BrowserUse/Browserbase API
User->>Block: Submit task with params
Block->>Tool: params transformer (type coercion)
Tool->>API: POST /tasks (with camelCase v2 body)
API-->>Tool: { id, sessionId? }
loop Poll every 5s
Tool->>API: GET /tasks/{id}
API-->>Tool: { status, sessionId, ... }
alt liveUrl not yet fetched
Tool->>API: GET /sessions/{sessionId}
API-->>Tool: { liveUrl, publicShareUrl }
end
alt status is terminal
Tool-->>Tool: break
end
end
alt sessionId available
Tool->>API: POST /sessions/{id}/public-share
API-->>Tool: { shareUrl }
end
Tool-->>Block: { output, steps, liveUrl, shareUrl, sessionId }
Block-->>User: Display results + live/share URLs
Note over Tool,API: Stagehand: init → GET /v1/sessions/{id}/debug → agent.execute()
Reviews (6): Last reviewed commit: "fix(browser-use): skip metadata when emp..." | Re-trigger Greptile |
|
@greptile |
|
@cursor review |
|
@greptile |
|
@cursor review |
…n with latest API specs - Browser Use: switch to v2 camelCase schema, fetch live URL from sessions endpoint, add startUrl/maxSteps/allowedDomains/vision/flashMode/thinking/systemPromptExtension/structuredOutput/metadata params, surface liveUrl/shareUrl/sessionId outputs - Stagehand: fetch Browserbase debug URL, add mode/maxSteps params, surface liveViewUrl/sessionId outputs, bump @browserbasehq/stagehand to ^3.2.1, update to claude-sonnet-4-6 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Only send highlightElements when user explicitly toggles it; previously defaulted to true which silently overrode the v2 API default of false. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Browser Use: fetch liveUrl during polling once sessionId is known, instead of immediately after task creation. Handles tasks started without profile_id (where sessionId isn't returned in create response) and ensures session is active before fetching. - Stagehand: coerce empty/whitespace maxSteps strings to undefined so they're dropped from the request body instead of failing zod validation as ''. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
If the agent throws after Browserbase session init succeeds, callers can still surface the live view / session ID for debugging. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Mirrors the Stagehand block's handling so a cleared field doesn't pass through as ''. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
af1cff9 to
42d38fc
Compare
|
@greptile |
|
@cursor review |
|
@greptile |
|
@cursor review |
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 03d87ee. Configure here.
Summary
GET /sessions/{id}and share URL post-run; surfaceliveUrl,shareUrl,sessionIdin block outputsGET /v1/sessions/{id}/debug; addmode(dom/hybrid/cua) andmaxStepsparams per docs; surfaceliveViewUrlandsessionIdoutputs; bump@browserbasehq/stagehandto^3.2.1; update default Anthropic model toclaude-sonnet-4-6Test plan
liveUrlis populated during execution andshareUrlpost-runliveViewUrl+sessionIdare populated