-
Notifications
You must be signed in to change notification settings - Fork 623
add hooks to agent #615
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
base: main
Are you sure you want to change the base?
add hooks to agent #615
Conversation
🦋 Changeset detectedLatest commit: df45905 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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.
PR Summary
Overall, the PR integrates new callback hooks into agent execution and refines type definitions to enforce stricter configuration. Key changes include:
• Updated lib/agent/AnthropicCUAClient.ts and lib/agent/OpenAICUAClient.ts to invoke onStep, onSuccess, and onFailure hooks during execution.
• Modified examples/cua-example.ts to use the updated "computer-use-preview" model.
• Enhanced hook propagation and error handling in lib/handlers/operatorHandler.ts and lib/handlers/agentHandler.ts.
• Revised types/agent.ts and types/stagehand.ts to introduce and enforce new hook and config definitions.
💡 (2/5) Greptile learns from your feedback when you react with 👍/👎!
9 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
); | ||
let playwrightArguments: ObserveResult | undefined; | ||
if (result.method === "act") { | ||
[playwrightArguments] = await this.stagehandPage.page.observe( |
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.
shouldn't the stagehandPage object already have act/extract observe?
completed: | ||
actions.length > 0 | ||
? (actions[actions.length - 1].taskCompleted as boolean) | ||
: false, |
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.
This was a good catch/suggestion, but I'm p sure we should throw an error here not return false. The previous code was kinda catching this without being informative
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.
just need to confirm cases where the agent sends a message without taking an action?
why
To extend the functionality of the
execute
function. This allows people to further build off of our agentic loop.what changed
Added
onStep
,onSuccess
, andonFailure
hookstest plan