refactor: decouple InvokableAgent from A2A dependency#2
Closed
refactor: decouple InvokableAgent from A2A dependency#2
Conversation
…strands-agents#445) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ands-agents#450) Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com>
…s-agents#322) Co-authored-by: Patrick Gray <pgrayy@amazon.com>
…t to use real path (strands-agents#465)
Co-authored-by: Lionel Seguin <lionel.seguin@contentsquare.com>
…on (strands-agents#509) Co-authored-by: Patrick Gray <pgrayy@amazon.com>
…ts#518) Co-authored-by: Containerized Agent <agent@containerized-strands.local>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…gents#541) Co-authored-by: Strands Agent <217235299+strands-agent@users.noreply.github.com>
…gents#496) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…nts#526) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…gents#635) Co-authored-by: Strands Agent <217235299+strands-agent@users.noreply.github.com>
…#619) Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com>
Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com>
Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com>
…-agents#601) Co-authored-by: Josh Samuel <3156090+jsamuel1@users.noreply.github.com>
Co-authored-by: Mackenzie Zastrow <zastrowm@users.noreply.github.com>
…type discriminators (strands-agents#665)
… rename MultiAgentBase to MultiAgent - Rename AgentBase to InvokableAgent for invoke/stream capability - Rename AgentData to LocalAgent for local state/messages/tools/hooks - Agent implements both; A2AAgent implements InvokableAgent only - Remove type discriminators from InvokableAgent and MultiAgent - Rename MultiAgentBase to MultiAgent, rename base.ts to multiagent.ts - Add A2AResultEvent so A2AAgent no longer fakes LocalAgent fields - Remove A2AStreamUpdateEvent from AgentStreamEvent union - Remove InvokableAgent and MultiAgent from public exports - Update Graph._resolveNodes to use instanceof checks BREAKING CHANGE: AgentBase renamed to InvokableAgent, AgentData renamed to LocalAgent, MultiAgentBase renamed to MultiAgent. Type discriminators removed from agent and multi-agent interfaces. AgentStreamEvent no longer includes A2AStreamUpdateEvent.
Replace the A2A-dependent event union on InvokableAgent.stream() with the abstract StreamEvent base class, removing the transitive @a2a-js/sdk requirement from multiagent consumers. - InvokableAgent.stream() now yields StreamEvent (empty abstract class) - NodeStreamUpdateEvent.event renamed to .inner (NodeInnerEvent type) - NodeInnerEvent is a source-tagged discriminated union: - source: 'agent' for AgentStreamEvent - source: 'multiAgent' for MultiAgentStreamEvent - source: 'custom' for third-party StreamEvent subclasses - A2AExecutor uses instanceof narrowing (internal, not consumer-facing) - Export NodeInnerEvent from multiagent barrel
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.
Motivation
Consumers of the multiagent module (Graph, Swarm) were transitively pulling in
@a2a-js/sdktypes becauseInvokableAgent.stream()yieldedAgentStreamEvent | A2AStreamEvent. This made the A2A package effectively required for anyone using multi-agent orchestration, even when no A2A agents were involved.Changes
InvokableAgent.stream()now yieldsStreamEvent, an empty abstract base class with no fields. This removes the transitive dependency on A2A types from the public interface.To preserve type-safe event handling in multi-agent orchestration,
NodeStreamUpdateEvent.eventis renamed toNodeStreamUpdateEvent.innerwith a newNodeInnerEventdiscriminated union type. The union is tagged bysource:Consumers switch on
inner.sourcefirst, theninner.typefor full discriminated union narrowing:A2AExecutorusesinstanceofnarrowing internally since it receivesStreamEventfromInvokableAgent.stream(). This is an internal implementation detail, not consumer-facing.Breaking Changes
NodeStreamUpdateEvent.eventrenamed toNodeStreamUpdateEvent.innerNodeStreamUpdateEvent.innertype changed fromAgentStreamEvent | A2AStreamEvent | ...toNodeInnerEvent(source-tagged union)InvokableAgent.stream()yield type changed fromAgentStreamEventtoStreamEvent