Stagehand runs browser automation using Browserbase and an LLM. Use Extract to retrieve page data matching a schema. Use Agent for a task that requires multiple browser interactions, such as navigating and filling out a form. Configure the Browserbase and model credentials required by the selected operation.
Extract structured data from webpages or run an autonomous agent to perform tasks.
Extract structured data from a webpage using Stagehand
Parameter Type Required Description urlstring Yes URL of the webpage to extract data from instructionstring Yes Instructions for extraction providerstring No AI provider to use: openai or anthropic apiKeystring Yes API key for the selected provider schemajson Yes JSON schema defining the structure of the data to extract
Parameter Type Description dataobject Extracted structured data matching the provided schema
Run an autonomous web agent to complete tasks and extract structured data
Inputs and outputsParameter Type Required Description startUrlstring Yes URL of the webpage to start the agent on taskstring Yes The task to complete or goal to achieve on the website variablesjson No Optional variables to substitute in the task (format: {key: value}). Reference in task using %key% providerstring No AI provider to use: openai or anthropic apiKeystring Yes API key for the selected provider outputSchemajson No Optional JSON schema defining the structure of data the agent should return modestring No Agent tool mode: dom (default), hybrid, or cua maxStepsnumber No Maximum agent steps (default 20, max 200)
Parameter Type Description agentResultobject Result from the Stagehand agent execution ↳ success boolean Whether the agent task completed successfully without errors ↳ completed boolean Whether the agent finished executing (may be false if max steps reached) ↳ message string Final status message or result summary from the agent ↳ actions array List of all actions performed by the agent during task execution ↳ type string Type of action performed (e.g., "act", "observe", "ariaTree", "close", "wait", "navigate") ↳ reasoning string AI reasoning for why this action was taken ↳ taskCompleted boolean Whether the task was completed after this action ↳ action string Description of the action taken (e.g., "click the submit button") ↳ instruction string Instruction that triggered this action ↳ pageUrl string URL of the page when this action was performed ↳ pageText string Page text content (for ariaTree actions) ↳ timestamp number Unix timestamp when the action was performed ↳ timeMs number Time in milliseconds (for wait actions) structuredOutputobject Extracted data matching the provided output schema liveViewUrlstring Embeddable Browserbase live view URL (active only while the session is running) sessionIdstring Browserbase session identifier