Skip to main content

Overview

The A2AVerificationInterceptor is the central component of QWED A2A. Every inter-agent message passes through it before reaching the recipient.
The trace_id parameter is required and must be provided by the caller. This ensures all verdicts and JWT attestations are deterministic and auditable. The HTTP gateway (POST /a2a/intercept) generates this automatically.

Verification pipeline

1

Schema Validation

The incoming AgentMessage is validated by Pydantic:
  • sender_agent_id and receiver_agent_id must be 1–256 chars, no control characters
  • payload is required (dict)
  • payload_type defaults to GENERAL if not specified
  • Timestamps are timezone-aware UTC
2

Trust Boundary

The trust boundary evaluates the sender→receiver pair:
  • Global blocklist check
  • Pair-level block check
  • Allowlist check (in strict mode)
  • Token-bucket rate limiting
3

Trusted Agent Bypass

If the sender is in config.trusted_agents, the message is forwarded immediately with a bypass engine verdict.
4

Engine Routing

Based on payload_type, the message is routed to the appropriate verification engine.
5

Verdict & Attestation

The engine result is wrapped in a VerificationVerdict with an ES256 JWT attestation proving the verification took place.

Verification engines

Finance guard

Verifies financial claims using deterministic Decimal arithmetic. Recomputes totals from line items and compares against the claimed_total.
All financial comparisons use decimal.Decimal with ROUND_HALF_UP quantization to 0.01. Floating-point arithmetic is never used in the verification path.

Logic guard

Detects logical contradictions — claims where the same proposition is both asserted and negated.
Contradictions are sorted before output, ensuring deterministic results regardless of Python’s hash randomization (PYTHONHASHSEED).

Code guard

Scans code payloads for dangerous patterns using case-insensitive compiled regex:

Passthrough

Messages with payload_type of GENERAL or DATA_QUERY are forwarded without verification.

Configuration reference

The InterceptorConfig controls which engines are active:

Error handling

When block_on_error=True (default), any exception in a verification engine results in a BLOCKED verdict. When False, the message is FORWARDED despite the error — useful for observability-only deployments.
Engine exception → BLOCKED verdict with error reason. Safe default for production.
Engine exception → FORWARDED verdict. The error is logged but doesn’t block communication. Use for shadow deployments.