Skip to main content

FairSense-AgentiX

An agentic fairness and AI-risk analysis platform developed by the Vector Institute.

DOI code checks integration tests docs codecov PyPI GitHub License


FairSense-AgentiX is an open-source bias detection and AI risk assessment platform that uses agentic workflows (LangGraph orchestration, critique-and-refine) to analyze text, images, and deployment scenarios. It was peer-reviewed and published in the Journal of Open Source Software (DOI: 10.21105/joss.11060).

Documentation: https://vectorinstitute.github.io/fairsense-agentix/ · Archive: Zenodo (latest release; cite the version DOI you used)

✨ Key Features

  • 🤖 Agentic Reasoning - LangGraph orchestrator with evaluation-driven self-critique
  • 🔍 Multi-Modal Analysis - Text bias detection, image bias detection, and AI risk assessment
  • 🛠️ Flexible Tool Ecosystem - OCR, Vision-Language Models, embeddings, FAISS, and LLMs
  • 🌐 Production-Ready APIs - FastAPI REST API + WebSocket streaming + React UI
  • ⚙️ Highly Configurable - Swap LLM providers, tools, and models on the fly

📦 Installation

pip install fairsense-agentix

Optional: PaddleOCR backend

The default OCR backend is Tesseract (CPU-friendly, no extra setup). For GPU-accelerated PaddleOCR (higher accuracy on rotated/complex text), install the paddle extra:

pip install fairsense-agentix[paddle]

This pulls in paddlepaddle, which has platform-specific wheels and is much heavier — only install if you need it. Once installed, set FAIRSENSE_OCR_TOOL=paddleocr (or auto to let the runtime pick based on GPU availability).

From Source

git clone https://github.com/VectorInstitute/fairsense-agentix.git
cd fairsense-agentix
uv sync
source .venv/bin/activate

Requirements

  • Python 3.12 (3.13 not yet supported)
  • 4GB+ RAM (for ML models)
  • API key for OpenAI or Anthropic (for LLM functionality)

🚀 Quick Start

First point FairSense at a real LLM provider. The default provider is fake — it lets the package import and the tests run without an API key, but in that mode every result is a synthetic placeholder, not a real analysis (FairSense warns at construction, sets result.metadata.mock_mode = True, and prefixes result.warnings with MOCK MODE).

export FAIRSENSE_LLM_PROVIDER=openai   # or: anthropic
export FAIRSENSE_LLM_API_KEY=sk-...
from fairsense_agentix import FairSense

# Initialize the engine
engine = FairSense()

# Analyze text for bias
result = engine.analyze_text(
    "We're looking for a young, energetic developer to join our startup team."
)

print(f"Bias detected: {result.bias_detected}")
print(f"Risk level: {result.risk_level}")
for instance in result.bias_instances:
    print(f"  - {instance['type']} ({instance['severity']}): {instance['text_span']}")

🧑🏿‍💻 Developing

Installing dependencies

The development environment can be set up using uv. Hence, make sure it is installed and then run:

uv sync
source .venv/bin/activate

In order to install dependencies for testing (codestyle, unit tests, integration tests), run:

uv sync --dev
source .venv/bin/activate

In order to exclude installation of packages from a specific group (e.g. docs), run:

uv sync --no-group docs

Getting Started

Run the FastAPI service

python -m fairsense_agentix.service_api          # honours FAIRSENSE_API_HOST / PORT
# or: uv run uvicorn fairsense_agentix.service_api.server:app --host 127.0.0.1 --reload

Endpoints (all under /v1/...):

Route Description
POST /analyze JSON payload with content, optional input_type, options
POST /analyze/upload multipart/form-data for images
POST /batch & GET /batch/{id} Submit + inspect batch jobs
GET /health Health probe (reports llm_provider and mock_mode)
POST /shutdown Stop the server — disabled by default, see configuration below
WS /stream/{run_id} Stream telemetry/agent events for a run

The API auto-detects text/image/CSV inputs, but you can override by setting input_type to bias_text, bias_image, or risk.

Run the Claude-inspired UI

The UI lives in ui/ in this repository (it is not part of the PyPI wheel) and needs Node.js:

cd ui
npm install
npm run dev

Or start backend + UI together from the checkout with python -c "from fairsense_agentix import server; server.start()".

API URL: On one machine, set VITE_API_BASE if needed (default direct to port 8000). With SSH port-forwarding only 5173, leave VITE_API_BASE unset—the dev server proxies /v1 to 127.0.0.1:8000 on the host where both processes run (see Server guide).

The UI provides:

  • Unified input surface (text field + drag/drop image upload)
  • Live agent timeline sourced from telemetry events
  • Downloadable HTML highlights and risk tables
  • Launchpad for batch jobs

Key configuration knobs

Configure via environment variables (see .env for the full list). Most relevant:

Variable Description
FAIRSENSE_LLM_PROVIDER openai, anthropic, or fake (mock mode — synthetic results, testing only)
FAIRSENSE_LLM_MODEL_NAME e.g. gpt-4, claude-3-5-sonnet
FAIRSENSE_LLM_API_KEY Provider API key
FAIRSENSE_LLM_BASE_URL Endpoint override for openai — point at an OpenAI-compatible server such as Ollama (http://localhost:11434/v1)
FAIRSENSE_OCR_TOOL auto, tesseract, paddleocr, fake
FAIRSENSE_API_HOST Bind address (default 127.0.0.1; set 0.0.0.0 to expose, e.g. in a container)
FAIRSENSE_API_CORS_ORIGINS Allowed CORS origins (default: local Vite dev server; ["*"] to allow any)
FAIRSENSE_API_ENABLE_SHUTDOWN_ENDPOINT Expose POST /v1/shutdown (default false; the launcher enables it)
FAIRSENSE_API_SHUTDOWN_TOKEN Secret for X-Shutdown-Token; without it shutdown is loopback-only
FAIRSENSE_CAPTION_MODEL auto, blip2, blip, fake
FAIRSENSE_ENABLE_REFINEMENT enables evaluator-driven retries (default true)
FAIRSENSE_EVALUATOR_ENABLED toggles Phase 7 evaluators
FAIRSENSE_BIAS_EVALUATOR_MIN_SCORE passing score (0–100, default 75)

All settings can be overridden at runtime:

FAIRSENSE_LLM_PROVIDER=anthropic \
FAIRSENSE_LLM_MODEL_NAME=claude-3-5-sonnet-20241022 \
uv run uvicorn fairsense_agentix.service_api.server:app

Running tests

uv run pytest

During test collection we automatically override any .env values that point at real providers/devices so the suite always uses the lightweight fake toolchain. This guarantees deterministic, offline-friendly tests even if you have FAIRSENSE_LLM_PROVIDER=openai (or Anthropic) configured locally. To opt-in to exercising the real stack, export FAIRSENSE_TEST_USE_REAL=1 before running pytest.

Acknowledgments

Resources used in preparing this research were provided, in part, by the Province of Ontario, the Government of Canada through CIFAR, and companies sponsoring the Vector Institute.

This research was funded by the European Union's Horizon Europe research and innovation programme under the AIXPERT project (Grant Agreement No. 101214389).


📖 Citation

For reproducibility, cite the Zenodo DOI of the exact release you used (e.g. v0.3.0 for the bundled MIT Risk Repository V4 index) in addition to the JOSS article below. The JOSS paper describes the software as peer-reviewed at publication time (including the earlier V3 risk snapshot); it is not updated for each release.

@article{Narayanan2026,
  doi = {10.21105/joss.11060},
  url = {https://doi.org/10.21105/joss.11060},
  year = {2026},
  publisher = {The Open Journal},
  volume = {11},
  number = {126},
  pages = {11060},
  author = {Narayanan, Aravind and Sekhon, Karanpal and Alinoori, Mahshid and Raza, Shaina},
  title = {FairSense-AgentiX: An Agentic Platform for Multi-Modal Fairness and AI Risk Analysis},
  journal = {Journal of Open Source Software}
}

Contributing

If you are interested in contributing to the library, please see CONTRIBUTING.md. This file contains many details around contributing to the code base, including development practices, code checks, tests, and more.

For support or collaborations: shaina.raza@vectorinstitute.ai

Metadata

Release files for fairsense-agentix 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fairsense-agentix 0.3.0
File Size Uploaded Provenance Actions
fairsense_agentix-0.3.0.tar.gz 5.8 MB With provenance Details for fairsense_agentix-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fairsense-agentix 0.3.0
File Interpreter ABI Platform Actions
fairsense_agentix-0.3.0-py3-none-any.whl Python 3 none any Details for fairsense_agentix-0.3.0-py3-none-any.whl

Total release size: 11.6 MB

Release files / fairsense_agentix-0.3.0.tar.gz

Download URL fairsense_agentix-0.3.0.tar.gz
Size 5.8 MB
Tags Source
SHA-256 checksum
How to use checksums
9e84cb4bf301016a6b524430a1de99943d1679cf0871fd755b0949e5dfa53881
BLAKE2b-256 checksum
How to use checksums
21d396b1df39b3b8f2a3e1ad9d9bbbee5f473e3e2e2ef3c442327c00f26db9f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Release files / fairsense_agentix-0.3.0-py3-none-any.whl

Download URL fairsense_agentix-0.3.0-py3-none-any.whl
Size 5.8 MB
Tags Python 3
SHA-256 checksum
How to use checksums
ca5bde26a307981b994409d1a2c32e15f394d4658b49bb85d2e4cee59743f04d
BLAKE2b-256 checksum
How to use checksums
d5674a3e86fe3e22603b315538950998c06e8e877c7161110958b691bebbd3a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

Security for fairsense-agentix 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for fairsense_agentix-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page