datarobot_genai.dragent.a2a.cards
cards
Reading A2A agent cards of either protocol version into a2a-sdk 1.x's AgentCard.
Used wherever dragent consumes other agents' cards: the A2A clients, the agent card registry and its cache, and the Okta cross-app provider.
card_rpc_url
Return the URL a client sends JSON-RPC calls to.
v0.3 cards carry it as the top-level url, which parses into the card's first
interface; v1.0 cards list it in supportedInterfaces. When a card offers JSON-RPC at
several protocol versions, this picks the interface the SDK's ClientFactory picks
(v1.0 first, then the newest supported), so it is the endpoint the client actually
calls. Falls back to the first interface of any binding, else "".
Source code in datarobot_genai/dragent/a2a/cards.py
best_interface
best_interface(interfaces: Sequence[AgentInterface], protocol_binding: str) -> AgentInterface | None
Return the interface the SDK's client calls for protocol_binding, if any.
The first v1.0 interface wins, then the first newer than v1.0, then the first from v0.3 on,
then the first without a version. This follows ClientFactory._find_best_interface of
a2a-sdk 1.x, which is private and so not called here; test_cards checks they agree.
Source code in datarobot_genai/dragent/a2a/cards.py
parse_agent_card
Parse agent card JSON of either protocol version into a protobuf AgentCard.
The input is not modified.
Raises
ValueError The data is not a valid agent card, or lacks a name or an interface URL.
Source code in datarobot_genai/dragent/a2a/cards.py
fetch_agent_card
async
fetch_agent_card(httpx_client: AsyncClient, base_url: str, agent_card_path: str = AGENT_CARD_WELL_KNOWN_PATH) -> AgentCard
GET the agent card at agent_card_path under base_url and parse it.
Replaces a2a.client.A2ACardResolver, which rejects v0.3 cards whose OAuth2 scheme
lists several flows (see :func:parse_agent_card).
Raises
httpx.HTTPError The request failed or returned an error status. ValueError The response is not a valid agent card.