Skip to main content

Step 1: Setting API Key

Set up your Future AGI account and get started with Future AGI’s robust SDKs. Follow the QuickStart guide:
Click here to learn how to access your API key.

Step 2: Installation and Setup

To begin using Protect initialize the Protect instance. This will handle the communication with the API and apply defined safety checks.
Note: Protect automatically reads FI_API_KEY and FI_SECRET_KEY from your environment variables if not explicitly provided.

Step 3: Define Protect Rules

The Protect() method accepts several arguments and rules to configure your protection checks.

Arguments


Defining Rules

Rules are defined as a list of dictionaries. Each rule specifies which safety dimension to check. Example Rule Set:
Important Notes:
  • Evaluation stops as soon as one rule fails (fail-fast behavior)
  • Rules are processed in parallel batches for optimal performance
  • All four safety dimensions work across text, image, and audio modalities

Understanding the Outputs

When a check is run, a response dictionary is returned with detailed results.

Pass Example

Fail Example


Examples by Safety Dimension

Content Moderation

Bias Detection

Security

Data Privacy Compliance


Multiple Rules Example

Check multiple safety dimensions simultaneously:

Multi-Modal Support in Protect

Protect natively supports text, image, and audio inputs without requiring any configuration changes. Simply pass your input as a string—whether it’s plain text, an image URL, an image file path, an audio URL, or an audio file path. Our system automatically detects the input type and processes it accordingly across all safety dimensions.

Supported Input Formats

Text:
  • Plain text strings
Images:
  • HTTP(S) URLs (e.g., https://example.com/image.jpg)
  • Local file paths (e.g., /path/to/image.png)
  • Data URIs (e.g., data:image/png;base64,...)
  • Supported formats: JPG, PNG, WebP, GIF, BMP, TIFF, SVG
Audio:
  • HTTP(S) URLs (e.g., https://example.com/audio.mp3)
  • Local file paths (e.g., /path/to/audio.wav)
  • Data URIs (e.g., data:audio/wav;base64,...)
  • Supported formats: MP3, WAV

Text Input Example

Image Input Example

Audio Input Example

Advanced Features

Custom Action Messages per Rule

You can specify different action messages for different rules:

Processing Multiple Inputs

Process a list of inputs in sequence (evaluation stops at first failure):

Using Environment Variables

Set your API credentials as environment variables for cleaner code:
Then initialize without explicit credentials:

Important Notes

  • Local files are automatically converted to data URIs (max 20MB by default)
  • Preview URLs (e.g., GitHub blob pages, Google Drive viewers) are rejected—use direct download URLs
  • All safety dimensions work across all modalities (text, image, audio)
  • Rules are processed in parallel batches for optimal performance
  • Evaluation uses fail-fast behavior: stops at first rule violation