Skip to content

feat: add Browser Use V4 run operation - #7174

Open
MagMueller wants to merge 2 commits into
simstudioai:mainfrom
MagMueller:agency/browser-use-v4-run
Open

feat: add Browser Use V4 run operation#7174
MagMueller wants to merge 2 commits into
simstudioai:mainfrom
MagMueller:agency/browser-use-v4-run

Conversation

@MagMueller

Copy link
Copy Markdown

What this adds

  • Adds a Browser Use V4 run operation with task, model, session, workspace, profile, recording, AgentMail, max-cost, and domain-scoped secret inputs.
  • Creates a V4 run, polls the lightweight status endpoint, and fetches the terminal result once.
  • Keeps the existing V2 operation registered and as the default for saved workflows.
  • Updates the Browser Use block, generated metadata, integration catalog, and docs.

Verification

  • bunx vitest run tools/browser_use/run_v4.test.ts from apps/sim: 2 tests passed.
  • bun run type-check from apps/sim: passed.
  • Biome, tool metadata, integration catalog, generated docs, registry boundary, API validation, and canvas-sentence checks: passed.
  • git diff --check: passed.
  • TruffleHog 3.97.1 scanned the exact base-to-head binary diff: 0 verified and 0 unverified secrets.

Environment boundaries

  • A full install with lifecycle scripts is blocked on local Node 26 because isolated-vm uses an incompatible V8 API. bun install --frozen-lockfile --ignore-scripts succeeded in the private validation run.
  • The external mothership catalog check could not run because work/copilot/copilot/contracts/tool-catalog-v1.json is not present in this checkout.

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

@MagMueller is attempting to deploy a commit to the Sim Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds a Browser Use V4 operation while retaining V2 as the default for existing workflows.

  • Adds V4 run creation, status polling, terminal-result retrieval, parameter normalization, and tests.
  • Extends the Browser Use block, executable registry, generated metadata, integration catalog, and documentation.
  • The new polling path does not honor workflow cancellation, and legacy cards lose their canvas-sentence fallback.

Confidence Score: 4/5

The PR should not merge until Browser Use V4 polling honors workflow cancellation and execution deadlines; the legacy-card presentation regression is non-blocking.

A cancelled or timed-out V4 run remains awaited because the new polling implementation ignores the supplied AbortSignal and can continue against a seven-day deadline.

Files Needing Attention: apps/sim/tools/browser_use/run_v4.ts, apps/sim/blocks/blocks/browser_use.ts

Important Files Changed

Filename Overview
apps/sim/tools/browser_use/run_v4.ts Adds the complete V4 request and polling lifecycle, but fails to propagate the execution signal or current timeout budget.
apps/sim/blocks/blocks/browser_use.ts Adds operation-specific V4 fields and routing; legacy execution remains compatible, although old cards lose their sentence fallback.
apps/sim/tools/browser_use/run_v4.test.ts Covers successful creation/polling and create-time errors but does not cover cancellation or timeout behavior.
apps/sim/tools/browser_use/types.ts Adds distinct V4 parameter and output contracts and expands the block output union.
apps/sim/tools/registry.ts Registers the new Browser Use V4 tool in the executable registry.
apps/docs/content/docs/en/integrations/browser_use.mdx Documents the new V4 inputs and outputs alongside the existing operation.

Sequence Diagram

sequenceDiagram
  participant Workflow
  participant Tool as Browser Use V4 Tool
  participant API as Browser Use API
  Workflow->>Tool: Execute task with AbortSignal
  Tool->>API: POST /api/v4/runs
  API-->>Tool: Run ID
  loop Until terminal status
    Tool->>API: "GET /runs/{id}/status"
    API-->>Tool: Current status
  end
  Tool->>API: "GET /runs/{id}"
  API-->>Tool: Terminal result
  Tool-->>Workflow: ToolResponse
Loading

Reviews (1): Last reviewed commit: "feat: add Browser Use V4 run operation" | Re-trigger Greptile

Comment on lines +88 to +91
async function pollForCompletion(
runId: string,
apiKey: string
): Promise<{ summary?: V4RunSummary; error?: string }> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Polling ignores cancellation

When a Browser Use V4 run is cancelled or reaches its execution timeout, directExecution and pollForCompletion ignore the supplied abort signal and continue polling against a seven-day deadline, causing the engine to retain the timed-out execution and its worker resources until the provider finishes or that deadline expires.

Knowledge Base Used: Agent execution and sandbox tasks

Comment on lines 17 to 28
canvasPresentation: {
defaultTitle: 'Browser Use',
sentences: {
default: [
{ 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 }],
},
},
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Legacy sentence fallback removed

Existing Browser Use blocks lack the newly added operation value, so the operation-keyed presentation cannot select a sentence and has no default fallback. Those saved cards consequently regress from the compact sentence to the generic field-row layout.

Knowledge Base Used: Workflow authoring and rendering

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant