← Back to Pull requests

feat: support application/a2a-agent-card+json media type for agent cards #626

Merged
polchernikova-w merged 5 files (113 lines) on Dec 01, 2026 10:39 UTC
View on GitHub
polchernikova-w polchernikova-w commented on Nov 23, 2026 13:05 UTC
Author

This PR addresses the following change in the A2A v1.1 spec (§8.1):

The media type application/a2a-agent-card+json identifies a JSON representation of an AgentCard, independently of the agent's supported protocol bindings.

Before this PR, the agent card handlers always responded with application/json.

Changes


  • Agent card handlers respond with application/a2a-agent-card+json when Accept lists it, and with application/json otherwise. Responses now include Vary: Accept.

  • agentcard.Resolver sends Accept: application/a2a-agent-card+json, application/json by default.
  • Diff: 113 lines (+108 / -5) across 5 files Reviewer: yarolegovich Review duration: 11373m
    All Vouch review confidence checks passed
    Residual risk 0.05 = Change Risk (0.37) × (1 − Review Confidence (0.86)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 113 lines diff across 5 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.80 · 3 substantive comment(s)
    0.80
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    85%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.283
    Real PR Conversation Timeline
    5 items
    yarolegovich yarolegovich commented on code on Nov 27, 2026 18:14 UTC
    Code Review
    a2aclient/agentcard/resolver.go:1
    @@ -152,8 +153,9 @@ func fetchCard(ctx context.Context, client *http.Client, reqURL string, headers
     	if err != nil {
     		return nil, fmt.Errorf("failed to construct a request: %w", err)
     	}
    +	req.Header.Set("Accept", rest.ContentA2AAgentCardJSON+", "+rest.ContentJSON)
     	for h, val := range headers {
    -		req.Header.Add(h, val)
    +		req.Header.Set(h, val)

    this breaks callers which relied on multiple options concatenation into a single value

    polchernikova-w polchernikova-w commented on code on Nov 30, 2026 15:31 UTC
    Code Review
    a2aclient/agentcard/resolver.go:1
    @@ -152,8 +153,9 @@ func fetchCard(ctx context.Context, client *http.Client, reqURL string, headers
     	if err != nil {
     		return nil, fmt.Errorf("failed to construct a request: %w", err)
     	}
    +	req.Header.Set("Accept", rest.ContentA2AAgentCardJSON+", "+rest.ContentJSON)
     	for h, val := range headers {
    -		req.Header.Add(h, val)
    +		req.Header.Set(h, val)

    headers is a map, there won't be any duplicated keys. Set and Add here is the same thing.

    yarolegovich yarolegovich commented on code on Dec 01, 2026 09:29 UTC
    Code Review
    a2aclient/agentcard/resolver.go:1
    @@ -152,8 +153,9 @@ func fetchCard(ctx context.Context, client *http.Client, reqURL string, headers
     	if err != nil {
     		return nil, fmt.Errorf("failed to construct a request: %w", err)
     	}
    +	req.Header.Set("Accept", rest.ContentA2AAgentCardJSON+", "+rest.ContentJSON)
     	for h, val := range headers {
    -		req.Header.Add(h, val)
    +		req.Header.Set(h, val)

    indeed

    yarolegovich yarolegovich approved these changes on Dec 01, 2026 09:29 UTC
    Approved Reviewer

    Approved these changes.

    Reviewers
    Assignees
    polchernikova-w polchernikova-w
    Labels
    risk: low confidence: 85.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 37.2% (MEDIUM) · Higher = larger blast radius
    37.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 85.9% · Lower = rushed or shallow review
    85.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 5.3% · Safe to merge
    5.3%