@@ -137,9 +137,14 @@ async def act(
137137 elif isinstance (action_or_result , ActOptions ):
138138 payload = action_or_result .model_dump (exclude_none = True , by_alias = True )
139139 elif isinstance (action_or_result , dict ):
140- payload = ObserveResult (** action_or_result ).model_dump (
141- exclude_none = True , by_alias = True
142- )
140+ if "description" in action_or_result :
141+ payload = ObserveResult (** action_or_result ).model_dump (
142+ exclude_none = True , by_alias = True
143+ )
144+ else :
145+ payload = ActOptions (** action_or_result ).model_dump (
146+ exclude_none = True , by_alias = True
147+ )
143148 else :
144149 raise TypeError (
145150 "Invalid arguments for 'act'. Expected str, ObserveResult, or ActOptions."
@@ -156,6 +161,10 @@ async def act(
156161 self , self ._stagehand , "" , self ._stagehand .self_heal
157162 )
158163 self ._stagehand .logger .debug ("act" , category = "act" , auxiliary = payload )
164+ if payload .get ("iframes" ):
165+ raise ValueError (
166+ "iframes is not yet supported without API (to enable make sure you set env=BROWSERBASE and use_api=true)"
167+ )
159168 result = await self ._act_handler .act (payload )
160169 return result
161170
0 commit comments