Skip to content

LightLLM/RegulationOS

Repository files navigation

RegulationOS

The AI That Runs Compliance for the World

RegulationOS is a demo-ready web application that uses agentic AI to read regulatory documents, analyze operational data (e.g. cargo manifests), detect compliance risks, and generate actionable remediation plans. The primary demo vertical is Shipping and Transportation: upload a regulation PDF and a cargo manifest CSV to get a compliance score, risk list, and recommended actions.

  • Frontend: Next.js 14, TypeScript, Tailwind CSS
  • Backend: FastAPI, Python 3.11
  • AI: Amazon Nova–ready multi-agent architecture with a mock adapter for offline/demo use (no API key required).

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                     FRONTEND (Next.js 14)                        │
│   Home │ Upload (PDF + CSV) │ Dashboard (score, risks, Q&A)      │
│                        lib/api.ts → REST                         │
└────────────────────────────┬────────────────────────────────────┘
                              │ HTTP
┌────────────────────────────▼────────────────────────────────────┐
│                      BACKEND (FastAPI)                           │
│   GET /health   POST /analyze   POST /analyze-demo   POST /ask   │
│                              │                                   │
│   SupervisorAgent → RegulationAgent → CargoAgent → RiskAgent     │
│                              → WorkflowAgent   VoiceAgent (/ask)  │
│   NovaClient / MockNovaClient   StorageService (JSON reports)   │
└─────────────────────────────────────────────────────────────────┘

Agents

Agent Role
SupervisorAgent Runs the pipeline: regulation → cargo → risk → workflow; returns one ComplianceReport.
RegulationAgent Extracts obligations, prohibited actions, required docs, safety risks from regulation text.
CargoAgent Parses cargo CSV and flags hazardous items (e.g. lithium, solvent).
RiskAgent Compares cargo to obligations, produces risks and a 0–100 compliance score.
WorkflowAgent Builds recommended actions and workflow automations (e.g. “Generate declaration form”).
VoiceAgent Answers natural-language questions about the report (used by /ask).

Local setup

  1. Clone and enter the project

    cd regulation-os
  2. Environment

    cp .env.example .env

    Edit .env if you want to use the live Nova API; for demo, USE_MOCK_NOVA=true is enough.

  3. Backend (from project root regulation-os/)

    python -m venv .venv
    .venv\Scripts\activate   # Windows
    # source .venv/bin/activate   # macOS/Linux
    pip install -r backend/requirements.txt
    set PYTHONPATH=%CD%   # Windows
    uvicorn backend.main:app --reload --port 8000
  4. Frontend

    cd frontend
    npm install
    npm run dev

    Open http://localhost:3000.


Environment variables

Variable Description Default
USE_MOCK_NOVA Use mock AI (no API key) true
NOVA_API_KEY Amazon Nova API key (when not using mock)
NOVA_MODEL_LITE Nova model for completions nova-2-lite
NOVA_EMBEDDING_MODEL Nova embedding model nova-multimodal-embedding
NOVA_SONIC_MODEL Nova Sonic model nova-2-sonic
BACKEND_URL Backend base URL (server-side) http://localhost:8000
NEXT_PUBLIC_BACKEND_URL Backend URL for browser http://localhost:8000

Run with Docker

From the regulation-os directory:

cp .env.example .env
docker-compose up --build

Amazon Nova integration

  • With USE_MOCK_NOVA=true (default), the app uses MockNovaClient: deterministic, offline, no API key.
  • To use the live Nova API, set USE_MOCK_NOVA=false and NOVA_API_KEY in .env. The same agent code then calls the real API.

Demo script (for judges)

  1. Open http://localhost:3000.
  2. Click “Launch Demo” (or go to Upload).
  3. Click “Load Demo Data” to load the sample regulation and cargo manifest.
  4. Click “Analyze”. Wait for the run to finish.
  5. You are redirected to the Dashboard: compliance score, risk list, recommended actions, workflow automations.
  6. In Ask RegulationOS, type a question (e.g. “What is the main compliance risk?”) and click Ask to see the Q&A response.

Tests

  • Backend: From regulation-os, with PYTHONPATH set to the project root:
    pytest backend -v
  • Frontend: From regulation-os/frontend:
    npm run test

Future roadmap

  • Persist report IDs and support “load report by ID” from the dashboard.
  • Add more sectors (Healthcare, Finance, Energy) with sector-specific regulations and schemas.
  • Replace mock with full Nova integration (embeddings, Sonic) for production.
  • Optional auth and tenant isolation for multi-tenant deployments.

About

We were inspired to build RegulationOS, an AI system that transforms regulations into actionable intelligence and automated compliance workflows.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors