Skip to content

Conversation

hugoncosta
Copy link
Contributor

Issue #, if available: #3034

Description of changes:
See #2875 for the initial implementation. Sometimes, the Agents run the tools several times in a particular turn (e.g. when writing code, they don't write the whole thing at once, especially when dealing with already existing files).

With this feature, you can set your hook to only run at the end of the turn, allowing you to only run e.g. formatting/tests when the whole file is written.

Tested locally, it's working as intended - only after doing all the fs_write did it do the formatting (I used the example currently in the hooks.md that runs cargo fmt after it's done).

This is a simplified version of what I had originally proposed in #3036, more in line with industry expectations as well.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

docs/hooks.md Outdated
- **0**: Hook succeeded.
- **Other**: Show STDERR warning to user. Tool already ran.

### EndOfTurn
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, also renamed to Stop per our offline conversation

@hugoncosta hugoncosta changed the title feat: add EndOfTurn hook feat: add Stop hook Oct 2, 2025
@dk19y dk19y merged commit 888c276 into aws:main Oct 2, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants