Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

StageHand tool error [Critical bug] #412

Description

@zalexdev

When using

StagehandTool(
    api_key="your-browserbase-api-key",
    project_id="your-browserbase-project-id",
    model_api_key="your-llm-api-key",  # OpenAI or Anthropic API key
    model_name=AvailableModel.CLAUDE_3_7_SONNET_LATEST,  # Optional: specify which model to use
)

in stagehand_tool.py:

 # Build the StagehandConfig object
            config = StagehandConfig(
                env="BROWSERBASE",
                api_key=self.api_key,
                project_id=self.project_id,
                headless=self.headless,
                dom_settle_timeout_ms=self.dom_settle_timeout_ms,
                model_name=self.model_name,
                self_heal=self.self_heal,
                modelApiKey=self.model_api_key, <--- this line is missng!!!
                wait_for_captcha_solves=self.wait_for_captcha_solves,
                model_client_options=model_client_options,
                verbose=self.verbose,
                session_id=session_id or self._session_id,
            )

and so the tool is absolutely unusable because of api error

┌────────────────────────── 🔧 Agent Tool Execution ──────────────────────────┐
│                                                                             │
│  Agent: Ultimate AI Assistant with Browser Control                          │
│                                                                             │
│  Thought: Thought: I need to navigate to the specified URL and extract      │
│  information about contest winners using the Browser Automation tool.       │
│                                                                             │
│  Using Tool: Browser Automation                                             │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────── Tool Input ─────────────────────────────────┐
│                                                                             │
│  "{\"instruction\": \"Extract information about contest winners\",          │
│  \"url\": \"https://site.com\", \"command_type\": \"extract\",              │
│  \"selector\": null}"                                                       │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘
┌──────────────────────────────── Tool Output ────────────────────────────────┐
│                                                                             │
│                                                                             │
│  ✅ Browser Automation Complete!                                            │
│  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━                                               │
│  🌐 URL: https://site.com                                                   │
│  📋 Command: extract                                                        │
│  📝 Instruction: Extract information about contest winners                  │
│  ⏱️ Execution time: 0.3 seconds                                             │
│                                                                             │
│  📊 Result:                                                                 │
│  Error: Error using Stagehand: model_api_key is required to create a        │
│  session.                                                                   │
│  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━                                               │
│                                                                             │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘

Please fix :)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions