Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion stagehand/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async def goto(
return result

async def act(
self, action_or_result: Union[str, ObserveResult], **kwargs
self, action_or_result: Union[str, ObserveResult, dict], **kwargs
) -> ActResult:
"""
Execute an AI action or a pre-observed action via the Stagehand server.
Expand Down Expand Up @@ -136,6 +136,10 @@ async def act(
payload = options.model_dump(exclude_none=True, by_alias=True)
elif isinstance(action_or_result, ActOptions):
payload = action_or_result.model_dump(exclude_none=True, by_alias=True)
elif isinstance(action_or_result, dict):
payload = ObserveResult(**action_or_result).model_dump(
exclude_none=True, by_alias=True
)
else:
raise TypeError(
"Invalid arguments for 'act'. Expected str, ObserveResult, or ActOptions."
Expand Down