act() allows Stagehand to interact with a web page. Provide an action like "Click on the add to cart button", or "Type 'Browserbase' into the search bar".
You can define variables that will not be shared with LLM providers
act() to perform complex actions. For multi-step actions, use Agent instead
Arguments: ActOptions | ObserveResult
- TypeScript
- Python
ActOptions:string
required
Describes the action to perform
AvailableModel
Specifies the model to use
object
Configuration options for the model client
Record<string, string>
Variables to use in the action. Variables in the action string are referenced using %variable_name%
boolean
Set
iframes: true if the target element exists within an iframenumber
Timeout in milliseconds for waiting for the DOM to settle
number
Timeout in milliseconds for the action being performed.
ObserveResult:string
required
A string representing the element selector
string
required
A string describing the possible action
string
required
The method to call on the element
object
required
The arguments to pass to the method
Returns: Promise<ActResult>
boolean
required
If the action was completed successfully
string
required
Details about the action’s execution
string
required
The action performed

