Add WithoutBroadcasting attribute to skip oversized stream events#752
Open
pushpak1300 wants to merge 5 commits into
Open
Add WithoutBroadcasting attribute to skip oversized stream events#752pushpak1300 wants to merge 5 commits into
pushpak1300 wants to merge 5 commits into
Conversation
WendellAdriel
requested changes
Jun 30, 2026
| * @param array<int, class-string<StreamEvent>> $events | ||
| */ | ||
| public static function allows(?object $target, StreamEvent $event): bool | ||
| public static function withholds(array $events, StreamEvent $event): bool |
Member
There was a problem hiding this comment.
Is this expected to be withholds or should be withHolds?
Member
Author
There was a problem hiding this comment.
i think for simplicity changed to excludes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently there isn't a clean way to stop
BroadcastAgentfrom broadcasting everyStreamEvent. Tool results from data-heavy tools (listing records, search, email bodies) routinely blow past the 10KB WebSocket frame limit on Reverb/Pusher, which throws aBroadcastExceptionand fails the whole queued job. Folks have been working around it by subclassing the job and overridingbroadcastOnQueue(see #174).This PR adds a class attribute so an affected agent can opt out of broadcasting specific event types:
The named events simply never hit the websocket; the frontend loads tool data from
agent_conversation_messagesafter the stream completes, same as the existing workaround. No attribute means everything broadcasts as before, so nothing changes for the majority who never hit the limit. It applies to both the queued (broadcastOnQueue) and synchronous (broadcast/broadcastNow) paths.Went with an attribute to match the existing
#[MaxSteps]/#[Timeout]style and avoid widening theAgentcontract or threading a new param through three broadcast signatures. Open to renaming if you'd prefer something else.Fixes #174