You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Right now, we need to supply a URL in the agent card, which means you already know its host and port. This is fine for static ports, but especially in small demos or e2e tests is less elegant.
Describe the solution you'd like
it would be nice to use port=0 and resolve AgentCard.url based on the bound port. This could be automatic, for example, to backfill it when absent with the uvicorn address
Describe alternatives you've considered
search for an open port and use that, or patch A2AStarletteApplication or JSONRPCHandler
Additional context
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
For now, I use an explicit port like this, so that I can pass a value in the agent card which is coherent with the later port actually used.
# TODO: remove after https://github.com/google/a2a-python/issues/4default_port=10000--snip--returnAgentCard(
name="ElasticsearchVersionAgent",
description="Answers questions about Elasticsearch versions.",
version="1.0.0",
url=f"http://localhost:{default_port}/",
--snip--app=A2AStarletteApplication(agent_card=agent.card(), http_handler=request_handler).build()
# For convenience, launch the server in the same process as the client.asyncwithserve_on_default_port(app):
--snip--
@asynccontextmanagerasyncdefserve_on_default_port(app: Callable[..., Any]) ->AsyncIterator[None]:
"""Registers the app and serves it on the default port."""config=uvicorn.Config(app, host="127.0.0.1", port=default_port, log_level="error")
server=uvicorn.Server(config)
task=asyncio.create_task(server.serve())
whilenot (serverandserver.started):
awaitasyncio.sleep(0.01)
try:
yieldfinally:
server.should_exit=Trueawaitserver.shutdown()
task.cancel()
Is your feature request related to a problem? Please describe.
Right now, we need to supply a URL in the agent card, which means you already know its host and port. This is fine for static ports, but especially in small demos or e2e tests is less elegant.
Describe the solution you'd like
it would be nice to use port=0 and resolve AgentCard.url based on the bound port. This could be automatic, for example, to backfill it when absent with the uvicorn address
Describe alternatives you've considered
search for an open port and use that, or patch A2AStarletteApplication or JSONRPCHandler
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: