FeaturesFlex Gateway PoliciesA²D Mock Integration

A²D Mock Integration

A protocol-aware Mulesoft Flex / Omni Gateway custom policy that operationalizes A²D’s Design → Test → Runtime loop at the edge.

The mock is already the source of truth for behavior. This policy makes it the source of truth at the edge: zero client-side config churn to flip an environment, automatic contract validation everywhere, and shadow-diff visibility for the moments when reality diverges from the spec.

Four orthogonal modes

The policy supports four modes that combine in any subset. The default is ["validate"].

redirect

Rewrites the upstream URL for this asset to the A²D mock:

  • REST → {baseUrl}/api/platform/{assetId}/api/...
  • MCP → {baseUrl}/api/platform/{assetId}/mcp
  • A2A → {baseUrl}/api/platform/{assetId}/a2a

Authenticates with the credentials in mockAuthSecretRef. Refused in env=prod unless prodAllowed=true plus a Govern approval token.

validate

Protocol-aware request/response validation against the A²D-canonical spec.

  • REST — path + method match against the OpenAPI document, status range check.
  • MCP — JSON-RPC parse, method whitelist, tools/call.name matched against the spec’s tool list.
  • A2A — A2A envelope parse, skill matched against the agent card’s declared skills.

Validation failures produce evidence events. By default validation is observational; pair with the Govern policy for a hard gate.

shadow

Asynchronously mirrors a sampled fraction of requests to the A²D mock and diffs the responses. The primary request is never affected; the diff result is an evidence event only.

Sampling is deterministic per request (FNV-1a hash of method + path) so a repeated request lands on the same yes/no decision — useful for diff stability across mock runs.

fault

Probabilistically rewrites the request to invoke a specific A²D scenario (fault.scenarioId) so the mock returns errors, delays, or malformed responses. Gated to non-prod by default; the prod-allowed path requires Govern approval.

Configuration

PathTypeDefaultDescription
a2d.baseUrlstringhttps://a2d-ai.comA²D platform base URL.
a2d.assetIdstringrequiredA²D asset id.
a2d.assetTypeenumrequiredrest / mcp / a2a.
a2d.apiKeySecretRefstringrequiredPer-instance A²D API key.
a2d.refreshIntervalSecint 30–86400600Spec refresh cadence.
envenumpre_prodmocked / pre_prod / prod.
modesenum[]["validate"]Any subset of redirect / validate / shadow / fault.
mockAuthSecretRefstringCredentials for the A²D mock.
scenarioSelectorstringheader:X-A2D-Scenarioheader:<name> / query:<name> / rule:<expr> / none.
validate.inputbooltrueValidate request.
validate.outputbooltrueValidate response.
validate.headersboolfalseValidate response headers.
shadow.sampleRatefloat 0–10.05Fraction of requests mirrored.
fault.scenarioIdstringA²D scenario id.
fault.ratefloat 0–10.0Injection rate.
prodAllowedboolfalseAllow redirect/fault in env=prod.
prodApprovalstringGovern approval token; required when prodAllowed=true.
failOpen.onMockUnavailableboolfalseFall back to real upstream when mock is down (non-prod only).
failOpen.onSpecUnavailablebooltrueAllow traffic when spec cannot be loaded; emit spec_unavailable.
EnvironmentModes
mockedredirect + validate
pre_prodredirect + validate (+ optional fault)
prodvalidate always; shadow opt-in sampled; never redirect/fault without Govern approval.

Evidence

Every decision produces a JSON line through the PDK logger and (when A²D reporting is wired) POSTed to {baseUrl}/api/policy/evidence as a run-style record compatible with a2tf_run_results. A²D Test Lab surfaces these as “Runtime Runs” alongside scheduled test runs.

{
  "class": "spec_validation_failure",
  "severity": "warning",
  "decision": "allowed",
  "asset_id": "demo-asset",
  "asset_type": "mcp",
  "env": "pre_prod",
  "modes": ["redirect", "validate"],
  "scenario_id": "scn-42",
  "diff_summary": "tool 'delete_account' not declared in spec",
  "note": null
}

classspec_validation_failure | shadow_divergence | fault_injected | mock_unavailable | spec_unavailable | scenario_applied | prod_guard_blocked.

Why this is the most differentiated policy

A²D is uniquely positioned to ship this because A²D owns:

  • the spec (canonical contract for REST/MCP/A2A),
  • the mock (executor that already speaks those protocols),
  • the scenario library (chaos-test fixtures, mock-data presets, fault recipes).

No other gateway vendor can credibly offer “validate + redirect + shadow + fault, all driven by one asset spec.” The drift-detection policies are a smaller cut of the same surface — Mock Integration is the full Design → Test → Runtime contract enforced at the edge.

Reference deployment

FieldValue
Gatewayagent-network-ingress-gw (id 35755bec-3177-4d32-a8c9-c9705f5b1c0b, gw 1.13.2)
Public URLhttps://agent-network-ingress-gw-zovwbn.jeg62f.usa-e2.cloudhub.io/mcp-mock-integration-demo
API instance20999093
A²D mock asset081bca6b-1fce-49d8-8c4f-f3ea0f5358ef (assetType=mcp)
Configured modesvalidate, redirect
Policy versionomni-policy-a-2-d-mock-integration-dev/0.1.0-20260629203520

The upstream A²D mock declares an order-management MCP server with three tools (get_order, list_orders, update_order_status) — the methods covered by the canonical spec the policy validates against.

Try it

tools/list — validation passes:

curl -sS -X POST \
  https://agent-network-ingress-gw-zovwbn.jeg62f.usa-e2.cloudhub.io/mcp-mock-integration-demo \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","method":"tools/list","id":1}'

tools/call for a declared tool:

curl -sS -X POST \
  https://agent-network-ingress-gw-zovwbn.jeg62f.usa-e2.cloudhub.io/mcp-mock-integration-demo \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc":"2.0","id":2,
    "method":"tools/call",
    "params":{"name":"get_order","arguments":{"orderId":"ord_001"}}
  }'

tools/call for an undeclared tool — emits a spec_validation_failure evidence event (observational; request still flows because the policy is in validate mode without an enforcing Govern follow-up):

curl -sS -X POST \
  https://agent-network-ingress-gw-zovwbn.jeg62f.usa-e2.cloudhub.io/mcp-mock-integration-demo \
  -H 'Content-Type: application/json' \
  -d '{
    "jsonrpc":"2.0","id":3,
    "method":"tools/call",
    "params":{"name":"delete_account","arguments":{}}
  }'

The evidence row appears in A²D Test Lab under “Runtime Runs” alongside scheduled-test results.

Pair with

Next Steps

Mock Integration is the full Design → Test → Runtime loop, enforced at the edge.