NOTQIN Agent (CBAM Compliance Copilot)
1. Project Summary
A regulatory intelligence AI agent that helps Moroccan industrial exporters understand their EU Carbon Border Adjustment Mechanism (CBAM) exposure, identify compliance gaps, and generate prioritized action plans — using a plugin-based connector architecture that works with NOTQIN, SAP, SCADA, or even Excel files.
2. Architecture
React Frontend (Vite + Recharts + Tailwind + React Router)
│
↓
FastAPI + Uvicorn
│ SSE streaming
↓
Claude via LiteLLM (provider-agnostic)
│ 9 tool definitions
↓
┌────────────────────────────────────────────────┐
│ lookup_regulation → CBAM Knowledge Base │
│ calculate_exposure → Emissions math engine│
│ compare_scenarios → Default/actual/verified│
│ assess_compliance_gaps → MRV gap detection │
│ generate_action_plan → Prioritized roadmap │
│ query_factory_data → Connector dispatch │
│ search_regulatory_updates → Web search │
│ report_generator → Action plan export │
│ company_profile → Session state │
└────────────────────────────────────────────────┘
│
↓ Pluggable Factory Connectors
├── NOTQINConnector → MQTT + InfluxDB + Flink
├── CSVImportConnector → Excel/CSV files
├── SAPConnector → SAP ERP (stub)
└── OPCUAConnector → SCADA/OPC-UA (stub)
3. Tech Stack
| Layer | Technology |
|---|---|
| Language | Python 3.11+ |
| API | FastAPI 0.115 + Uvicorn |
| LLM | LiteLLM 1.40 (provider-agnostic: Claude, OpenAI, etc.) |
| Factory Integration | paho-mqtt 2.1, InfluxDB client, psycopg2 |
| Data | Pandas, Pydantic 2.0 |
| Streaming | sse-starlette 2.0 (SSE) |
| Reports | ReportLab (PDF), openpyxl (Excel) |
| Frontend | React 19.2 + Vite + Recharts + Tailwind CSS |
4. CBAM Knowledge Base
Built-in regulatory knowledge:
cbam_regulation.md— Core CBAM text (EU Regulation 956/2023)implementing_acts.md— Key delegated acts for monitoring/reportingdefault_values.json— Emission factors by CN code (cement, steel, aluminum, fertilizers, H₂)cn_codes.json— Relevant HS codes + descriptions for Moroccan exportersmorocco_context.md— Morocco-specific: no national carbon price, ONEE grid factor ~0.7 tCO2/MWh, key export sectors
5. Connector Interface
Every factory connector implements:
class FactoryConnector(ABC):
def get_energy_consumption(device_id, period) → float # kWh
def get_production_output(period) → float # tons/units
def get_alerts(severity, period) → List[Alert]
def get_asset_list() → List[Asset]
def get_emission_factors() → EmissionFactors # fuel mix, grid factor
def get_enpi(device_id, period) → float # kWh/kg outputNOTQIN connector reads:
- Live telemetry via MQTT (
notqin/telemetry) - Processed metrics via InfluxDB (
notqin_derivedbucket) - Existing alerts from InfluxDB
6. Demo Scenarios
| Scenario | Company | Exposure (Default) | Exposure (Verified MRV) |
|---|---|---|---|
| Cement exporter | 15,000t/year to Spain | €405K/year | €180K/year |
| Fertilizer conglomerate | 80% EU sales (DAP/MAP) | High (Scope 2 included) | Significant reduction with IoT |
| Small steel workshop | Excel data only | Benchmark-based | IoT monitoring recommended |
7. Current Status
Stage: Early development (3 git commits)
Last commit: Apr 5, 2026
What’s built:
- Agent loop with 9 tools
- NOTQIN connector (InfluxDB + MQTT)
- CSV/Excel fallback connector
- CBAM knowledge base
- Demo scenarios documented
- React frontend (multi-panel chat + reasoning stream)
- ReportLab PDF + openpyxl Excel export
Stubs (not implemented):
- SAP ERP connector
- OPC-UA/SCADA connector
Relationship to IEIA:
- NOTQIN Agent = strategic/regulatory view (months–years horizon): “What is our CBAM exposure and what should we do about it?”
- IEIA = operational view (hours–days): “Why did this machine spike and what’s the cheapest fix?”
- The two agents are complementary and should share the same factory data source
8. Next Actions
- Implement SAP ERP connector
- Implement OPC-UA/SCADA connector
- Connect to production NOTQIN InfluxDB
- Add Keycloak auth (align with IEIA patterns)
- Write demo video / case study for CBAM pitch
- Identify first pilot customer (Moroccan exporter facing CBAM)