Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

  • fix(stagehand): incl stagehand in the standalone build
  • fix(stagehand): updated browser use and stagehand to use the latest models

Summary

updated browser use and stagehand to use the latest models

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Dec 11, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Dec 11, 2025 10:39pm

@waleedlatif1 waleedlatif1 merged commit 3b9cbea into staging Dec 11, 2025
5 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/sh branch December 11, 2025 22:41
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 11, 2025

Greptile Overview

Greptile Summary

Updated stagehand and browser_use tool configurations to use the latest model identifiers, added provider prefixes for proper routing, and included stagehand in standalone builds.

Key Changes

  • Stagehand Agent: Changed model from claude-sonnet-4-20250514 to anthropic/claude-3-7-sonnet-latest with provider prefix
  • Stagehand Agent: Added executionModel configuration for separate execution model control
  • Stagehand Extract: Updated model to include provider prefix (openai/gpt-4o)
  • Browser Use: Expanded model dropdown from 5 to 16 options including GPT-4.1, O3, O4 Mini, Gemini 2.5/3, Claude Sonnet 4/4.5, and Opus 4.5
  • Build Configuration: Added @browserbasehq/stagehand to serverExternalPackages for standalone build compatibility
  • Error Handling: Improved schema parsing logic with better fallback handling
  • Logging: Removed verbose debug log in subblock handler

Observations

The model identifier changes from dated versions (e.g., claude-sonnet-4-20250514) to "latest" aliases (e.g., claude-3-7-sonnet-latest) ensures the tools automatically use current model versions without requiring code updates.

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - it updates model configurations and adds newer model options
  • Score reflects straightforward configuration updates to use latest model identifiers. The changes properly add provider prefixes for model routing, include stagehand in standalone builds, and expand available model options. One minor concern is the large number of new model options added to browser_use without validation that all are actually supported by the underlying API
  • Verify that all 16 model options in apps/sim/blocks/blocks/browser_use.ts are supported by the browser_use API

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/app/api/tools/stagehand/agent/route.ts 4/5 Updated stagehand model from claude-sonnet-4-20250514 to anthropic/claude-3-7-sonnet-latest, added executionModel config, improved error handling for schema parsing
apps/sim/app/api/tools/stagehand/extract/route.ts 5/5 Added provider prefix to model name: gpt-4oopenai/gpt-4o
apps/sim/blocks/blocks/browser_use.ts 4/5 Expanded model options from 5 to 16 models, including GPT-4.1, O3, O4 Mini, Gemini 2.5/3, Claude Sonnet 4/4.5, and Opus 4.5
apps/sim/next.config.ts 5/5 Added @browserbasehq/stagehand to serverExternalPackages for standalone build compatibility
apps/sim/socket-server/handlers/subblocks.ts 5/5 Removed debug log statement after successful subblock update flush

Sequence Diagram

sequenceDiagram
    participant Client
    participant StagehandAPI
    participant Stagehand
    participant LLMProvider
    participant Browser

    Client->>StagehandAPI: POST /api/tools/stagehand/agent
    activate StagehandAPI
    
    StagehandAPI->>StagehandAPI: Initialize with model config
    Note over StagehandAPI: modelName: anthropic/claude-3-7-sonnet-latest
    
    StagehandAPI->>Stagehand: new Stagehand(config)
    activate Stagehand
    Stagehand->>Browser: Initialize Browserbase
    Browser-->>Stagehand: Browser context ready
    Stagehand-->>StagehandAPI: Stagehand instance
    
    StagehandAPI->>Stagehand: agent({ model, executionModel })
    Note over Stagehand: Both model & executionModel<br/>use claude-3-7-sonnet-latest
    Stagehand-->>StagehandAPI: Agent instance
    
    StagehandAPI->>Stagehand: agent.execute(instruction)
    activate LLMProvider
    Stagehand->>LLMProvider: Request with anthropic/claude-3-7-sonnet-latest
    LLMProvider-->>Stagehand: Model response
    deactivate LLMProvider
    
    Stagehand->>Browser: Execute browser actions
    Browser-->>Stagehand: Action results
    
    alt Has output schema
        Stagehand->>StagehandAPI: Parse JSON response
        alt Parse fails
            StagehandAPI->>Stagehand: extract(schema)
            Stagehand->>Browser: Extract data from page
            Browser-->>Stagehand: Extracted data
        end
    end
    
    Stagehand-->>StagehandAPI: Agent result
    deactivate Stagehand
    
    StagehandAPI-->>Client: Success response
    deactivate StagehandAPI
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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.

2 participants