Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.8k
improvement(browser-use,stagehand): expose live session URLs#4314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5c7973d
improvement(browser-use,stagehand): expose live session URLs and alig…
waleedlatif1 cf9460b
fix(browser-use): respect API default for highlightElements
waleedlatif1 2d3368f
fix(browser-use,stagehand): address PR review feedback
waleedlatif1 3c9154d
fix(stagehand): preserve liveViewUrl and sessionId on agent error
waleedlatif1 42d38fc
fix(browser-use): coerce empty maxSteps strings to undefined
waleedlatif1 03d87ee
fix(browser-use): skip metadata when empty
waleedlatif1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -23,6 +23,12 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = { | ||
| placeholder: 'Describe what the browser agent should do...', | ||
| required: true, | ||
| }, | ||
| { | ||
| id: 'startUrl', | ||
| title: 'Start URL', | ||
| type: 'short-input', | ||
| placeholder: 'https://example.com (optional starting URL)', | ||
| }, | ||
| { | ||
| id: 'variables', | ||
| title: 'Variables (Secrets)', | ||
| @@ -51,22 +57,85 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = { | ||
| { label: 'Claude 3.7 Sonnet', id: 'claude-3-7-sonnet-20250219' }, | ||
| { label: 'Claude Sonnet 4', id: 'claude-sonnet-4-20250514' }, | ||
| { label: 'Claude Sonnet 4.5', id: 'claude-sonnet-4-5-20250929' }, | ||
| { label: 'Claude Sonnet 4.6', id: 'claude-sonnet-4-6' }, | ||
| { label: 'Claude Opus 4.5', id: 'claude-opus-4-5-20251101' }, | ||
| { label: 'Llama 4 Maverick', id: 'llama-4-maverick-17b-128e-instruct' }, | ||
| ], | ||
| }, | ||
| { | ||
| id: 'save_browser_data', | ||
| title: 'Save Browser Data', | ||
| type: 'switch', | ||
| placeholder: 'Save browser data', | ||
| }, | ||
| { | ||
| id: 'profile_id', | ||
| title: 'Profile ID', | ||
| type: 'short-input', | ||
| placeholder: 'Enter browser profile ID (optional)', | ||
| }, | ||
| { | ||
| id: 'maxSteps', | ||
| title: 'Max Steps', | ||
| type: 'short-input', | ||
| placeholder: '100', | ||
| mode: 'advanced', | ||
| }, | ||
| { | ||
| id: 'allowedDomains', | ||
| title: 'Allowed Domains', | ||
| type: 'short-input', | ||
| placeholder: 'example.com, docs.example.com', | ||
| mode: 'advanced', | ||
| }, | ||
| { | ||
| id: 'vision', | ||
| title: 'Vision', | ||
| type: 'dropdown', | ||
| options: [ | ||
| { label: 'Auto (default)', id: 'auto' }, | ||
| { label: 'Enabled', id: 'true' }, | ||
| { label: 'Disabled', id: 'false' }, | ||
| ], | ||
| mode: 'advanced', | ||
| }, | ||
| { | ||
| id: 'flashMode', | ||
| title: 'Flash Mode', | ||
| type: 'switch', | ||
| placeholder: 'Faster but less careful navigation', | ||
| mode: 'advanced', | ||
| }, | ||
| { | ||
| id: 'thinking', | ||
| title: 'Thinking', | ||
| type: 'switch', | ||
| placeholder: 'Enable extended reasoning', | ||
| mode: 'advanced', | ||
| }, | ||
| { | ||
| id: 'highlightElements', | ||
| title: 'Highlight Elements', | ||
| type: 'switch', | ||
| placeholder: 'Visually mark interactive elements', | ||
| mode: 'advanced', | ||
| }, | ||
| { | ||
| id: 'systemPromptExtension', | ||
| title: 'System Prompt Extension', | ||
| type: 'long-input', | ||
| placeholder: 'Append custom instructions to the agent system prompt (max 2000 chars)', | ||
| mode: 'advanced', | ||
| }, | ||
| { | ||
| id: 'structuredOutput', | ||
| title: 'Structured Output Schema', | ||
| type: 'code', | ||
| language: 'json', | ||
| placeholder: 'Stringified JSON schema for structured output', | ||
| mode: 'advanced', | ||
| }, | ||
| { | ||
| id: 'metadata', | ||
| title: 'Metadata', | ||
| type: 'table', | ||
| columns: ['Key', 'Value'], | ||
| mode: 'advanced', | ||
| }, | ||
| { | ||
| id: 'apiKey', | ||
| title: 'API Key', | ||
| @@ -78,19 +147,68 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = { | ||
| ], | ||
| tools: { | ||
| access: ['browser_use_run_task'], | ||
| config: { | ||
| tool: () => 'browser_use_run_task', | ||
| params: (params) => { | ||
| const next: Record<string, any> = { ...params } | ||
| if (typeof next.maxSteps === 'string') { | ||
| const trimmed = next.maxSteps.trim() | ||
| if (trimmed === '') { | ||
| next.maxSteps = undefined | ||
| } else { | ||
| const n = Number(trimmed) | ||
| next.maxSteps = Number.isFinite(n) ? n : undefined | ||
| } | ||
| } | ||
| if (next.vision === 'true') next.vision = true | ||
| else if (next.vision === 'false') next.vision = false | ||
waleedlatif1 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| if (next.metadata && Array.isArray(next.metadata)) { | ||
| const obj: Record<string, string> = {} | ||
| for (const row of next.metadata as Array<Record<string, any>>) { | ||
| const key = row?.cells?.Key ?? row?.Key | ||
| const value = row?.cells?.Value ?? row?.Value | ||
| if (key) obj[key] = String(value ?? '') | ||
| } | ||
| next.metadata = obj | ||
| } | ||
| return next | ||
| }, | ||
| }, | ||
| }, | ||
| inputs: { | ||
| task: { type: 'string', description: 'Browser automation task' }, | ||
| startUrl: { type: 'string', description: 'Starting URL for the agent' }, | ||
| apiKey: { type: 'string', description: 'BrowserUse API key' }, | ||
| variables: { type: 'json', description: 'Task variables' }, | ||
| model: { type: 'string', description: 'AI model to use' }, | ||
| save_browser_data: { type: 'boolean', description: 'Save browser data' }, | ||
| variables: { type: 'json', description: 'Secrets to inject into the task' }, | ||
| model: { type: 'string', description: 'LLM model to use' }, | ||
| profile_id: { type: 'string', description: 'Browser profile ID for persistent sessions' }, | ||
| maxSteps: { type: 'number', description: 'Maximum agent steps' }, | ||
| allowedDomains: { type: 'string', description: 'Comma-separated allowed domains' }, | ||
| vision: { type: 'string', description: 'Vision capability (auto / true / false)' }, | ||
| flashMode: { type: 'boolean', description: 'Enable flash mode' }, | ||
| thinking: { type: 'boolean', description: 'Enable extended reasoning' }, | ||
| highlightElements: { type: 'boolean', description: 'Highlight interactive elements' }, | ||
| systemPromptExtension: { type: 'string', description: 'Custom system prompt extension' }, | ||
| structuredOutput: { type: 'string', description: 'Stringified JSON schema' }, | ||
| metadata: { type: 'json', description: 'Custom key-value metadata' }, | ||
| }, | ||
| outputs: { | ||
| id: { type: 'string', description: 'Task execution identifier' }, | ||
| success: { type: 'boolean', description: 'Task completion status' }, | ||
| output: { type: 'json', description: 'Task output data' }, | ||
| steps: { type: 'json', description: 'Execution steps taken' }, | ||
| output: { type: 'json', description: 'Final task output (string or structured)' }, | ||
| steps: { | ||
| type: 'json', | ||
| description: | ||
| 'Steps the agent executed (number, memory, evaluationPreviousGoal, nextGoal, url, screenshotUrl, actions, duration)', | ||
| }, | ||
| liveUrl: { | ||
| type: 'string', | ||
| description: 'Embeddable live browser session URL (active during execution)', | ||
| }, | ||
| shareUrl: { | ||
| type: 'string', | ||
| description: 'Public shareable URL for the session (post-run)', | ||
| }, | ||
| sessionId: { type: 'string', description: 'Browser Use session identifier' }, | ||
| }, | ||
| } | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.