[BUG]: Need option for custom url in agent card for a vertex ai A2A agent
🔴 Required Information
Describe the Bug
When configuring an AgentCard with a custom url parameter, the provided URL is ignored during deployment. Instead, the agent card URL is overwritten with an auto-generated URL in the format:
f"{base_url}/{api_version}/{self.api_resource.name}/a2a"
This is hardcoded in _agent_engines_utils.py#L1812, which completely overrides the user-supplied url field.
Steps to Reproduce
- Install
google-cloud-aiplatformwith Vertex AI extras - Configure an
AgentCardwith a custom URL:
agent = AgentCard(
name="agent-name",
description="A helpful assistant agent that can answer questions.",
url="https://custom.url.com/",
)
- Deploy the agent
- Fetch the agent card and inspect the
urlfield
Expected Behavior
The url field in the fetched AgentCard should match the custom URL provided during configuration (https://custom.url.com/).
Observed Behavior
The url field is overwritten with an auto-generated URL:
{base_url}/{api_version}/{self.api_resource.name}/a2a
The custom URL provided in AgentCard(url=...) is completely ignored.
Environment Details
- This is reproducable in recent adk version
Model Information
- Irrelevant to model
🟡 Optional Information
Regression
Did this work in a previous version of ADK? If so, which one? No
Additional Context
The relevant code that overrides the URL can be found here:
vertexai/_genai/_agent_engines_utils.py#L1812
It appears that custom url support for AgentCard is either not implemented or unintentionally broken. Should users be able to supply a custom URL, or is this a design limitation that needs to be documented?
Minimal Reproduction Code
from vertexai.preview.reasoning_engines import AgentCard
agent = AgentCard(
name="agent-name",
description="A helpful assistant agent that can answer questions.",
url="https://custom.url.com/",
)
# Deploy agent, then fetch agent card
# Observed: agent_card.url != "https://custom.url.com/"
# Expected: agent_card.url == "https://custom.url.com/"
How often has this issue occurred?
- [x] Always (100%)
+1
Hello @chnd777 ,
Could you please share which versions you are using? I cannot find any definition for AgentCard in vertexai.preview.reasoning_engines. Also, would it be possible for you to share the complete code so that we can review it and assist you better?
Hii @llalitkumarrr ,
the versions i am using, a2a-sdk (0.3.24) google-cloud-aiplatform (1.139.0)
` qna_agent_card = AgentCard(
name="Q&A Agent",
description="A helpful assistant agent that can answer questions.",
url="https://test.domain.com/a2a",
version="1.0.0",
default_input_modes=["text/plain"],
default_output_modes= ["application/json"],
# Agent Engine does not support streaming yet
capabilities=AgentCapabilities(streaming=False),
skills=[qna_agent_skill],
preferred_transport=TransportProtocol.http_json, # Http Only.
supports_authenticated_extended_card=True,
)`
` async def deploy():
client = init_vertex()
a2a_agent = A2aAgent(
agent_card=qna_agent_card, agent_executor_builder=QnAAgentExecutor
)
print("=== Deploying to Agent Engine ===")
print(a2a_agent.agent_card.url)
remote_a2a_agent = client.agent_engines.create(
agent=a2a_agent,
config={
"display_name": a2a_agent.agent_card.name,
"description": a2a_agent.agent_card.description,
"requirements": [
"google-cloud-aiplatform[agent_engines,adk]>=1.112.0",
"a2a-sdk>=0.3.4",
"cloudpickle>=3.0",
"pydantic>=2.0",
],
"extra_packages": ["./agent.py"],
"http_options": {
"base_url": f"https://{LOCATION}-aiplatform.googleapis.com",
"api_version": "v1beta1",
},
"staging_bucket": BUCKET_URI,
},
)`
I am following this doc for setting up A2A agent, https://colab.research.google.com/github/GoogleCloudPlatform/generative-ai/blob/main/agents/agent_engine/tutorial_a2a_on_agent_engine.ipynb#scrollTo=y0hvJyJbf0rK
def _service_binding() -> tuple[str, int, str]:
"""Return the public host, port, and protocol used by the A2A app."""
parsed = urlparse(settings.SERVICE_URL)
protocol = parsed.scheme or "http"
host = parsed.hostname or "localhost"
port = parsed.port or (443 if protocol == "https" else 80)
return host, port, protocol
agent_card = AgentCard(
name=settings.AGENT_NAME,
url=f"{protocol}://{host}:{port}/"
)
@chnd777
@kaligautier I did the same, you can check above.
Hello @chnd777 ,
Apologies for the delayed response. Could you please help us understand how this issue might be caused by the Google ADK? From my understanding, this issue seems to be related to a2a.
This issue has been automatically marked as stale because it has not had recent activity for 7 days after a maintainer requested clarification. It will be closed if no further activity occurs within 7 days.
Closing this issue due to inactivity for more than 14 days.