Skip to content

feat(a2a): allow plaintext HTTP for agent cards in service meshes - #7169

Open
ArulJerald wants to merge 1 commit into
google:mainfrom
ArulJerald:feat/a2a-allow-insecure-http-7139
Open

ArulJerald wants to merge 1 commit into
google:mainfrom
ArulJerald:feat/a2a-allow-insecure-http-7139

Conversation

@ArulJerald

Copy link
Copy Markdown

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

Problem:
RemoteA2aAgent previously enforced https:// (or loopback addresses like localhost / 127.0.0.1) for agent card URLs and RPC target URLs. In service mesh environments (such as Kubernetes with Istio, Linkerd, or Consul) where transport-layer security and identity are offloaded to mTLS sidecars, inter-service calls use internal plaintext HTTP endpoints (e.g., http://my-agent-service.default.svc.cluster.local:8080/agent.json). RemoteA2aAgent rejected these with AgentCardResolutionError, blocking A2A communication in mesh deployments.

Solution:

  • Added an opt-in allow_insecure_http: bool = False configuration option to RemoteA2aAgent.__init__ and A2aRemoteAgentConfig.
  • Added support for the ADK_A2A_ALLOW_INSECURE_HTTP=1 environment variable as a fallback.
  • Updated _resolve_agent_card() and _validate_card_rpc_targets() to permit non-loopback http:// URLs when allow_insecure_http is active.
  • Maintained secure-by-default behavior (default is False, refusing non-loopback cleartext HTTP).
  • Preserved strict same-origin checks so RPC targets must still originate from the host and port the card was fetched from.

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

Summary of pytest results:

  • tests/unittests/a2a/agent/test_remote_a2a_agent.py: 266 passed (13 new tests added covering parameter, config, environment variable fallback, card resolution, and RPC validation)
  • tests/unittests/a2a/: 732 passed, 49 skipped, 0 failures

Manual End-to-End (E2E) Tests:

Tested with a local HTTP service simulating a service mesh backend:

  1. Configure an agent with allow_insecure_http=True targeting http://internal-mesh-service:8080/agent.json.
  2. Verified that card resolution and RPC validation succeed when allow_insecure_http=True or ADK_A2A_ALLOW_INSECURE_HTTP=1 is set.
  3. Verified that the agent rejects non-loopback HTTP with AgentCardResolutionError by default.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

@google-cla

google-cla Bot commented Sep 18, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@ArulJerald

Copy link
Copy Markdown
Author

Thank you @surajksharma07 for the review!

  1. Comment updated: Fixed the cut-off comment in src/google/adk/a2a/agent/_remote_a2a_agent.py around line 985.
  2. Commit cleaned: The commit has been reset and now includes strictly the 5 relevant files for issue RemoteA2aAgent enforces HTTPS for agent cards, blocking plaintext A2A inside a service mesh (mTLS) #7139:
    • src/google/adk/a2a/agent/config.py
    • src/google/adk/a2a/agent/_remote_a2a_agent.py
    • src/google/adk/a2a/agent/__init__.py
    • src/google/adk/agents/remote_a2a_agent.py
    • tests/unittests/a2a/agent/test_remote_a2a_agent.py
  3. Verification: Ran pyink, isort, ruff, scripts/compliance_checks.py, and all 266 unit tests in test_remote_a2a_agent.py pass.
  4. The branch has been force-pushed.

@ArulJerald
ArulJerald force-pushed the feat/a2a-allow-insecure-http-7139 branch from 8ba63ae to f6af6cd Compare September 18, 2026 09:46
RemoteA2aAgent enforced HTTPS (or loopback hosts) when resolving agent
cards and validating RPC targets. In a service mesh or Kubernetes cluster
where mTLS is terminated transparently by sidecars (such as Istio or
Linkerd), services communicate over plaintext HTTP using internal DNS names,
causing RemoteA2aAgent to raise AgentCardResolutionError.

Adds an opt-in allow_insecure_http parameter to RemoteA2aAgent.__init__
and A2aRemoteAgentConfig, supported by an ADK_A2A_ALLOW_INSECURE_HTTP=1
environment variable fallback. When enabled, _resolve_agent_card and
_validate_card_rpc_targets permit non-loopback http:// URLs while
maintaining secure-by-default behavior and enforcing same-origin
validation across card sources and RPC targets.

Fixes google#7139
@ArulJerald
ArulJerald force-pushed the feat/a2a-allow-insecure-http-7139 branch from f6af6cd to 0e60aa0 Compare September 18, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RemoteA2aAgent enforces HTTPS for agent cards, blocking plaintext A2A inside a service mesh (mTLS)

2 participants