Documentation Index
Fetch the complete documentation index at: https://mintlify.com/browserbase/stagehand/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheStagehand class (also exported as V3) is the primary interface for browser automation. It orchestrates browser sessions (local or Browserbase), manages LLM clients, and provides high-level methods for AI-driven web interaction.
Constructor
Configuration object for initializing Stagehand
Instance Methods
init()
Initialize the browser session and connect to CDP.Resolves when browser is ready
close()
Close the browser and clean up resources.Force immediate shutdown
act()
Perform an action on the page using natural language. See act() method reference for detailed documentation.extract()
Extract structured data from the page. See extract() method reference for detailed documentation.observe()
Find elements on the page matching a description. See observe() method reference for detailed documentation.agent()
Create an autonomous agent to complete multi-step tasks. See Agent class reference for detailed documentation.Properties
context
The CDP context managing browser connections and pages
llmClient
The LLM client used for AI operations
metrics
Token usage and performance metrics (async property)
history
History of all operations performed (async property)
isBrowserbase
Whether running on Browserbase
browserbaseSessionID
Current Browserbase session ID