Detection in Enforce Mode
How Gateway and Middleware detect AI agents at the edge and server-side
Overview
When operating in Enforce mode, both the Gateway and Middleware perform multi-signal detection to classify incoming traffic. This page explains the detection mechanisms, signals used, and how results feed into policy evaluation.
Detection Flow
1. Extract request metadata
├── HTTP headers (User-Agent, Accept, etc.)
├── IP address and geolocation
├── TLS fingerprint (JA3/JA4)
└── Request patterns
2. Check for MCP-I signature headers
├── If present → Verify Ed25519 signature
│ ├── Valid → 100% confidence, classify as ai_agent
│ └── Invalid → Continue to WASM detection
└── If absent → Continue to WASM detection
3. Run detection engine
├── Gateway: WASM module at Cloudflare edge
└── Middleware: Server-side API detection
4. Combine results
├── Detection class (human, ai_agent, bot, incomplete_data)
├── Confidence score (0–100)
└── Agent metadata (name, type, verification method)
5. Apply policy
└── Allow / Block / Redirect / Challenge / LogDetection Signals
User Agent Analysis
The detection engine analyzes the User-Agent header for known agent signatures:
| Agent | User Agent Pattern |
|---|---|
| ChatGPT | ChatGPT-User |
| GPTBot | GPTBot |
| Claude | Claude-Web, ClaudeBot |
| Perplexity | PerplexityBot |
| Google AI | Google-Extended |
| Googlebot | Googlebot |
| Bingbot | bingbot |
TLS Fingerprinting
The Gateway performs TLS fingerprint analysis (JA3/JA4) at the edge. Different clients produce distinct TLS handshake patterns, which helps distinguish browsers from automated tools even when user agents are spoofed.
TLS fingerprinting is only available with the Gateway. Middleware detection relies on other signals since TLS termination happens before the middleware runs.
HTTP Header Analysis
Beyond the user agent, the detection engine examines:
- Accept headers — Browsers send specific accept patterns
- Language headers — Automated tools often omit or misconfigure these
- Connection behavior — Keep-alive patterns, header ordering
- Missing headers — Browsers include standard headers that bots may skip
Request Pattern Analysis
Detection considers behavioral signals:
- Request frequency and timing
- Navigation patterns (do they follow links?)
- Resource loading (do they load CSS, images, JavaScript?)
- Cookie handling
Signature Verification (RFC 9421)
How It Works
Some AI agents cryptographically identify themselves using HTTP Message Signatures as defined in RFC 9421. ChatGPT, for example, signs its requests with Ed25519 keys.
When the Gateway detects signature headers:
- Extract the
SignatureandSignature-Inputheaders - Fetch the agent's public key from its
.well-known/http-message-signatures-directory - Verify the Ed25519 signature against the request
- If valid: 100% confidence classification as
ai_agent
Supported Agents
| Agent | Signature Type | Key Discovery |
|---|---|---|
| ChatGPT | Ed25519 (RFC 9421) | .well-known/http-message-signatures-directory |
Checkpoint caches public keys for 5 minutes to avoid repeated lookups. Key rotation is handled automatically.
Why Signature Verification Matters
Cryptographic signatures are unforgeable. When an agent presents a valid signature, detection confidence is 100% — there's no ambiguity about the request source. This makes signature verification the highest-confidence detection method available.
WASM Detection (Gateway)
The Gateway runs a WebAssembly detection module at Cloudflare's edge:
- Compiled from optimized detection logic
- Runs in under 5ms (p95)
- No network round-trips for classification
- Updated without redeployment via Cloudflare's platform
The WASM module combines multiple signals into a single classification with a confidence score.
Detection Classes
| Class | Value | Description | Typical Confidence |
|---|---|---|---|
| Human | human | Regular browser traffic | 0 (no agent signals) |
| AI Agent | ai_agent | AI assistants and chatbots | 70–100 |
| Bot | bot | Crawlers, scrapers, automation | 60–100 |
| Incomplete Data | incomplete_data | Insufficient signals | N/A |
AI Agent vs Bot
Checkpoint distinguishes between AI agents (ChatGPT, Claude, Perplexity) and traditional bots (Googlebot, scrapers). This lets you apply different policies — for example, allowing search crawlers while blocking AI scrapers.
Confidence Scores
| Range | Description |
|---|---|
| 100 | Cryptographic verification (signature match) |
| 90–99 | Strong multi-signal match (user agent + TLS + behavior) |
| 70–89 | Good signal match (user agent + partial verification) |
| 50–69 | Moderate signals (partial matches, some ambiguity) |
| 0–49 | Weak signals or human traffic |
Detection Latency
| Method | Latency (p95) | Where It Runs |
|---|---|---|
| Gateway (WASM) | ~1–5ms | Cloudflare edge (300+ locations) |
| Gateway (with signature) | ~5–10ms | Edge + key fetch (cached) |
| Middleware | ~5–10ms | Your application server |
Next Steps
- Policies — Use detection results to make enforcement decisions
- Gateway Enforcement — Edge-based detection setup
- Middleware Enforcement — Server-side detection setup
- Monitoring — Track detection performance