-
Notifications
You must be signed in to change notification settings - Fork 1k
add playwright arguments to agent #1066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 8473aa4 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR restores the missing playwrightArguments
field to the agent execute response, addressing issue #1060. The implementation adds observe calls to capture Playwright action details (selector, method, arguments, description) before executing actions, then passes these details through the tool result chain to be included in the final AgentAction
.
Key changes:
- Modified
act.ts
to callobserve()
beforeact()
to capture Playwright arguments - Updated
stagehandAgentHandler.ts
to extract and includeplaywrightArguments
from tool results - Added new TypeScript interfaces for
PlaywrightArguments
andActToolResult
- Handles both regular and iframe action scenarios
- Added proper changeset documentation
Issues identified:
- Inconsistent parameter usage between execution model paths in act tool
- Iframe observe options don't use
buildActObservePrompt()
for consistency
Confidence score: 3/5
- This PR addresses a valid regression but has some logical inconsistencies that should be resolved
- The implementation successfully restores the missing playwrightArguments functionality, but there are two logical issues: inconsistent parameter usage between execution paths and inconsistent observe prompt building in iframe handling. These issues could cause runtime problems or unexpected behavior.
- Pay close attention to lib/agent/tools/act.ts for the parameter consistency issues
3 files reviewed, 2 comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR restores the playwrightArguments
field to the AgentResult
that was previously removed, addressing issue #1060. The changes implement a new approach that uses observe()
first to get the playwright arguments, then executes the action with act()
.
Key changes:
- Modified
act.ts
tool to callobserve()
beforeact()
to capture playwright arguments - Updated
stagehandAgentHandler.ts
to extract and include playwright arguments in the agent response - Added proper TypeScript types for
PlaywrightArguments
andActToolResult
- Handles both regular and iframe contexts appropriately
Confidence score: 4/5
- This PR is safe to merge with minor style improvements recommended
- Score reflects well-structured implementation that addresses the regression properly with comprehensive type safety and error handling, though there's a minor consistency issue with iframe prompt building
- No files require special attention, though the iframe observe logic could be made more consistent
1 file reviewed, 1 comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR restores the missing playwrightArguments
field in agent execution responses, addressing a regression where playwright execution details were no longer being returned to users. The fix refactors the act tool to use the observe/act pattern consistently, extracting playwright action details from observe results and including them in all response paths (normal execution, iframe handling, and error cases).
Confidence score: 4/5
- This PR is safe to merge with low risk
- Score reflects a well-structured fix that restores expected functionality. The code properly handles all execution paths including iframe scenarios and error cases. The refactor to consistently use observe/act pattern improves code organization.
- No files require special attention
1 file reviewed, no comments
why
solves #1060
patch regression of playwright arguments being removed from agent execute response
what changed
agent.execute now returns playwright arguments in its response
test plan
tested locally