Skip to content

Add A2A support to AI Gateway - #3360

Open
RakhithaRR wants to merge 36 commits into
wso2:mainfrom
RakhithaRR:a2a
Open

Add A2A support to AI Gateway#3360
RakhithaRR wants to merge 36 commits into
wso2:mainfrom
RakhithaRR:a2a

Conversation

@RakhithaRR

Copy link
Copy Markdown
Contributor

Purpose

The platform had no first-class way to front an A2A (Agent2Agent) agent. The only option was to hand-roll a REST API proxy per agent, which cannot express A2A's actual shape: two protocol bindings address the same eleven operations, and one of them (JSON-RPC) is a single endpoint that names its operation in the request body. Because a REST API's route and its policy chain are the same thing, there was no way to attach per-operation policy, authentication, rate limiting or analytics to an agent, and no way to serve or protect an Agent Card.

This PR introduces Agent as a first-class artifact kind so an A2A agent is managed, secured, observed and deployed the same way REST APIs, MCP servers and LLM providers already are.

Resolves #2844

Goals

  • A first-class Agent artifact kind implementing A2A protocol version 1.0.
  • Both protocol bindings — JSONRPC and HTTP+JSON — over the same eleven operations, addressable independently.
  • Agent-wide and per-operation policy attachment, with correct chain ordering.
  • Agent Card handling: public and protected cards, each in managed (served by the gateway) or passthrough (proxied from the upstream) mode.
  • Per-agent API keys, plus the existing authentication policies (JWT/OAuth2) usable on agent operations.
  • Analytics and tracing that understand A2A, with operation and transport as first-class dimensions.
  • Kubernetes-native declaration via an Agent CRD reconciled by the gateway operator.
  • Multi-replica correctness through the existing event-sync mechanism.

Approach

Management REST APIPOST/GET /agents, GET/PUT/DELETE /agents/{id}, plus /agents/{id}/api-keys (create, list, delete, regenerate). Models are generated from management-openapi.yaml via make generate-server-code; REST API docs are regenerated alongside.

Storage — one new agents table per dialect (SQLite, PostgreSQL, SQL Server). Purely additive: guarded CREATE TABLE IF NOT EXISTS / IF OBJECT_ID(...) IS NULL, no ALTER against any shipped table, so it applies to fresh and already-provisioned databases alike.

TransformationAgentTransformer builds the RuntimeDeployConfig directly rather than desugaring an Agent into a synthetic RestAPI the way MCP does. A REST-shaped intermediate cannot express "eleven chains, one route", so building one and patching it would mean maintaining the patch rather than reusing the model. Everything that decides a value another component also computes — upstream cluster construction, resilience parsing, policy version resolution, system-policy injection, route naming, card path arithmetic — is reused rather than reimplemented.

Policy engine — a new A2A chain resolver selects the operation chain from the path (HTTP+JSON) or from the request body (JSON-RPC, plus the two message-sending HTTP+JSON routes). Body-resolved routes carry an explicit 1 MiB acceptance ceiling, because on those routes the body is parsed before any policy — authentication included — has run, so that ceiling is what bounds the unauthenticated parsing work an anonymous caller can request. The resolver interface gained protocol-specific attributes, forwarded to both the Go and Python policy engines.

Agent Card — a public card is either served locally from configured content (with ETag and conditional-GET support) or proxied byte-identically from the upstream. A protected (extended) card is served locally in managed mode or proxied in passthrough mode, and is always guarded: the guard instance is unconditional, so "no auth policy attached" cannot silently mean "public extended card". Omitting agentCard.protected reads as passthrough, not as unprotected — see Reviewer notes.

Envoy/xDS — per-operation routes for both bindings, OPTIONS preflight routes generated beside the real ones so CORS preflights have something to match before any policy runs, and per-operation resiliency configuration.

Operator — an Agent CRD in both v1 and v1alpha1 with a conversion path, a reconciler, RBAC, and a sample CR. Helm chart updated to install it.

Analytics and tracing — A2A invocations report operation and transport dimensions; the same operation over both bindings shares an operation dimension and differs by transport. Card fetches and CORS preflights are reported as themselves rather than shaped like invocations, and a JSON-RPC error inside a 200 is reported as a failed invocation. Policy denials are attributed to the gateway rather than to the agent.

Documentation

Link(s) to product documentation that addresses the changes of this PR. If no doc impact, enter “N/A” plus brief explanation of why there’s no doc impact

Automation tests

66 new BDD scenarios across six feature files:

Feature Scenarios Covers
agent_deploy 13 CRUD, deploy/undeploy, transport declaration, all eleven operations over both bindings via the official A2A SDK
agent_card 23 managed/passthrough public and protected cards, ETag and conditional GET, custom card path, guard behaviour, card validation rejections
agent_policies 8 agent-wide vs per-operation attachment and ordering, CORS preflight
agent_streaming 5 SendStreamingMessage and SubscribeToTask over both bindings, terminal-state close, buffered error responses
agent_analytics 8 operation/transport dimensions, discovery vs invocation, JSON-RPC-error-in-200, policy-denial attribution
agent-api-keys 9 key lifecycle, runtime credential replacement, undeploy/redeploy, 404s

Related PRs

#3198
#3317

…te forwarding in go and python policy engines
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Too many files!

This PR contains 166 files, which is 66 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Team

Run ID: a34b6455-7893-4323-905e-9267fefa30e1

📥 Commits

Reviewing files that changed from the base of the PR and between 22c69f6 and fb5cd08.

⛔ Files ignored due to path filters (7)
  • gateway/gateway-runtime/policy-engine/go.sum is excluded by !**/*.sum
  • gateway/gateway-runtime/policy-engine/internal/pythonbridge/proto/python_executor.pb.go is excluded by !**/*.pb.go
  • gateway/it/go.sum is excluded by !**/*.sum
  • gateway/system-policies/a2a/go.sum is excluded by !**/*.sum
  • gateway/system-policies/analytics/go.sum is excluded by !**/*.sum
  • go.work is excluded by !**/*.work
  • go.work.sum is excluded by !**/*.sum
📒 Files selected for processing (166)
  • .github/workflows/operator-integration-test.yml
  • common/agentproto/agentproto.go
  • common/agentproto/agentproto_test.go
  • common/agentproto/resolver.go
  • common/agentproto/resolver_test.go
  • common/agentproto/version_1_0.go
  • common/eventhub/types.go
  • docs/rest-apis/gateway/README.md
  • docs/rest-apis/gateway/agent-management.md
  • docs/rest-apis/gateway/schemas.md
  • event-gateway/gateway-controller/cmd/controller/main.go
  • gateway/examples/a2a-trip-planner-agent.yaml
  • gateway/gateway-controller/api/management-openapi.yaml
  • gateway/gateway-controller/cmd/controller/main.go
  • gateway/gateway-controller/cmd/controller/main_test.go
  • gateway/gateway-controller/cmd/controller/runtime_bootstrap.go
  • gateway/gateway-controller/pkg/adminserver/server.go
  • gateway/gateway-controller/pkg/adminserver/server_test.go
  • gateway/gateway-controller/pkg/api/handlers/agent_api_key_test.go
  • gateway/gateway-controller/pkg/api/handlers/agent_handler.go
  • gateway/gateway-controller/pkg/api/handlers/agent_handler_test.go
  • gateway/gateway-controller/pkg/api/handlers/credential_redaction.go
  • gateway/gateway-controller/pkg/api/handlers/handlers.go
  • gateway/gateway-controller/pkg/api/handlers/handlers_test.go
  • gateway/gateway-controller/pkg/api/handlers/resource_response.go
  • gateway/gateway-controller/pkg/api/management/generated.go
  • gateway/gateway-controller/pkg/config/agent_card_validator_test.go
  • gateway/gateway-controller/pkg/config/agent_parser_test.go
  • gateway/gateway-controller/pkg/config/agent_validator.go
  • gateway/gateway-controller/pkg/config/agent_validator_test.go
  • gateway/gateway-controller/pkg/config/policy_validator.go
  • gateway/gateway-controller/pkg/constants/constants.go
  • gateway/gateway-controller/pkg/eventlistener/agent_processor.go
  • gateway/gateway-controller/pkg/eventlistener/agent_processor_test.go
  • gateway/gateway-controller/pkg/eventlistener/apikey_processor_test.go
  • gateway/gateway-controller/pkg/eventlistener/listener.go
  • gateway/gateway-controller/pkg/immutable/agent_loader_test.go
  • gateway/gateway-controller/pkg/immutable/loader.go
  • gateway/gateway-controller/pkg/metrics/agents_test.go
  • gateway/gateway-controller/pkg/metrics/metrics.go
  • gateway/gateway-controller/pkg/models/data_version.go
  • gateway/gateway-controller/pkg/models/data_version_test.go
  • gateway/gateway-controller/pkg/models/runtime_deploy_config.go
  • gateway/gateway-controller/pkg/models/stored_config.go
  • gateway/gateway-controller/pkg/policyxds/server.go
  • gateway/gateway-controller/pkg/service/agent/errors.go
  • gateway/gateway-controller/pkg/service/agent/service.go
  • gateway/gateway-controller/pkg/service/agent/service_test.go
  • gateway/gateway-controller/pkg/storage/agent_store_test.go
  • gateway/gateway-controller/pkg/storage/gateway-controller-db.postgres.sql
  • gateway/gateway-controller/pkg/storage/gateway-controller-db.sql
  • gateway/gateway-controller/pkg/storage/gateway-controller-db.sqlserver.sql
  • gateway/gateway-controller/pkg/storage/schema_consistency_test.go
  • gateway/gateway-controller/pkg/storage/sql_store.go
  • gateway/gateway-controller/pkg/storage/sqlite.go
  • gateway/gateway-controller/pkg/storage/sqlite_test.go
  • gateway/gateway-controller/pkg/transform/a2a_policy_contract_test.go
  • gateway/gateway-controller/pkg/transform/agent.go
  • gateway/gateway-controller/pkg/transform/agent_routing_test.go
  • gateway/gateway-controller/pkg/transform/agent_test.go
  • gateway/gateway-controller/pkg/transform/registry.go
  • gateway/gateway-controller/pkg/transform/restapi.go
  • gateway/gateway-controller/pkg/utils/cp_push.go
  • gateway/gateway-controller/pkg/utils/llm_transformer.go
  • gateway/gateway-controller/pkg/xds/translator.go
  • gateway/gateway-controller/pkg/xds/translator_test.go
  • gateway/gateway-controller/tests/integration/schema_test.go
  • gateway/gateway-runtime/api/proto/python_executor.proto
  • gateway/gateway-runtime/policy-engine/go.mod
  • gateway/gateway-runtime/policy-engine/internal/admin/dumper.go
  • gateway/gateway-runtime/policy-engine/internal/admin/dumper_test.go
  • gateway/gateway-runtime/policy-engine/internal/admin/handlers_test.go
  • gateway/gateway-runtime/policy-engine/internal/admin/types.go
  • gateway/gateway-runtime/policy-engine/internal/analytics/a2a_test.go
  • gateway/gateway-runtime/policy-engine/internal/analytics/a2a_version_test.go
  • gateway/gateway-runtime/policy-engine/internal/analytics/analytics.go
  • gateway/gateway-runtime/policy-engine/internal/analytics/analytics_test.go
  • gateway/gateway-runtime/policy-engine/internal/analytics/constants.go
  • gateway/gateway-runtime/policy-engine/internal/analytics/dto/agentAnalytics.go
  • gateway/gateway-runtime/policy-engine/internal/analytics/publishers/moesif.go
  • gateway/gateway-runtime/policy-engine/internal/analytics/publishers/moesif_test.go
  • gateway/gateway-runtime/policy-engine/internal/constants/constants.go
  • gateway/gateway-runtime/policy-engine/internal/kernel/a2a_streaming_test.go
  • gateway/gateway-runtime/policy-engine/internal/kernel/a2a_tracing_test.go
  • gateway/gateway-runtime/policy-engine/internal/kernel/a2a_version_test.go
  • gateway/gateway-runtime/policy-engine/internal/kernel/analytics.go
  • gateway/gateway-runtime/policy-engine/internal/kernel/execution_context.go
  • gateway/gateway-runtime/policy-engine/internal/kernel/extproc.go
  • gateway/gateway-runtime/policy-engine/internal/kernel/extproc_span_status_test.go
  • gateway/gateway-runtime/policy-engine/internal/kernel/resolution.go
  • gateway/gateway-runtime/policy-engine/internal/kernel/resolution_shared_context_test.go
  • gateway/gateway-runtime/policy-engine/internal/kernel/resolution_test.go
  • gateway/gateway-runtime/policy-engine/internal/kernel/translator.go
  • gateway/gateway-runtime/policy-engine/internal/pythonbridge/translator.go
  • gateway/gateway-runtime/policy-engine/internal/pythonbridge/translator_test.go
  • gateway/gateway-runtime/policy-engine/internal/resolver/a2a.go
  • gateway/gateway-runtime/policy-engine/internal/resolver/a2a_test.go
  • gateway/gateway-runtime/policy-engine/internal/resolver/a2a_version_test.go
  • gateway/gateway-runtime/policy-engine/internal/resolver/resolver.go
  • gateway/gateway-runtime/policy-engine/internal/resolver/resolver_test.go
  • gateway/gateway-runtime/policy-engine/internal/resolver/route.go
  • gateway/gateway-runtime/policy-engine/internal/xdsclient/client.go
  • gateway/gateway-runtime/policy-engine/internal/xdsclient/route_resolution_test.go
  • gateway/gateway-runtime/python-executor/executor/translator.py
  • gateway/gateway-runtime/python-executor/proto/python_executor_pb2.py
  • gateway/gateway-runtime/python-executor/requirements.txt
  • gateway/gateway-runtime/python-executor/tests/test_translator.py
  • gateway/it/docker-compose.test.postgres.yaml
  • gateway/it/docker-compose.test.sqlserver.yaml
  • gateway/it/docker-compose.test.yaml
  • gateway/it/features/agent-api-keys.feature
  • gateway/it/features/agent_analytics.feature
  • gateway/it/features/agent_card.feature
  • gateway/it/features/agent_deploy.feature
  • gateway/it/features/agent_policies.feature
  • gateway/it/features/agent_streaming.feature
  • gateway/it/features/startup-db-bootstrap.feature
  • gateway/it/go.mod
  • gateway/it/steps/http_steps.go
  • gateway/it/steps_a2a.go
  • gateway/it/steps_a2a_client.go
  • gateway/it/steps_analytics.go
  • gateway/it/steps_jwt.go
  • gateway/it/steps_policy_engine.go
  • gateway/it/suite_test.go
  • gateway/system-policies/a2a/a2a.go
  • gateway/system-policies/a2a/a2a_test.go
  • gateway/system-policies/a2a/go.mod
  • gateway/system-policies/a2a/policy-definition.yaml
  • gateway/system-policies/analytics/a2a_properties_test.go
  • gateway/system-policies/analytics/a2a_stream_timing_test.go
  • gateway/system-policies/analytics/a2a_test.go
  • gateway/system-policies/analytics/analytics.go
  • gateway/system-policies/analytics/analytics_test.go
  • gateway/system-policies/analytics/go.mod
  • gateway/system-policies/system-build-lock.yaml
  • kubernetes/gateway-operator/api/v1/agent_crd_schema_test.go
  • kubernetes/gateway-operator/api/v1/agent_types.go
  • kubernetes/gateway-operator/api/v1/conversion.go
  • kubernetes/gateway-operator/api/v1/zz_generated.deepcopy.go
  • kubernetes/gateway-operator/api/v1alpha1/agent_types.go
  • kubernetes/gateway-operator/api/v1alpha1/conversion.go
  • kubernetes/gateway-operator/api/v1alpha1/conversion_test.go
  • kubernetes/gateway-operator/api/v1alpha1/zz_generated.deepcopy.go
  • kubernetes/gateway-operator/cmd/main.go
  • kubernetes/gateway-operator/config/crd/bases/gateway.api-platform.wso2.com_agents.yaml
  • kubernetes/gateway-operator/config/crd/kustomization.yaml
  • kubernetes/gateway-operator/config/rbac/role.yaml
  • kubernetes/gateway-operator/config/samples/api_v1_agent.yaml
  • kubernetes/gateway-operator/internal/controller/agent_controller.go
  • kubernetes/gateway-operator/internal/controller/agent_controller_test.go
  • kubernetes/gateway-operator/internal/controller/agent_policy_scopes.go
  • kubernetes/gateway-operator/internal/controller/management_resources_helpers.go
  • kubernetes/gateway-operator/internal/controller/management_valuefrom_enqueue.go
  • kubernetes/gateway-operator/internal/controller/management_valuefrom_fingerprint.go
  • kubernetes/gateway-operator/internal/gatewayclient/paths.go
  • kubernetes/helm/operator-helm-chart/README.md
  • kubernetes/helm/operator-helm-chart/crds/gateway.api-platform.wso2.com_agents.yaml
  • kubernetes/helm/operator-helm-chart/templates/_helpers.tpl
  • tests/mock-servers/a2a-trip-planner/Dockerfile
  • tests/mock-servers/a2a-trip-planner/README.md
  • tests/mock-servers/a2a-trip-planner/agent.py
  • tests/mock-servers/a2a-trip-planner/config.py
  • tests/mock-servers/a2a-trip-planner/main.py
  • tests/mock-servers/a2a-trip-planner/requirements.txt
  • tests/mock-servers/a2a-trip-planner/version_query.py

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Dependency Validation Results

Dependency name: github.com/a2aproject/a2a-go/v2
Version: v2.5.0
Approved: ❌ No - Module not found in dependency registry


Next Steps

  1. Review the validation failures listed above
  2. Check if dependencies are in the approved dependency list
  3. Options to resolve:
    • Remove the unapproved dependencies from this PR
    • OR submit a PR to add these dependencies to the approved list in engineering-governance
  4. Once resolved, push changes to re-run validation

This PR is blocked until all dependencies are approved.

⚠️ Please verify the scope of the dependencies usage is necessary

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Dependency Validation Results

Dependency name: github.com/a2aproject/a2a-go/v2
Version: v2.5.0
Allowed range: >=v2.5.0
Approved: ✅ Yes

⚠️ Please verify the scope of the dependencies usage is necessary

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Dependency Validation Results

Dependency name: github.com/a2aproject/a2a-go/v2
Version: v2.5.0
Allowed range: >=v2.5.0
Approved: ✅ Yes

⚠️ Please verify the scope of the dependencies usage is necessary

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Dependency Validation Results

Dependency name: github.com/a2aproject/a2a-go/v2
Version: v2.5.0
Allowed range: >=v2.5.0
Approved: ✅ Yes

⚠️ Please verify the scope of the dependencies usage is necessary

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.

[Task]: Implement A2A Support in API Platform

1 participant