From 03a8c2c20ad7914ff894c32f9fb64a20a36f572c Mon Sep 17 00:00:00 2001 From: Holt Skinner Date: Thu, 17 Jul 2025 18:10:43 +0100 Subject: [PATCH 1/2] refactor(spec): Update Agent Card Well-Known Path to `/.well-known/agent-card.json` Follow-up to https://github.com/a2aproject/A2A/pull/841 Release-As: 0.3.0 --- src/a2a/utils/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/a2a/utils/constants.py b/src/a2a/utils/constants.py index 4bb6c050..178a28c2 100644 --- a/src/a2a/utils/constants.py +++ b/src/a2a/utils/constants.py @@ -1,5 +1,5 @@ """Constants for well-known URIs used throughout the A2A Python SDK.""" -AGENT_CARD_WELL_KNOWN_PATH = '/.well-known/agent.json' +AGENT_CARD_WELL_KNOWN_PATH = '/.well-known/agent-card.json' EXTENDED_AGENT_CARD_PATH = '/agent/authenticatedExtendedCard' DEFAULT_RPC_URL = '/' From 0e1cff7bd4c5ee3afeb3450b98f47728723666fe Mon Sep 17 00:00:00 2001 From: Holt Skinner Date: Thu, 17 Jul 2025 18:17:01 +0100 Subject: [PATCH 2/2] Update instances of agent.json to agent-card.json --- tests/client/test_client.py | 11 +++++++---- tests/server/apps/jsonrpc/test_serialization.py | 4 ++-- tests/server/test_integration.py | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/client/test_client.py b/tests/client/test_client.py index 00ab8796..faf98ffe 100644 --- a/tests/client/test_client.py +++ b/tests/client/test_client.py @@ -128,7 +128,7 @@ async def async_iterable_from_list( class TestA2ACardResolver: BASE_URL = 'http://example.com' - AGENT_CARD_PATH = '/.well-known/agent.json' + AGENT_CARD_PATH = '/.well-known/agent-card.json' FULL_AGENT_CARD_URL = f'{BASE_URL}{AGENT_CARD_PATH}' EXTENDED_AGENT_CARD_PATH = ( '/agent/authenticatedExtendedCard' # Default path @@ -154,20 +154,23 @@ async def test_init_parameters_stored_correctly( httpx_client=mock_httpx_client, base_url=base_url, ) - assert resolver_default_path.agent_card_path == '.well-known/agent.json' + assert ( + resolver_default_path.agent_card_path + == '.well-known/agent-card.json' + ) @pytest.mark.asyncio async def test_init_strips_slashes(self, mock_httpx_client: AsyncMock): resolver = A2ACardResolver( httpx_client=mock_httpx_client, base_url='http://example.com/', # With trailing slash - agent_card_path='/.well-known/agent.json/', # With leading/trailing slash + agent_card_path='/.well-known/agent-card.json/', # With leading/trailing slash ) assert ( resolver.base_url == 'http://example.com' ) # Trailing slash stripped # constructor lstrips agent_card_path, but keeps trailing if provided - assert resolver.agent_card_path == '.well-known/agent.json/' + assert resolver.agent_card_path == '.well-known/agent-card.json/' @pytest.mark.asyncio async def test_get_agent_card_success_public_only( diff --git a/tests/server/apps/jsonrpc/test_serialization.py b/tests/server/apps/jsonrpc/test_serialization.py index 3091c0cd..b20051f4 100644 --- a/tests/server/apps/jsonrpc/test_serialization.py +++ b/tests/server/apps/jsonrpc/test_serialization.py @@ -59,7 +59,7 @@ def test_starlette_agent_card_with_api_key_scheme_alias( app_instance = A2AStarletteApplication(agent_card_with_api_key, handler) client = TestClient(app_instance.build()) - response = client.get('/.well-known/agent.json') + response = client.get('/.well-known/agent-card.json') assert response.status_code == 200 response_data = response.json() @@ -91,7 +91,7 @@ def test_fastapi_agent_card_with_api_key_scheme_alias( app_instance = A2AFastAPIApplication(agent_card_with_api_key, handler) client = TestClient(app_instance.build()) - response = client.get('/.well-known/agent.json') + response = client.get('/.well-known/agent-card.json') assert response.status_code == 200 response_data = response.json() diff --git a/tests/server/test_integration.py b/tests/server/test_integration.py index 5581711e..53299495 100644 --- a/tests/server/test_integration.py +++ b/tests/server/test_integration.py @@ -147,7 +147,7 @@ def client(app: A2AStarletteApplication, **kwargs): def test_agent_card_endpoint(client: TestClient, agent_card: AgentCard): """Test the agent card endpoint returns expected data.""" - response = client.get('/.well-known/agent.json') + response = client.get('/.well-known/agent-card.json') assert response.status_code == 200 data = response.json() assert data['name'] == agent_card.name @@ -315,7 +315,7 @@ def custom_handler(request): assert response.json() == {'message': 'Hello'} # Ensure default routes still work - response = client.get('/.well-known/agent.json') + response = client.get('/.well-known/agent-card.json') assert response.status_code == 200 data = response.json() assert data['name'] == agent_card.name @@ -339,7 +339,7 @@ def custom_handler(request): assert response.json() == {'message': 'Hello'} # Ensure default routes still work - response = client.get('/.well-known/agent.json') + response = client.get('/.well-known/agent-card.json') assert response.status_code == 200 data = response.json() assert data['name'] == agent_card.name