generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 617
feat(a2a): add A2AAgent class #1441
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
Open
mkmeral
wants to merge
29
commits into
strands-agents:main
Choose a base branch
from
mkmeral:fix/a2a-agent-review-comments
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(a2a): add A2AAgent class #1441
mkmeral
wants to merge
29
commits into
strands-agents:main
from
mkmeral:fix/a2a-agent-review-comments
Conversation
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
…face for remote A2A protocol based agents
…d function + reduce use of Any type
…y constructor parameters
- Fix invoke_async to delegate to stream_async (prevents returning first incomplete event) - Add async context manager support (__aenter__/__aexit__) and explicit aclose() method - Improve __del__ cleanup to handle event loop edge cases - Change logger.info to logger.debug for consistency with project standards - Simplify factory creation with _create_default_factory() helper method - Add comprehensive documentation to A2AStreamEvent - Improve test fixture pattern with pytest fixture for subprocess management - Add comprehensive e2e tests for invoke_async, stream_async, and context manager Addresses PR strands-agents#1174 review comments: - Comment strands-agents#2: Critical bug - invoke_async now waits for complete events - Comment strands-agents#5: Code duplication - invoke_async delegates to stream_async - Comment strands-agents#6: Async cleanup - proper async context manager pattern - Comment strands-agents#3: Logging level - changed to debug - Comment strands-agents#4: Factory simplification - extracted helper method - Comment strands-agents#12: Documentation - documented A2AStreamEvent behavior - Comment strands-agents#9: Test fixture - using pytest fixture pattern - Comment strands-agents#10: Test coverage - added comprehensive e2e tests
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as off-topic.
This comment was marked as off-topic.
dbschmigelski
previously approved these changes
Jan 22, 2026
zastrowm
requested changes
Jan 22, 2026
zastrowm
previously approved these changes
Jan 28, 2026
dbschmigelski
previously approved these changes
Jan 28, 2026
Tests that create real httpx.AsyncClient instances now explicitly clear the client reference to prevent __del__ from attempting async cleanup during garbage collection, which can deadlock on Windows due to ProactorEventLoop + ThreadPoolExecutor issues. Refs: - python/cpython#83413 - aio-libs/aiohttp#4324
This reverts commit bfb51a5.
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.
Description
Picking up from @awsarron's work in #1174 to address review feedback.
A2AAgent makes it simple to consume remote A2A agents and invoke them like any other Strands Agent. This PR addresses the open review comments from the original implementation.
Changes from original PR:
logger.infotologger.debugfor agent card discovery and message sending_create_default_factory()helper methodinvoke_asyncto delegate tostream_async(ensures consistent behavior)A2AStreamEventexplaining when events are emitted__del__cleanup behaviorExample usage (unchanged from original):
Follow-ups:
Related Issues
#907
Resolves review comments from #1174
Documentation PR
TODO
Type of Change
New feature
Testing
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
diff of a2a agent compared to original PR
REV2
streaming=Trueby default with the client. Otherwise streaming would require both custom client and using stream async. Right now both stream async and invoke async would work normally.