Skip to content

feat(a2a): authenticate A2A calls to the gateway and surface its refusals - #1543

Merged
edenreich merged 1 commit into
mainfrom
feat/a2a-gateway-auth
Oct 6, 2026
Merged

edenreich merged 1 commit into
mainfrom
feat/a2a-gateway-auth

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

Summary

With AUTH_ENABLED the gateway requires a bearer token on POST /a2a, the same token it requires for inference. infer held that token as gateway.api_key but sent it on inference only, so every A2A call to an authenticated gateway was rejected.

  • An agent URL on the origin of gateway.url now gets gateway.api_key as its bearer token on the agent card fetch, SendMessage, background GetTask polling and CancelTask.
  • The token is sent to the gateway's origin only. Another agent or a redirect target never receives it.
  • An auth block for the gateway in agents.yaml ([FEATURE] Authenticate to A2A agents with per-agent credentials #1514) takes precedence over gateway.api_key.
  • A 401 from the gateway reaches the model as Authentication failed for A2A agent "<host>": the agent rejected the request with status 401, check gateway.api_key. The response body stays out of it.
  • A guardrail refusal, a 403 with a JSON-RPC error, reaches the model as The request was refused by a guardrail policy: <policy message>. A 403 without a JSON-RPC error stays an authentication failure.
  • The credential is handed to the A2A client once by the composition root, before mock mode rewrites gateway.url. So INFER_GATEWAY_MOCK still authenticates A2A calls to the configured gateway.
  • docs/a2a-connections.md documents authenticating to the gateway.

Known limit: with gateway.run and a port the CLI reassigned, the match uses the configured gateway.url.

Closes #1515

Test plan

Docs follow-up

Draft of a [DOCS] issue for inference-gateway/docs, not filed yet:

  • Title: [DOCS] CLI: authenticate A2A calls to the gateway
  • Pages: the CLI A2A page and the gateway A2A page
  • Content: gateway.api_key is sent as the bearer token on A2A requests to gateway.url, agents.yaml credentials take precedence, and a guardrail refusal reaches the model with the policy message

…sals

An agent URL on the origin of gateway.url now gets gateway.api_key as its
bearer token on every A2A request. Credentials for the gateway in agents.yaml
take precedence, and the token never leaves the gateway's origin.

A guardrail refusal, a 403 with a JSON-RPC error, reaches the model with the
policy's message instead of as an authentication failure.

Closes #1515
@edenreich
edenreich requested a review from a team as a code owner October 5, 2026 19:35
@edenreich
edenreich merged commit d92030d into main Oct 6, 2026
16 of 27 checks passed
@edenreich
edenreich deleted the feat/a2a-gateway-auth branch October 6, 2026 08:54
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.226.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[FEATURE] Authenticate A2A calls to the gateway and surface its refusals

1 participant