Tool Gateway agentgateway Operator Reference
This reference covers agentgateway-specific implementation details of the Tool Gateway agentgateway Operator. For the ToolGateway, ToolGatewayClass, ToolRoute, and ToolServer CRD field tables, see ToolGateway and ToolGatewayClass Reference and ToolRoute Reference.
ToolGatewayClass controller name
The operator registers one ToolGatewayClass with the following controller name:
| Item | Value |
|---|---|
|
|
|
|
A ToolGateway resource with spec.toolGatewayClassName: agentgateway is claimed and reconciled by this operator.
Marking the ToolGatewayClass as default
The shipped agentgateway ToolGatewayClass is not marked as the cluster default. To claim ToolGateway resources that omit spec.toolGatewayClassName, add the toolgatewayclass.kubernetes.io/is-default-class: "true" annotation via a Kustomize overlay:
# kustomization.yaml
resources:
- https://github.com/agentic-layer/tool-gateway-agentgateway/releases/latest/download/install.yaml
patches:
- patch: |-
apiVersion: runtime.agentic-layer.ai/v1alpha1
kind: ToolGatewayClass
metadata:
name: agentgateway
annotations:
toolgatewayclass.kubernetes.io/is-default-class: "true"
Use this only when this operator is the single Tool Gateway implementation in the cluster.
Generated Gateway API resources
For each reconciled ToolGateway, the operator creates and owns the following Gateway API resources in the same namespace:
| Resource | Description |
|---|---|
|
A Gateway API |
|
Holds agentgateway-specific configuration generated from |
For each reconciled ToolRoute, the operator creates:
| Resource | Description |
|---|---|
|
Configures the MCP backend connection to the route’s upstream (a cluster |
|
Routes traffic from the referenced |
|
Created only when |
ToolGateway status URL
When the operator successfully reconciles a ToolGateway, it sets:
ToolGateway.status.url = http://<name>.<namespace>.svc.cluster.local
This is the cluster-local base URL for the agentgateway instance. Individual tool routes are reachable at <status.url>/<route-namespace>/<route-name>/mcp. The ToolRoute.status.url field is populated by the operator with this per-route URL once the route is accepted.
OTEL environment variables
The operator automatically translates standard OpenTelemetry environment variables from ToolGateway.spec.env to agentgateway’s rawConfig.config.tracing section. These variables are not passed as environment variables to the agentgateway container.
| Variable | Effect |
|---|---|
|
OTLP exporter endpoint URL. |
|
Protocol to use: |
|
Headers to send with telemetry data (e.g. |
|
Per-signal override for the traces endpoint. |
|
Per-signal override for the traces protocol. |
|
Per-signal override for the traces headers. |
| Currently only tracing is supported. Metrics and logs configuration is not yet implemented. |
For the full agentgateway configuration schema, see the agentgateway config schema.
Tool filtering: glob to CEL translation
When ToolRoute.spec.toolFilter is set, the operator translates the glob allow/deny patterns into CEL rules written to AgentgatewayPolicy.spec.backend.mcp.authorization.policy.matchExpressions.
Semantics
| Condition | Behaviour |
|---|---|
|
All tools pass through unfiltered; no |
Only |
Only tools matching an allow pattern are exposed. |
Only |
All tools are exposed except those matching a deny pattern. |
Both |
Deny wins on conflict — a tool matching any deny pattern is always blocked, even if it also matches an allow pattern. The generated CEL expression is |
Pattern syntax
Glob patterns use standard syntax: * matches any run of characters; ? matches exactly one character. Plain names (no wildcard characters) compile to a CEL equality check; patterns with wildcards compile to a mcp.tool.name.matches(regex) call against an anchored regular expression.
| Pattern | Generated CEL predicate |
|---|---|
|
|
|
|
|
|
|
|
Guardrails
The operator can attach guardrails to a ToolGateway to filter sensitive content (PII, harmful content) from tool traffic. Guardrails are expressed with the gateway-agnostic Guard and GuardrailProvider CRDs documented in Guardrails Reference; this section covers the agentgateway-specific behaviour.
For each Guard referenced from ToolGateway.spec.guardrails, the operator automatically creates a dedicated guardrail-adapter workload (Deployment + ConfigMap + Service) pre-configured from the Guard and its GuardrailProvider. No manual adapter deployment is required. The gateway’s AgentgatewayPolicy extProc.backendRef is wired at the adapter’s service automatically.
Prerequisites
-
The operator must be started with
--guardrail-adapter-image=<image>:<tag>. See Enable Guardrails in the install guide. -
A
GuardrailProviderbacking service (e.g. Presidio) must be reachable from the cluster.
Example: PII detection with Presidio
apiVersion: runtime.agentic-layer.ai/v1alpha1
kind: GuardrailProvider
metadata:
name: presidio-analyzer
namespace: default
spec:
type: presidio-api
presidio:
baseUrl: http://presidio-analyzer.default.svc:8080
---
apiVersion: runtime.agentic-layer.ai/v1alpha1
kind: Guard
metadata:
name: pii-guard
namespace: default
spec:
mode:
- pre_call
- post_call
description: "Detects and masks PII in tool traffic"
providerRef:
name: presidio-analyzer
presidio:
language: "en"
scoreThresholds:
ALL: "0.5"
PERSON: "0.8"
EMAIL_ADDRESS: "0.7"
entityActions:
PERSON: "MASK"
EMAIL_ADDRESS: "MASK"
CREDIT_CARD: "BLOCK"
PHONE_NUMBER: "MASK"
---
apiVersion: runtime.agentic-layer.ai/v1alpha1
kind: ToolGateway
metadata:
name: my-tool-gateway
namespace: default
spec:
toolGatewayClassName: agentgateway
guardrails:
- name: pii-guard
The operator creates pii-guard-adapter (Deployment + ConfigMap + Service) in the Guard’s namespace and wires the ToolGateway’s `AgentgatewayPolicy extProc.backendRef at it.
A complete sample (Presidio + Guard + ToolGateway + ToolServer + ToolRoute) is available at https://github.com/agentic-layer/tool-gateway-agentgateway/tree/main/config/samples/guardrails. Apply it with kubectl apply -k config/samples/guardrails.
Limitations
-
Single Guard per ToolGateway: agentgateway currently supports only one
ext_procslot per target. If you reference multiple guards, the operator sets aGuardrailsUnsupportedstatus condition on theToolGateway. -
Provider type: Only
presidio-apiproviders are supported today. Guards backed byopenai-moderation-apiorbedrock-apiproviders reportReady=Falsewith reasonUnsupportedProviderType.
Status conditions
| Resource | Condition | Reason | Meaning |
|---|---|---|---|
|
|
|
Operator was started without |
|
|
|
|
|
|
|
Only |
|
|
|
Validation failed (missing endpoint, empty modes, …). |
|
|
|
A referenced Guard does not exist. |
|
|
|
A referenced Guard exists but its |
|
|
|
More than one Guard was referenced. |