Skip to content

Commit 57d212d

Browse files
vvillait88claude
andcommitted
fix(identity): pin parity behavior + README example for A2A extensions
Test added asserting that build_a2a_agent_card omits the extensions field when passed an empty list — locks down current behavior so it can't drift from node-commerce's matching skip-empty rule (cross-language profiles canonicalize to identical bytes when both omit). README example updated to show ucp_a2a_extension() on the build call so vendors copying the snippet ship spec-compliant A2A cards out of the box. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e07eaaa commit 57d212d

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,14 @@ from agentscore_commerce.identity import (
187187
A2AAgentCardCapabilities,
188188
build_a2a_agent_card,
189189
build_ucp_profile,
190+
ucp_a2a_extension,
190191
)
191192

192193
# Google A2A v1.0 Signed Agent Card. Publish at /.well-known/agent-card.json.
193-
card = build_a2a_agent_card(name="My Service", url=base_url, capabilities=A2AAgentCardCapabilities(...), data=assess_result)
194+
# Per UCP §A2A binding the card MUST declare the canonical UCP extension URI;
195+
# pass `ucp_a2a_extension()` with empty capabilities until you bind formal UCP
196+
# capabilities (dev.ucp.shopping.checkout, etc.).
197+
card = build_a2a_agent_card(name="My Service", url=base_url, capabilities=A2AAgentCardCapabilities(...), extensions=[ucp_a2a_extension()], data=assess_result)
194198

195199
# Google Universal Commerce Protocol. Publish at /.well-known/ucp.
196200
# Output shape: {"ucp": {"version", "services", "capabilities",

tests/test_a2a.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,10 @@ def test_build_a2a_agent_card_emits_extensions_when_passed():
144144
def test_build_a2a_agent_card_omits_extensions_when_not_passed():
145145
card = build_a2a_agent_card(name="X")
146146
assert "extensions" not in card.to_dict()
147+
148+
149+
def test_build_a2a_agent_card_omits_extensions_when_passed_empty_list():
150+
# Parity with node: both SDKs skip the extensions field when empty so
151+
# cross-language profiles canonicalize to identical bytes when both omit.
152+
card = build_a2a_agent_card(name="X", extensions=[])
153+
assert "extensions" not in card.to_dict()

0 commit comments

Comments
 (0)