Skip to main content

Zero-Risk Migration Philosophy

Adding security to production systems is nerve-racking. One wrong move and your users get errors instead of responses. RAXE is designed for incremental adoption:
  1. Shadow Mode: Run RAXE alongside your existing code. It logs threats but changes nothing.
  2. Wrapper Migration: Swap to RAXE wrappers with a single import change.
  3. Blocking Mode: Enable blocking only after you trust the detections.
This guide walks through each phase with real code examples.
The golden rule: Start with logging, observe for a week, then enable blocking. No surprises.

Step 1: Shadow Mode (Zero Impact)

Shadow mode runs RAXE in parallel with your existing code. Your application flow is completely unchanged - RAXE just observes and logs.

Basic Shadow Implementation

Shadow Mode with Context

For better observability, add request context:

Shadow Mode Duration

Shadow mode checklist (run for 1-2 weeks):
  • RAXE logs appearing in your log aggregator
  • No impact on response times (scan takes < 10ms)
  • Reviewed detection patterns to understand threat landscape
  • False positive rate acceptable (< 1% is typical)
  • Team comfortable with detection accuracy

Step 2: Wrapper Migration (One-Line Change)

Once shadow mode looks good, migrate to RAXE wrappers for automatic protection.

OpenAI Migration

The wrapper scans before the API call. If a threat is detected and blocking is enabled, the API is never called - saving you money on wasted tokens.

Anthropic Migration

Async Wrapper Migration


Step 3: Framework Integration

For LangChain, CrewAI, and other frameworks, add callbacks without changing your chain/agent logic.

LangChain Migration

LiteLLM Migration

CrewAI Migration


Common Migration Scenarios

FastAPI Middleware

Add RAXE as middleware to scan all incoming prompts:

Flask Before Request

Django Middleware

Async Applications

For high-throughput async applications:

Batch Processing Pipelines

For ETL or data processing:

Streaming Responses

RAXE scans prompts before streaming begins:

Rollback Plan

Things happen. Here’s how to quickly disable RAXE if needed.

Environment Variable Toggle

Feature Flag Pattern

Wrapper Rollback

Gradual Rollout with Percentage


Measuring Success

Track these metrics to validate your migration.

Before/After Comparison

Verification Script

Expected Detection Rates

Based on production deployments:
Higher detection rates often indicate your application is being actively probed. This is valuable threat intelligence.

Logging for Dashboards

Structure your logs for easy dashboard creation:

Migration Checklist

1

Shadow Mode (Week 1)

  • Install RAXE: pip install raxe
  • Add shadow scanning to critical endpoints
  • Verify logs appearing in your log aggregator
  • Confirm no impact on response times
2

Observe and Tune (Week 2)

  • Review detection logs daily
  • Note false positive patterns (if any)
  • Add suppressions for known false positives
  • Document detection patterns for team
3

Wrapper Migration (Week 3)

  • Swap to RAXE wrappers (still log-only)
  • Verify all API calls are being scanned
  • Run verification script in staging
  • Deploy to production (log-only)
4

Enable Blocking (Week 4+)

  • Start with percentage rollout (10%)
  • Monitor for user-reported issues
  • Gradually increase to 100%
  • Set up alerting for blocked requests

What’s Next?

OpenAI Wrapper

Full OpenAI wrapper documentation

LangChain Integration

Protect LangChain agents and chains

Custom Rules

Add domain-specific detection rules

Troubleshooting

Common issues and solutions