Skip to main content

Raxe

The main synchronous client for threat detection.

Constructor

Parameters: Example:

scan()

Scan a single prompt for threats.
Parameters: Returns: ScanPipelineResult Raises:
  • ValidationError: If text is empty or invalid
  • RaxeBlockedError: If block_on_threat=True and threat detected
Example:

scan_fast()

Fast scan using L1 rules only (< 1ms).
Equivalent to scan(text, l2_enabled=False, mode="fast").

scan_thorough()

Thorough scan with all layers (< 10ms).
Equivalent to scan(text, mode="accurate").

protect

Decorator for automatic function protection.
Parameters:

suppressed()

Context manager for scoped suppressions.
Parameters:

Context Manager

Use as context manager for proper resource cleanup:

AsyncRaxe

Async client for high-throughput scenarios.

Constructor

Additional Parameters:

scan()

Async scan of a single prompt.
Example:

scan_batch()

Async batch scanning with concurrency control.
Parameters: Example:

Cache Management


close()

Explicitly close the client and flush telemetry.
Example:

Context Manager

Recommended usage:

Properties

Both Raxe and AsyncRaxe expose these properties: Example:

Thread Safety

  • Raxe is thread-safe for concurrent scans
  • AsyncRaxe is safe for concurrent async tasks
  • Both clients maintain internal state safely