File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414
1515
1616from google .adk .agents import Agent
17+ from google .adk .agents .remote_a2a_agent import AGENT_CARD_WELL_KNOWN_PATH
1718from google .adk .agents .remote_a2a_agent import RemoteA2aAgent
1819from google .adk .tools .langchain_tool import LangchainTool
1920from langchain_community .tools import YouTubeSearchTool
4142 name = "bigquery_agent" ,
4243 description = "Help customer to manage notion workspace." ,
4344 agent_card = (
44- "http://localhost:8001/a2a/bigquery_agent/.well-known/agent.json "
45+ f "http://localhost:8001/a2a/bigquery_agent{ AGENT_CARD_WELL_KNOWN_PATH } "
4546 ),
4647)
4748
Original file line number Diff line number Diff line change 1515import random
1616
1717from google .adk .agents import Agent
18+ from google .adk .agents .remote_a2a_agent import AGENT_CARD_WELL_KNOWN_PATH
1819from google .adk .agents .remote_a2a_agent import RemoteA2aAgent
1920from google .adk .tools .example_tool import ExampleTool
2021from google .genai import types
@@ -87,7 +88,7 @@ def roll_die(sides: int) -> int:
8788 name = "prime_agent" ,
8889 description = "Agent that handles checking if numbers are prime." ,
8990 agent_card = (
90- "http://localhost:8001/a2a/check_prime_agent/.well-known/agent.json "
91+ f "http://localhost:8001/a2a/check_prime_agent{ AGENT_CARD_WELL_KNOWN_PATH } "
9192 ),
9293)
9394
Original file line number Diff line number Diff line change 1414
1515
1616from google .adk import Agent
17+ from google .adk .agents .remote_a2a_agent import AGENT_CARD_WELL_KNOWN_PATH
1718from google .adk .agents .remote_a2a_agent import RemoteA2aAgent
1819from google .genai import types
1920
@@ -28,7 +29,9 @@ def reimburse(purpose: str, amount: float) -> str:
2829approval_agent = RemoteA2aAgent (
2930 name = 'approval_agent' ,
3031 description = 'Help approve the reimburse if the amount is greater than 100.' ,
31- agent_card = 'http://localhost:8001/a2a/human_in_loop/.well-known/agent.json' ,
32+ agent_card = (
33+ f'http://localhost:8001/a2a/human_in_loop{ AGENT_CARD_WELL_KNOWN_PATH } '
34+ ),
3235)
3336
3437
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ dev = [
8080
8181a2a = [
8282 # go/keep-sorted start
83- " a2a-sdk>=0.2.7 ;python_version>='3.10'"
83+ " a2a-sdk>=0.2.11 ;python_version>='3.10'"
8484 # go/keep-sorted end
8585]
8686
Original file line number Diff line number Diff line change 2626
2727try :
2828 from a2a .client import A2AClient
29- from a2a .client .client import A2ACardResolver # Import A2ACardResolver
29+ from a2a .client .client import A2ACardResolver
3030 from a2a .types import AgentCard
3131 from a2a .types import Message as A2AMessage
3232 from a2a .types import MessageSendParams as A2AMessageSendParams
3535 from a2a .types import SendMessageRequest
3636 from a2a .types import SendMessageSuccessResponse
3737 from a2a .types import Task as A2ATask
38-
3938except ImportError as e :
4039 import sys
4140
4645 else :
4746 raise e
4847
48+ try :
49+ from a2a .utils .constants import AGENT_CARD_WELL_KNOWN_PATH
50+ except ImportError :
51+ # Fallback for older versions of a2a-sdk.
52+ AGENT_CARD_WELL_KNOWN_PATH = "/.well-known/agent.json"
53+
4954from google .genai import types as genai_types
5055import httpx
5156
6368from ..utils .feature_decorator import experimental
6469from .base_agent import BaseAgent
6570
71+ __all__ = [
72+ "A2AClientError" ,
73+ "AGENT_CARD_WELL_KNOWN_PATH" ,
74+ "AgentCardResolutionError" ,
75+ "RemoteA2aAgent" ,
76+ ]
77+
78+
6679# Constants
6780A2A_METADATA_PREFIX = "a2a:"
6881DEFAULT_TIMEOUT = 600.0
6982
70-
7183logger = logging .getLogger ("google_adk." + __name__ )
7284
7385
Original file line number Diff line number Diff line change @@ -1003,6 +1003,7 @@ async def _get_runner_async(app_name: str) -> Runner:
10031003 from a2a .server .request_handlers import DefaultRequestHandler
10041004 from a2a .server .tasks import InMemoryTaskStore
10051005 from a2a .types import AgentCard
1006+ from a2a .utils .constants import AGENT_CARD_WELL_KNOWN_PATH
10061007
10071008 from ..a2a .executor .a2a_agent_executor import A2aAgentExecutor
10081009
@@ -1066,7 +1067,7 @@ async def _get_a2a_runner_async() -> Runner:
10661067
10671068 routes = a2a_app .routes (
10681069 rpc_url = f"/a2a/{ app_name } " ,
1069- agent_card_url = f"/a2a/{ app_name } /.well-known/agent.json " ,
1070+ agent_card_url = f"/a2a/{ app_name } { AGENT_CARD_WELL_KNOWN_PATH } " ,
10701071 )
10711072
10721073 for new_route in routes :
You can’t perform that action at this time.
0 commit comments