diff --git a/docs/guides/advanced.rst b/docs/guides/advanced.rst index 69ffda5..684d28c 100644 --- a/docs/guides/advanced.rst +++ b/docs/guides/advanced.rst @@ -148,7 +148,7 @@ You can add authentication to your A2A agents to protect them from unauthorized @app.before_request def authenticate(): # Skip authentication for agent card - if request.path in ["/", "/a2a", "/agent.json", "/a2a/agent.json"]: + if request.path in ["/", "/a2a", "/.well-known/agent.json", "/a2a/agent.json"]: return None # Check for Authorization header diff --git a/examples/developer_tools/interactive_docs.py b/examples/developer_tools/interactive_docs.py index 2d95707..eb71f06 100644 --- a/examples/developer_tools/interactive_docs.py +++ b/examples/developer_tools/interactive_docs.py @@ -431,7 +431,7 @@ def generate_html_template():
Returns information about the agent, including its capabilities and available skills.
@@ -664,7 +664,7 @@ def main(): } ], "paths": { - "/agent.json": { + "/.well-known/agent.json": { "get": { "summary": "Get agent information", "description": "Returns information about the agent, including its capabilities and skills", diff --git a/python_a2a/client/a2a_client.py b/python_a2a/client/a2a_client.py index c3a4363..25b6305 100644 --- a/python_a2a/client/a2a_client.py +++ b/python_a2a/client/a2a_client.py @@ -51,7 +51,7 @@ def _fetch_agent_card(self): """Fetch the agent card from the well-known URL""" # Try standard A2A endpoint first try: - card_url = f"{self.url}/agent.json" + card_url = f"{self.url}/.well-known/agent.json" response = requests.get(card_url, headers=self.headers) response.raise_for_status() card_data = response.json() diff --git a/python_a2a/client/http.py b/python_a2a/client/http.py index 2f0312d..3b92a2e 100644 --- a/python_a2a/client/http.py +++ b/python_a2a/client/http.py @@ -51,7 +51,7 @@ def _fetch_agent_card(self): """Fetch the agent card from the well-known URL""" # Try standard A2A endpoint first try: - card_url = f"{self.endpoint_url}/agent.json" + card_url = f"{self.endpoint_url}/.well-known/agent.json" response = requests.get(card_url, headers=self.headers, timeout=self.timeout) response.raise_for_status() card_data = response.json() diff --git a/python_a2a/docs/__init__.py b/python_a2a/docs/__init__.py index 8877287..c7db377 100644 --- a/python_a2a/docs/__init__.py +++ b/python_a2a/docs/__init__.py @@ -23,7 +23,7 @@ def generate_a2a_docs(agent_card, output_dir=None): "description": agent_card.description }, "paths": { - "/agent.json": { + "/.well-known/agent.json": { "get": { "summary": "Get agent card", "responses": { diff --git a/python_a2a/docs/openai.py b/python_a2a/docs/openai.py index 8877287..c7db377 100644 --- a/python_a2a/docs/openai.py +++ b/python_a2a/docs/openai.py @@ -23,7 +23,7 @@ def generate_a2a_docs(agent_card, output_dir=None): "description": agent_card.description }, "paths": { - "/agent.json": { + "/.well-known/agent.json": { "get": { "summary": "Get agent card", "responses": { diff --git a/python_a2a/server/a2a_server.py b/python_a2a/server/a2a_server.py index 642e98f..9fe207f 100644 --- a/python_a2a/server/a2a_server.py +++ b/python_a2a/server/a2a_server.py @@ -164,7 +164,7 @@ def a2a_root_get(): return jsonify({ "name": self.agent_card.name, "description": self.agent_card.description, - "agent_card_url": "/agent.json", + "agent_card_url": "/.well-known/agent.json", "protocol": "a2a" }) @@ -215,7 +215,7 @@ def a2a_agent_card(): return jsonify(self.agent_card.to_dict()) # Also support the standard agent.json at the root - @app.route("/agent.json", methods=["GET"]) + @app.route("/.well-known/agent.json", methods=["GET"]) def agent_card(): """Return the agent card as JSON (standard location)""" return jsonify(self.agent_card.to_dict()) diff --git a/python_a2a/server/http.py b/python_a2a/server/http.py index dd87186..a8377bb 100644 --- a/python_a2a/server/http.py +++ b/python_a2a/server/http.py @@ -140,7 +140,7 @@ def enhanced_a2a_agent_json(): response.headers['Content-Type'] = 'text/html; charset=utf-8' return response - @app.route("/agent.json", methods=["GET"]) + @app.route("/.well-known/agent.json", methods=["GET"]) def enhanced_root_agent_json(): """Root agent.json endpoint""" return enhanced_a2a_agent_json() diff --git a/tests/test_client.py b/tests/test_client.py index 3b68d7f..29d29d6 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -30,7 +30,7 @@ def test_send_message(self, text_message): # Mock all possible agent card and task endpoints responses.add( responses.GET, - "https://example.com/agent.json", + "https://example.com/.well-known/agent.json", json={"error": "Not found"}, status=404 ) @@ -84,7 +84,7 @@ def test_send_conversation(self, conversation): # Mock the agent card endpoints to prevent additional calls responses.add( responses.GET, - "https://example.com/agent.json", + "https://example.com/.well-known/agent.json", json={"error": "Not found"}, status=404 )