Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions apps/docs/content/docs/en/integrations/browser_use.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,38 @@ Runs a browser automation task using BrowserUse
| `shareUrl` | string | Public shareable URL for the recorded session \(post-run\) |
| `sessionId` | string | Browser Use session identifier |

### Browser Use V4

Runs a Browser Use Cloud agent through the V4 run API

#### Input

| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `task` | string | Yes | What the browser agent should do |
| `model` | string | No | V4 model identifier |
| `sessionId` | string | No | Existing V4 session ID for a follow-up turn |
| `workspaceId` | string | No | Existing V4 workspace ID whose files should be restored |
| `profileId` | string | No | Browser profile ID for stored cookies and browser state |
| `record` | boolean | No | Record the newly provisioned browser session |
| `agentmail` | boolean | No | Give the run a temporary AgentMail inbox |
| `maxCostUsd` | number | No | Maximum run cost in US dollars |
| `secretBindings` | json | No | Run-scoped secrets with the domains where each may be typed |
| `apiKey` | string | Yes | Browser Use API key |

#### Output

| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `id` | string | V4 run identifier |
| `status` | string | Run status |
| `result` | string | Final agent result |
| `error` | string | Run error |
| `model` | string | Model used by the run |
| `sessionId` | string | V4 conversation session identifier |
| `workspaceId` | string | Persistent workspace identifier |
| `totalCostUsd` | string | Total run cost in US dollars |
| `totalInputTokens` | number | Total input tokens used |
| `totalOutputTokens` | number | Total output tokens used |


144 changes: 142 additions & 2 deletions apps/sim/blocks/blocks/browser_use.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,26 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = {
{ text: 'Run the browser task', field: 'task', core: true },
{ text: ', starting at', field: 'startUrl' },
],
byOperation: {
browser_use_run_task: [
{ text: 'Run the legacy browser task', field: 'task', core: true },
{ text: ', starting at', field: 'startUrl' },
],
browser_use_run_v4: [{ text: 'Run the V4 browser agent', field: 'task', core: true }],
},
},
},
subBlocks: [
{
id: 'operation',
title: 'Operation',
type: 'dropdown',
options: [
{ label: 'Run Task (V2)', id: 'browser_use_run_task' },
{ label: 'Run Cloud Agent (V4)', id: 'browser_use_run_v4' },
],
value: () => 'browser_use_run_task',
},
{
id: 'task',
title: 'Task',
Expand All @@ -36,6 +53,7 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = {
title: 'Start URL',
type: 'short-input',
placeholder: 'https://example.com (optional starting URL)',
condition: { field: 'operation', value: 'browser_use_run_task' },
},
{
id: 'variables',
Expand All @@ -44,11 +62,13 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = {
password: true,
required: false,
columns: ['Key', 'Value'],
condition: { field: 'operation', value: 'browser_use_run_task' },
},
{
id: 'model',
title: 'Model',
type: 'dropdown',
condition: { field: 'operation', value: 'browser_use_run_task' },
options: [
{ label: 'Browser Use LLM', id: 'browser-use-llm' },
{ label: 'Browser Use 2.0', id: 'browser-use-2.0' },
Expand Down Expand Up @@ -77,20 +97,23 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = {
title: 'Profile ID',
type: 'short-input',
placeholder: 'Enter browser profile ID (optional)',
condition: { field: 'operation', value: 'browser_use_run_task' },
},
{
id: 'maxSteps',
title: 'Max Steps',
type: 'short-input',
placeholder: '100',
mode: 'advanced',
condition: { field: 'operation', value: 'browser_use_run_task' },
},
{
id: 'allowedDomains',
title: 'Allowed Domains',
type: 'short-input',
placeholder: 'example.com, docs.example.com',
mode: 'advanced',
condition: { field: 'operation', value: 'browser_use_run_task' },
},
{
id: 'vision',
Expand All @@ -102,34 +125,39 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = {
{ label: 'Disabled', id: 'false' },
],
mode: 'advanced',
condition: { field: 'operation', value: 'browser_use_run_task' },
},
{
id: 'flashMode',
title: 'Flash Mode',
type: 'switch',
placeholder: 'Faster but less careful navigation',
mode: 'advanced',
condition: { field: 'operation', value: 'browser_use_run_task' },
},
{
id: 'thinking',
title: 'Thinking',
type: 'switch',
placeholder: 'Enable extended reasoning',
mode: 'advanced',
condition: { field: 'operation', value: 'browser_use_run_task' },
},
{
id: 'highlightElements',
title: 'Highlight Elements',
type: 'switch',
placeholder: 'Visually mark interactive elements',
mode: 'advanced',
condition: { field: 'operation', value: 'browser_use_run_task' },
},
{
id: 'systemPromptExtension',
title: 'System Prompt Extension',
type: 'long-input',
placeholder: 'Append custom instructions to the agent system prompt (max 2000 chars)',
mode: 'advanced',
condition: { field: 'operation', value: 'browser_use_run_task' },
},
{
id: 'structuredOutput',
Expand All @@ -138,13 +166,88 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = {
language: 'json',
placeholder: 'Stringified JSON schema for structured output',
mode: 'advanced',
condition: { field: 'operation', value: 'browser_use_run_task' },
},
{
id: 'metadata',
title: 'Metadata',
type: 'table',
columns: ['Key', 'Value'],
mode: 'advanced',
condition: { field: 'operation', value: 'browser_use_run_task' },
},
{
id: 'v4Model',
title: 'Model',
type: 'dropdown',
options: [
{ label: 'GPT-5.6 Luna (default)', id: 'gpt-5.6-luna' },
{ label: 'GPT-5.6 Terra', id: 'gpt-5.6-terra' },
{ label: 'GPT-5.6 Sol', id: 'gpt-5.6-sol' },
{ label: 'Claude Sonnet 5', id: 'claude-sonnet-5' },
{ label: 'Gemini 3.6 Flash', id: 'gemini-3.6-flash' },
{ label: 'Kimi K3', id: 'kimi-k3' },
],
condition: { field: 'operation', value: 'browser_use_run_v4' },
mode: 'advanced',
},
{
id: 'v4SessionId',
title: 'Session ID',
type: 'short-input',
placeholder: 'Continue an existing V4 conversation',
condition: { field: 'operation', value: 'browser_use_run_v4' },
mode: 'advanced',
},
{
id: 'v4WorkspaceId',
title: 'Workspace ID',
type: 'short-input',
placeholder: 'Restore files from an existing V4 workspace',
condition: { field: 'operation', value: 'browser_use_run_v4' },
mode: 'advanced',
},
{
id: 'v4ProfileId',
title: 'Profile ID',
type: 'short-input',
placeholder: 'Load saved cookies and browser state',
condition: { field: 'operation', value: 'browser_use_run_v4' },
mode: 'advanced',
},
{
id: 'v4Record',
title: 'Record Browser',
type: 'switch',
placeholder: 'Record a newly provisioned browser',
condition: { field: 'operation', value: 'browser_use_run_v4' },
mode: 'advanced',
},
{
id: 'v4Agentmail',
title: 'AgentMail',
type: 'switch',
placeholder: 'Give the run a temporary inbox',
condition: { field: 'operation', value: 'browser_use_run_v4' },
mode: 'advanced',
},
{
id: 'v4MaxCostUsd',
title: 'Max Cost (USD)',
type: 'short-input',
placeholder: '5.00',
condition: { field: 'operation', value: 'browser_use_run_v4' },
mode: 'advanced',
},
{
id: 'v4SecretBindings',
title: 'Secret Bindings',
type: 'table',
password: true,
required: false,
columns: ['Alias', 'Value', 'Allowed Domains'],
condition: { field: 'operation', value: 'browser_use_run_v4' },
mode: 'advanced',
},
{
id: 'apiKey',
Expand All @@ -156,10 +259,30 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = {
},
],
tools: {
access: ['browser_use_run_task'],
access: ['browser_use_run_task', 'browser_use_run_v4'],
config: {
tool: () => 'browser_use_run_task',
tool: (params) =>
params.operation === 'browser_use_run_v4' ? 'browser_use_run_v4' : 'browser_use_run_task',
params: (params) => {
if (params.operation === 'browser_use_run_v4') {
const maxCost =
typeof params.v4MaxCostUsd === 'string'
? Number(params.v4MaxCostUsd.trim())
: params.v4MaxCostUsd
return {
task: params.task,
apiKey: params.apiKey,
model: params.v4Model,
sessionId: params.v4SessionId,
workspaceId: params.v4WorkspaceId,
profileId: params.v4ProfileId,
record: params.v4Record,
agentmail: params.v4Agentmail,
maxCostUsd: Number.isFinite(maxCost) ? maxCost : undefined,
secretBindings: params.v4SecretBindings,
}
}

const next: Record<string, any> = { ...params }
if (typeof next.maxSteps === 'string') {
const trimmed = next.maxSteps.trim()
Expand All @@ -186,6 +309,7 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = {
},
},
inputs: {
operation: { type: 'string', description: 'Browser Use API operation' },
task: { type: 'string', description: 'Browser automation task' },
startUrl: { type: 'string', description: 'Starting URL for the agent' },
apiKey: { type: 'string', description: 'BrowserUse API key' },
Expand All @@ -201,6 +325,14 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = {
systemPromptExtension: { type: 'string', description: 'Custom system prompt extension' },
structuredOutput: { type: 'string', description: 'Stringified JSON schema' },
metadata: { type: 'json', description: 'Custom key-value metadata' },
v4Model: { type: 'string', description: 'V4 model to use' },
v4SessionId: { type: 'string', description: 'Existing V4 session ID' },
v4WorkspaceId: { type: 'string', description: 'Existing V4 workspace ID' },
v4ProfileId: { type: 'string', description: 'Browser profile ID for the V4 run' },
v4Record: { type: 'boolean', description: 'Record the V4 browser session' },
v4Agentmail: { type: 'boolean', description: 'Enable a temporary AgentMail inbox' },
v4MaxCostUsd: { type: 'number', description: 'Maximum V4 run cost in US dollars' },
v4SecretBindings: { type: 'json', description: 'Run-scoped V4 secret bindings' },
},
outputs: {
id: { type: 'string', description: 'Task execution identifier' },
Expand All @@ -220,6 +352,14 @@ export const BrowserUseBlock: BlockConfig<BrowserUseResponse> = {
description: 'Public shareable URL for the session (post-run)',
},
sessionId: { type: 'string', description: 'Browser Use session identifier' },
status: { type: 'string', description: 'V4 run status' },
result: { type: 'string', description: 'V4 final agent result' },
error: { type: 'string', description: 'V4 run error' },
model: { type: 'string', description: 'Model used by the V4 run' },
workspaceId: { type: 'string', description: 'V4 persistent workspace identifier' },
totalCostUsd: { type: 'string', description: 'Total V4 run cost in US dollars' },
totalInputTokens: { type: 'number', description: 'Total V4 input tokens used' },
totalOutputTokens: { type: 'number', description: 'Total V4 output tokens used' },
},
}

Expand Down
2 changes: 2 additions & 0 deletions apps/sim/tools/browser_use/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { runTaskTool } from '@/tools/browser_use/run_task'
import { runV4Tool } from '@/tools/browser_use/run_v4'

export const browserUseRunTaskTool = runTaskTool
export const browserUseRunV4Tool = runV4Tool
Loading