feat(a2a): support mounts for containerized deployments #524
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
This PR adds native support for configurable public URLs and automatic path-based mounting to the
A2AServerclass, enabling seamless deployment in containerized environments and behind load balancers with path-based routing.Key Changes
1. New
http_urlParameterhttp_url: str | None = Noneparameter toA2AServerconstructorhost:portfor public agent card URLshost/portfor internal binding,http_urlfor external access2. Automatic Path-Based Mounting
http_urlcontains a path component, the server automatically mounts the A2A application at that path3. Escape Hatch for Path-Stripping Load Balancers
serve_at_root: bool = Falseparameter as an escape hatch for edge casesTrue, forces the server to serve at root path regardless ofhttp_urlpath component4. Enhanced URL Handling
_parse_public_url()method to extract base URL and mount path from provided URLs5. Framework Integration
to_starlette_app()andto_fastapi_app()methods to handle mountingUse Cases Solved
0.0.0.0:8080) vs external URL (https://my-alb.amazonaws.com)serve_at_root=True)Related Issues
Addresses two GitHub feature requests:
Documentation PR
Will publish a followup PR for docs.
Type of Change
New feature
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
hatch run prepareChecklist
Examples of New Functionality:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.