feat: add AbortSignal support to Agent and BedrockModel#618
Open
jsamuel1 wants to merge 2 commits intostrands-agents:mainfrom
Open
feat: add AbortSignal support to Agent and BedrockModel#618jsamuel1 wants to merge 2 commits intostrands-agents:mainfrom
jsamuel1 wants to merge 2 commits intostrands-agents:mainfrom
Conversation
03caff2 to
65b35af
Compare
Contributor
Author
|
Note: AbortSignal threading through |
Plumb AbortSignal through the invocation stack so callers can cancel in-flight requests: - InvokeOptions.signal passed to Agent.invokeModel - StreamOptions.signal passed to Model.stream - BedrockModel forwards signal as abortSignal to AWS SDK client --- Prompt: put abort signal changes into a new PR based off upstream main
6aff63a to
94b071f
Compare
Thread AbortSignal through the multiagent orchestration layer: - Add MultiAgentOptions with signal to MultiAgent interface - Swarm checks signal.aborted before each handoff step - Graph checks signal.aborted before launching new nodes - Signal forwarded through Node.stream() → handle() → agent.stream() so running agents are cancelled - Return CANCELLED status when signal is aborted - Guard Swarm._resolveContent for empty results --- Prompt: work out how AbortSignal should work with multiagent
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.
Summary
Plumb
AbortSignalthrough the invocation stack so callers can cancel in-flight requests:InvokeOptions.signalpassed toAgent.invokeModelStreamOptions.signalpassed toModel.streamBedrockModelforwards signal asabortSignalto AWS SDK clientUsage
Follow-up needed after multi-agent PRs merge
Once the swarm (#587) and graph (#594) multi-agent PRs land, abort signal propagation should be added to both:
signal?: AbortSignalinSwarmInvokeOptionsand checkssignal.abortedat the top of the loop, but does NOT forward the signal tonode.agent.stream(input). It should pass{ signal: options.signal }to each agent invocation so in-flight model calls are actually cancelled.signaloption, check it between node executions, and forward it to each agent invocation.