Add A2A support to AI Gateway - #3360
Conversation
…te forwarding in go and python policy engines
|
Important Review skippedToo 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Team Run ID: ⛔ Files ignored due to path filters (7)
📒 Files selected for processing (166)
You can disable this status message by setting the Comment |
Dependency Validation ResultsDependency name: github.com/a2aproject/a2a-go/v2 Next Steps
|
Dependency Validation ResultsDependency name: github.com/a2aproject/a2a-go/v2 |
Dependency Validation ResultsDependency name: github.com/a2aproject/a2a-go/v2 |
Dependency Validation ResultsDependency name: github.com/a2aproject/a2a-go/v2 |
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
Agentas 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
Agentartifact kind implementing A2A protocol version 1.0.JSONRPCandHTTP+JSON— over the same eleven operations, addressable independently.managed(served by the gateway) orpassthrough(proxied from the upstream) mode.AgentCRD reconciled by the gateway operator.Approach
Management REST API —
POST/GET /agents,GET/PUT/DELETE /agents/{id}, plus/agents/{id}/api-keys(create, list, delete, regenerate). Models are generated frommanagement-openapi.yamlviamake generate-server-code; REST API docs are regenerated alongside.Storage — one new
agentstable per dialect (SQLite, PostgreSQL, SQL Server). Purely additive: guardedCREATE TABLE IF NOT EXISTS/IF OBJECT_ID(...) IS NULL, noALTERagainst any shipped table, so it applies to fresh and already-provisioned databases alike.Transformation —
AgentTransformerbuilds theRuntimeDeployConfigdirectly rather than desugaring an Agent into a syntheticRestAPIthe 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
managedmode or proxied inpassthroughmode, and is always guarded: the guard instance is unconditional, so "no auth policy attached" cannot silently mean "public extended card". OmittingagentCard.protectedreads aspassthrough, not as unprotected — see Reviewer notes.Envoy/xDS — per-operation routes for both bindings,
OPTIONSpreflight routes generated beside the real ones so CORS preflights have something to match before any policy runs, and per-operation resiliency configuration.Operator — an
AgentCRD in bothv1andv1alpha1with 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
200is reported as a failed invocation. Policy denials are attributed to the gateway rather than to the agent.Documentation
Automation tests
66 new BDD scenarios across six feature files:
agent_deployagent_cardagent_policiesagent_streamingSendStreamingMessageandSubscribeToTaskover both bindings, terminal-state close, buffered error responsesagent_analyticsagent-api-keysRelated PRs
#3198
#3317