Skip to content

fix(a2a): honor PORT when serving locally#593

Open
notgitika wants to merge 2 commits into
mainfrom
fix/a2a-dev-port
Open

fix(a2a): honor PORT when serving locally#593
notgitika wants to merge 2 commits into
mainfrom
fix/a2a-dev-port

Conversation

@notgitika

Copy link
Copy Markdown
Contributor

Summary

  • Resolve serve_a2a's port from the explicit argument, then PORT, then the existing 9000 default.
  • Preserve explicit port= precedence for backwards compatibility.
  • Document the environment fallback and cover default, environment, and explicit-port behavior.

This is stacked on #591 because the current main branch does not yet contain the A2A SDK v1 serve_a2a implementation. It enables the CLI to assign distinct ports to multiple local CodeZip A2A runtimes.

Testing

  • pytest tests/bedrock_agentcore/runtime/test_a2a.py -q (28 passed)
  • ruff check and ruff format --check on changed Python files
  • Full suite: 2,795 passed, 10 skipped, 4 xpassed; the sole sandbox-blocked localhost integration test passed separately with socket access

@notgitika
notgitika changed the base branch from fix/a2a-sdk-v1 to main July 23, 2026 20:42
@notgitika
notgitika requested a review from a team July 23, 2026 20:42

@jariy17 jariy17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pretty good, just some edge cases to solve for

from starlette.responses import JSONResponse
from starlette.routing import Route

runtime_url = os.environ.get(AGENTCORE_RUNTIME_URL_ENV, "http://localhost:9000/")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PORT is used for uvicorn, but the generated agent card still defaults to localhost:9000. with PORT=9001, the server binds to 9001 while the card advertises 9000. can we pass the resolved port into the card URL and add a test for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants