Skip to main content
Glama
nohosa001-pixel

EUDR Compliance & TRACES-NT Agent

README.md
# 🌲 EUDRAgent.com | Autonomous EUDR Compliance & Multi-Chain Escrow Platform

[![EUDRAgent CI/CD Pipeline](https://github.com/nohosa001-pixel/eudr-compliance-agent/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/nohosa001-pixel/eudr-compliance-agent/actions)
[![Python](https://img.shields.io/badge/Python-3.11%20%7C%203.12%20%7C%203.14-blue.svg)](https://www.python.org/)
[![FastAPI](https://img.shields.io/badge/FastAPI-0.110.0-009688.svg)](https://fastapi.tiangolo.com/)
[![PostGIS](https://img.shields.io/badge/PostGIS-3.4%20Spatial-336791.svg)](https://postgis.net/)
[![Regulation](https://img.shields.io/badge/Regulation-EU%202023%2F1115-10b981.svg)](https://eur-lex.europa.eu/eli/reg/2023/1115/oj)
[![Tests](https://img.shields.io/badge/Tests-345%20Passed%20(100%25)-brightgreen.svg)](https://github.com/nohosa001-pixel/eudr-compliance-agent)
[![Multi-Chain](https://img.shields.io/badge/EVM-Polygon%20%7C%20Base%20%7C%20Arbitrum-8247e5?style=flat&logo=ethereum&logoColor=white)](https://polygonscan.com)
[![Solana](https://img.shields.io/badge/Solana-Mainnet--Beta%20SPL--USDC-14F195?style=flat&logo=solana&logoColor=black)](https://solscan.io)
[![Glama MCP](https://img.shields.io/badge/Glama-MCP%20Server-7C3AED.svg)](https://glama.ai/mcp/servers/nohosa001-pixel/eudr-compliance-agent)
[![PyPI](https://img.shields.io/pypi/v/eudr-compliance-agent.svg?color=blue)](https://pypi.org/project/eudr-compliance-agent/)
[![Cloud Run](https://img.shields.io/badge/Google%20Cloud%20Run-Live%20Production-4285F4.svg)](https://cloud.google.com/run)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

**EUDRAgent** is an enterprise-grade autonomous compliance automation and Due Diligence Statement (DDS) generation engine for the **European Union Deforestation Regulation (Regulation (EU) 2023/1115)**.

Equipped with high-resolution satellite radar (Copernicus Sentinel-1/2 SAR & Optical), 4ha polygon self-healing, EU TRACES-NT XML customs clearance, autonomous Reverse-Auction B2B procurement, sub-5ms cognitive firewall via **`security-gate-x402`**, European Customs (EU SWE-C / TARIC) automated pre-clearance, and multi-chain smart escrows across **Solana Mainnet-Beta (SPL-USDC), Polygon PoS, Base, and Arbitrum One**.

---

## πŸ“½οΈ 4-Step Instant Demo (2-Second Automated Audit)

![EUDR Compliance Agent Video Demonstration](eudr_usage_tutorial.gif)

### πŸ’‘ Why EUDRAgent? (The Enterprise Solution)

| ❌ The Legacy Problem | βž” | βœ… The EUDRAgent Solution |
| :--- | :---: | :--- |
| **4% Global Revenue Fines & Seized Cargo** | βž” | **0% Fine Guarantee & Verified Customs Clearance** |
| **Weeks of Manual GIS Parcel Inspection** | βž” | **2-Second Multi-Satellite Radar & Optical Scan** |
| **Topological Polygon Defects & Coordinate Reversals** | βž” | **Autonomous Self-Healing GIS (Bowties, WGS84, 4ha Rule)** |
| **Port Demurrage & Customs Clearance Holds** | βž” | **Automated EU SWE-C Port Pre-Clearance Simulation** |
| **Rejected TRACES-NT XML Customs Filings** | βž” | **1-Click Validated TRACES-NT XML & UCC DE 12 03** |
| **Ambiguity in Import TARIC Document Codes** | βž” | **Automated TARIC C081, C082, Y120, Y121, Y122 Formatter** |
| **Trading Counterparty Fraud & Data Tampering** | βž” | **Anchor Solana Escrow + EIP-712 Oracle Slashing** |
| **Smallholder Payment Delays & High Gas Fees** | βž” | **Sub-Second Direct Split via Solana SPL-USDC & Solana Pay** |
| **Prompt Injections & Supply Chain Hallucinations** | βž” | **Sub-5ms Cognitive Firewall via `security-gate-x402`** |
| **Manual Procurement Inefficiencies** | βž” | **Autonomous A2A Reverse-Auction Marketplace** |

---

## πŸ‡ͺπŸ‡Ί European Customs & EU SWE-C Gateway (DG TAXUD / UCC Interoperability)

Under **Regulation (EU) 2023/1115 Articles 26, 27, and 28**, customs authorities must verify the existence of a valid Due Diligence Statement (DDS) before releasing goods for free circulation:

### 1. Official EU TARIC Document Codes (Box 44 / DE 12 03 000 000)

| TARIC Code | Regulatory Scope | Statutory Rationale & Action |
| :---: | :--- | :--- |
| **`C081`** | **Standard / Simplified EUDR DDS** | Due Diligence Statement reference number + verification code registered via TRACES-NT. Mandatory for release for free circulation. |
| **`C082`** | **Downstream Operator Pass-Through** | Reference to an existing valid upstream DDS (Article 4(8)). Eliminates redundant coordinate submissions. |
| **`Y120`** | **Goods Outside EUDR Scope** | Declaration that the consignment does not fall within Regulation (EU) 2023/1115 Annex I scope (Article 1(2)). |
| **`Y121`** | **100% Recycled Waste Exemption** | Goods produced entirely from post-consumer waste materials (Annex I Footnote 1). |
| **`Y122`** | **Transport Packaging Exemption** | Wooden pallets, packing cases, and paper wrappers used exclusively to support or protect primary merchandise. |

### 2. Union Customs Code (UCC) Data Element 12 03 000 000 Generator

Generates ready-to-file electronic customs payloads matching European national customs systems:

* **ATLAS** (Germany - Zoll)
* **DMS / AGS** (Netherlands - Douane Nederland)
* **DELTA-IE** (France - DGDDI)
* **PLDA / IDMS** (Belgium - Douane & Accijnzen)
* **VUE** (Spain - Agencia Tributaria)

### 3. Article 16 Inspection Rates & Major Port Clearance Profiles

EUDRAgent calculates pre-arrival inspection channel probabilities based on Article 29 country benchmarking:

* **High-Risk Origin (e.g. MM, KP, BY)**: **9% minimum statutory inspection rate** (`ORANGE_DOCUMENTARY_CHECK`).
* **Standard-Risk Origin (Default)**: **3% statutory inspection rate** (`AUTOMATED_GREEN_LANE`).
* **Low-Risk Origin (e.g. FI, SE, NO, NZ)**: **1% statutory inspection rate** (`AUTOMATED_GREEN_LANE`).
* **Supported Hubs**: Port of Rotterdam (`NLRTM`), Antwerp-Bruges (`BEANR`), Hamburg (`DEHAM`), Valencia (`ESVLC`), Le Havre (`FRLEH`), Genoa (`ITGOA`).

### 4. EC EUDR Information System User Guide v3.0 Digital Workflow Compliance

EUDRAgent is natively aligned with the European Commission's **Information System User Guide v3.0** (released September 2026 for Dec 30, 2026 enforcement):

* **Dual-Identifier Security (DDS Ref + Verification No.)**: When a statement reaches `AVAILABLE` status, both a unique `DDS Reference Number` and anti-tamper `Verification Number` are paired. Required for EU Customs Box 44 / DE 12 03 000 000 clearance.
* **5-Tier Role-Based Workflow**: Native protocol support for EUDR Operators, Micro/Small Primary Producers (MSPO), SME Downstream Traders, Non-SME Downstream Operators (mandatory active verification on substantiated concern), and Authorised Representatives.
* **Smallholder Simplified Declaration (SD) Identifier**: 1-time simplified declaration key for qualified smallholders and cooperatives to prevent global supply chain exclusion.
* **DDS Grouping & Group Head Liability**: Hierarchical bundling of tens of thousands of parcels under a legally-binding `Group Head` master statement with 1:1 raw material lot mapping.
* **V3 Enterprise API Readiness**: Full compatibility with the unified SOAP/HTTPS `EUDRDueDiligenceStatementServiceV3` and REST JSON-LD endpoints.

---

## 🌐 Autonomous 4-Node Inter-Agent Mesh Ecosystem

EUDRAgent is natively integrated into the **@nohosa001-pixel Autonomous Agent Mesh**, operating over the Model Context Protocol (MCP) JSON-RPC 2.0 with cryptographic verification:

```text
               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
               β”‚         EUDR Compliance Agent (Port 8000)              β”‚
               β”‚   β€’ Copernicus Sentinel-1/2 SAR / Optical Telemetry   β”‚
               β”‚   β€’ WGS84 Geodesic Polygon Self-Healing (<4ha Rule)   β”‚
               β”‚   β€’ Official TRACES-NT B2G Customs XML Compiler       β”‚
               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚                      β”‚
       MCP / JSON-RPC    β”‚                      β”‚  MCP / JSON-RPC
       Cognitive Shield  β”‚                      β”‚  Clean Supplier Web
                         β–Ό                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚    Node 2: security-gate-x402        β”‚  β”‚     Node 3: x402-cleanweb-agent     β”‚
β”‚ β€’ Sub-5ms Cognitive Firewall         β”‚  β”‚ β€’ Autonomous Web Scraping           β”‚
β”‚ β€’ EIP-712 Domain 3 Truth Oracle      β”‚  β”‚ β€’ HTML Bloat & Ad Stripping         β”‚
β”‚ β€’ Universal Direct Split Escrow      β”‚  β”‚ β€’ Smallholder Cooperative Dossiers  β”‚
β”‚ β€’ Solana Ed25519 Mainnet Attestor    β”‚  β”‚ β€’ Production Web Intelligence       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚
                         β”‚ Cross-Check ESG
                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        Node 4: minerals-oracle-x402                           β”‚
β”‚  β€’ Critical Minerals Valuation (Li, Ni, Cu, Co, Ti)                           β”‚
β”‚  β€’ EUDR Forest Conflict ESG Cross-Check & Traceability Audits                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## ⚑ Multi-Chain Escrow & Settlement Rails

EUDRAgent supports dual-layer smart contracts for frictionless B2B trade execution, eliminating commercial default risk while ensuring zero-deforestation compliance:

### 1. Solana Mainnet-Beta SPL-USDC Escrow Rail (High Throughput)

* **Settlement Token**: Native SPL-USDC (`EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`, 6 decimals).
* **Speed & Cost**: 400ms finality, ~$0.00025 network fee.
* **Anchor Smart Contract**: [`programs/eudr-escrow/src/lib.rs`](programs/eudr-escrow/src/lib.rs) with `initialize_escrow`, `settle_direct_split`, and `slash_non_compliant`.
* **Oracle Attestation**: Ed25519 cryptographic truth proof (`EUDR_FOREST_SOLANA` domain).
* **Solana Pay**: Dynamic QR payloads & deep links (`solana:<recipient>?amount=...&spl-token=...`).
* **Treasury Account**: `411ksMz9RHYVtVMe6RUUErzZYtrU9zzvkgzswKbqx9qp`.

### 2. Multi-Chain EVM Payment Vaults (Polygon, Base, Arbitrum)

* **Polygon PoS (137)**: `0x45ecBfAa2F4B0Bc6ccD3eB2dB9B1Ca49CF121861` (Native USDC: `0x3c49...3359`).
* **Base Mainnet (8453)**: `0x28292D76E07E5539F15F3b97935dE8E0432E76DD` (Native USDC: `0x8335...2913`).
* **Arbitrum One (42161)**: `0x28292D76E07E5539F15F3b97935dE8E0432E76DD` (Native USDC: `0xaf88...5831`).
* **Smart Contract**: `AgentEscrow.sol` with EIP-712 off-chain oracle verification (`0x90F8...C9C1`).

---

## πŸ“Œ Live Cloud Portals & Diagnostic Endpoints

| Portal / API Route | Target URL | Description |
| :--- | :--- | :--- |
| 🌟 **SaaS Official Landing Page** | [`/`](https://eudragent.com/) | Interactive 4-country satellite radar sandbox & transparent pricing |
| πŸ–₯️ **Operator Console** | [`/dashboard`](https://eudragent.com/dashboard) | 4ha polygon self-healing, multi-satellite analysis, & TRACES-NT DDS generation |
| 🌾 **Supplier Pre-Clearance Portal** | [`/supplier-portal`](https://eudragent.com/supplier-portal) | Mobile-friendly self-assessment for overseas smallholders & cooperatives |
| πŸ“– **Interactive API Documentation** | [`/docs`](https://eudr-compliance-agent-212942243360.asia-northeast3.run.app/docs) | OpenAPI 3.1 / Swagger UI for ERP, SAP, and customs system integration |
| πŸ›‘οΈ **Security Gate Diagnostics** | [`/api/v1/eudr/mesh/security-gate/diagnostics`](https://eudr-compliance-agent-212942243360.asia-northeast3.run.app/api/v1/eudr/mesh/security-gate/diagnostics) | **Live 4-tier probe of connected `security-gate-x402` (Seoul Cloud Run)** |
| ⛓️ **Multi-Chain RPC Status** | [`/api/v1/payment/chains/status`](https://eudr-compliance-agent-212942243360.asia-northeast3.run.app/api/v1/payment/chains/status) | **Real-time RPC block heights & USDC contracts for Polygon, Base, Arbitrum** |
| β˜€οΈ **Solana Escrow Cluster** | [`/api/v1/escrow/solana/cluster-status`](https://eudr-compliance-agent-212942243360.asia-northeast3.run.app/api/v1/escrow/solana/cluster-status) | Live slot height, 400ms block time, and SPL-USDC mint status on Solana |
| 🀝 **A2A Marketplace RFQ** | [`/api/v1/marketplace/rfq/create`](https://eudr-compliance-agent-212942243360.asia-northeast3.run.app/api/v1/marketplace/rfq/create) | Autonomous commodity procurement and reverse-auction clearing |
| πŸ€– **Model Context Protocol (MCP)** | [`/api/v1/mcp`](https://eudr-compliance-agent-212942243360.asia-northeast3.run.app/api/v1/mcp) | JSON-RPC 2.0 MCP endpoint for Claude Desktop, Cursor, Antigravity |
| πŸ“„ **LLM Discovery Directory** | [`/llms.txt`](https://eudragent.com/llms.txt) | LLM crawler & agent standard summary |

---

## πŸ€– Model Context Protocol (MCP) Integration

EUDRAgent provides a native **MCP v2024-11-05** server exposing **32+ autonomous agent tools**. Compatible with **Claude Desktop, Cursor, Antigravity, and Zed**.

### Claude Desktop Setup (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "eudr-compliance": {
      "command": "python",
      "args": [
        "C:\\Users\\nohos\\OneDrive\\바탕 ν™”λ©΄\\eudr-compliance-agent\\mcp_server_stdio.py"
      ]
    },
    "eudr-compliance-cloud": {
      "url": "https://eudr-compliance-agent-7qxtp3324q-du.a.run.app/api/v1/mcp"
    }
  }
}
```

### 32 Registered Autonomous Agent Tools (Selected)

| Category | Tool Name | Description |
| :--- | :--- | :--- |
| **GIS & Self-Healing** | `eudr_verify_plot` | WGS84 geodesic coordinates, polygon closure, and strict 4.0ha rule check |
| **Deforestation Radar** | `eudr_check_deforestation` | Sentinel-1/2 & GFC canopy loss analysis against 2020-12-31 cutoff baseline |
| **Satellite Radar Map** | `eudr_render_satellite_map` | Generates Sentinel-2 NDVI canopy density SVG radar visualization |
| **EU Customs Clearance** | `eudr_verify_vies_vat` | Real-time EU Commission VIES VAT cross-border reverse charge check |
| **DDS Compilation** | `eudr_generate_dds` | Compiles official TRACES-NT XML & JSON-LD Due Diligence Statement |
| **Audit Integrity** | `eudr_verify_audit_integrity` | SHA-256 tamper-evident cryptographic chain audit verification |
| **Solana Direct Split** | `eudr_solana_settle_escrow` | **Settles SPL-USDC escrow with instant direct payout to farmers** |
| **Solana Pay Link** | `eudr_solana_generate_pay_link` | **Generates standard Solana Pay URI and QR code payload** |
| **Web3 Oracle Attest** | `eudr_issue_eip712_attestation` | Issues EIP-712 Attestation as EUDR Oracle for EVM `AgentEscrow.sol` |
| **Web3 Oracle Verify** | `eudr_verify_eip712_attestation` | Verifies EIP-712 proof for on-chain `completeJob` or `slashJob` |
| **x402 Security Shield** | `eudr_inspect_payload_security` | Prompt injection barrier, AST sandbox, & agronomic yield fact-check |
| **A2A RFQ Broadcast** | `eudr_publish_compliance_rfq` | Autonomous Buyer Agent broadcasts procurement RFQ to supplier network |
| **A2A Bid Submission** | `eudr_submit_compliance_bid` | Supplier AI Agent submits competitive geolocated compliance bid |

---

## πŸ›οΈ Core Architecture & The 4 EUDR Pillars

```text
EUDR Supply Chain Payload (JSON / CSV / GeoJSON / Shapefile)
                           β”‚
                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 1. Geodesic Spatial & Topology Engine (SpatialValidator)                β”‚
β”‚    - Strict Article 9(1)(d) 4-Hectare Rule Enforcement                  β”‚
β”‚    - Sub-second WGS84 Geodesic Ellipsoidal Area Calculation (GRS80/WGS84)β”‚
β”‚    - Autonomous Polygon Self-Healing (Self-Intersection & Spike Repair) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                     β”‚
                                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 2. Multi-Constellation Satellite Radar (DeforestationAnalyzer)          β”‚
β”‚    - Strict Cut-off Baseline: 31 December 2020                          β”‚
β”‚    - Copernicus Sentinel-1 (C-Band Synthetic Aperture Radar - SAR)      β”‚
β”‚    - Copernicus Sentinel-2 (NDVI 10m Multi-Spectral Monitoring)         β”‚
β”‚    - Hansen Global Forest Change (GFC) & JRC Canopy Triangulation       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                     β”‚
                                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 3. Legal Document & Risk Benchmarking Auditor (LegalAuditor)            β”‚
β”‚    - EU Country Risk Benchmarking (Low / Standard / High Risk Tiers)    β”‚
β”‚    - Origin Legality Verification (Land Titles, Harvest Permits)        β”‚
β”‚    - Free, Prior, and Informed Consent (FPIC) for Indigenous Peoples    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                     β”‚
                                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 4. Cryptographic TRACES-NT DDS Statement Generator (DDSGenerator)       β”‚
β”‚    - EU Customs Direct B2G Submission Payload Packaging                 β”‚
β”‚    - HMAC-SHA256 Cryptographic Digital Signature & Merkle Audit Trail   β”‚
β”‚    - Dual-rail Settlement: Solana Mainnet SPL-USDC & EVM AgentEscrow    β”‚
β”‚    - Article 31 (5-Year Record Retention) Immutable Evidence Bundle    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## πŸš€ Quick Start Guide

### 1. Installation

```bash
# Clone the repository
git clone https://github.com/nohosa001-pixel/eudr-compliance-agent.git
cd eudr-compliance-agent

# Create and activate virtual environment
python -m venv .venv
.\.venv\Scripts\activate      # Windows (PowerShell)
source .venv/bin/activate     # Linux / macOS

# Install dependencies (FastAPI, Shapely, PyProj, Eth-Account, Cryptography)
pip install -r requirements.txt
```

### 2. Run Local Development Server

```bash
uvicorn app.main:app --reload --port 8000
```

Open your browser at `http://localhost:8000` to access the SaaS Landing Page, or `http://localhost:8000/dashboard` for the Operator Console.

### 3. Run Automated Test Suite (294 Tests)

```bash
python -m pytest -v tests/
```

Validates the complete suite of **294 automated tests** covering GIS self-healing, Copernicus satellite radar analysis, EIP-712 EVM escrows, Solana SPL-USDC Direct Splits, and Inter-Agent Mesh diagnostics.

---

## πŸ”‘ Programmatic API Usage Examples

### 1. Submit EUDR Due Diligence Evaluation

```bash
curl -X POST "http://localhost:8000/api/v1/eudr/evaluate" \
  -H "Content-Type: application/json" \
  -d '{
    "operator_id": "VN-EXP-COFFEE-8821",
    "operator_name": "Highland Agri Export Ltd",
    "commodity": "COFFEE",
    "hs_code": "0901.11.00",
    "product_description": "Arabica Green Coffee Beans Premium Grade",
    "net_mass_kg": 24000.0,
    "plots": [
      {
        "plot_id": "VN-LAMDONG-001",
        "country_code": "VN",
        "geometry": {
          "type": "Polygon",
          "coordinates": [
            [
              [108.4380, 11.9400],
              [108.4420, 11.9400],
              [108.4420, 11.9435],
              [108.4380, 11.9435],
              [108.4380, 11.9400]
            ]
          ]
        },
        "declared_area_ha": 17.5,
        "production_date_start": "2023-10-01",
        "production_date_end": "2023-11-15",
        "producer_name": "Da Lat Arabica Cooperative"
      }
    ],
    "documents": [
      {
        "document_type": "LAND_TITLE",
        "document_id": "LURC-VN-2018-990",
        "country_code": "VN",
        "issuing_authority": "Lam Dong Department of Natural Resources",
        "issue_date": "2018-05-12",
        "expiry_date": "2038-05-12",
        "plot_ids": ["VN-LAMDONG-001"]
      }
    ]
  }'
```

### 2. Execute Solana SPL-USDC Direct Split Settlement

```bash
curl -X POST "http://localhost:8000/api/v1/escrow/solana/settle-eudr" \
  -H "Content-Type: application/json" \
  -d '{
    "job_id": "job_timber_sumatra_01",
    "buyer_wallet": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
    "recipients": [
      {"recipient": "411ksMz9RHYVtVMe6RUUErzZYtrU9zzvkgzswKbqx9qp", "amount": 1000.0, "role": "COOPERATIVE_FARMER"}
    ],
    "attestation": {
      "domain": "EUDR_FOREST_SOLANA",
      "cluster": "mainnet-beta",
      "job_id": "job_timber_sumatra_01",
      "is_valid": true,
      "deforestation_free": true,
      "oracle_pubkey": "774hK5wmk5pStvsh5DH46pYPYYD3ro7tMfz1ASxcbiTK",
      "signature": "41zgMmCsWVKU32Yk8QVNR3fpVrmnWXrguKsHmUTGLmspritarqPJuAXXfREpvAJoNxhWo14U6UQSh6dn9sgukATF"
    }
  }'
```

---

## πŸ›‘οΈ Enterprise 4-Pillar Regulatory Enhancements (2026/2027 Enforcement Ready)

To ensure zero-penalty compliance and streamline global primary producer onboarding, EUDRAgent includes 4 enterprise-grade statutory modules:

### 1. πŸ—ΊοΈ ESRI Shapefile (`.zip`) Multi-Format Bulk Ingestion Engine

* **Pure-Python Parsing**: Zero-dependency unpacking of `.shp`, `.dbf`, and `.prj` files from compressed archives.
* **Autonomous WGS84 Reprojection**: Auto-detects local UTM / Projected Coordinate Systems (EPSG) via `pyproj` and reprojects to WGS84 (EPSG:4326) with topological self-healing.
* **Unified Import**: Seamlessly accepts ESRI Shapefiles (`.zip`), GeoJSON, CSV, KML, and Excel files in a single endpoint.

### 2. πŸ›οΈ EUDR Article 31 Statutory 5-Year WORM Audit Vault

* **5-Year Immutability**: Enforces legal retention requirements (Article 31) using Write-Once-Read-Many (WORM) storage with automated 5-year expiration tagging.
* **Cryptographic Merkle Root**: Generates a tamper-proof SHA-256 Merkle root across all plots, satellite telemetry, land titles, and supplier records.
* **1-Click Customs Inspection Bundle**: Downloadable, pre-compiled statutory ZIP packages (`GET /api/v1/compliance/audit-vault/{id}/download`) ready for EU Competent Authorities (CA).

### 3. πŸ›°οΈ EUDR Article 2(5) Forest Degradation & Plantation Conversion Detector

* **Structural Degradation Engine**: Implements strict statutory definitions for the conversion of Primary Forest & Naturally Regenerating Forest into Commercial Plantations.
* **Sentinel-2 Multi-Spectral Texture Analysis**: Evaluates canopy structure homogeneity, linear planting patterns (tree rows), harvesting tracks, and post-cutoff NDVI variance.
* **Autonomous Decision Logic**: Flags parcels exhibiting structural plantation conversion post-December 31, 2020 as `HIGH_RISK_DEGRADED` to prevent EU border holds.

### 4. πŸ“± Smallholder Offline PWA Field Survey Mode

* **Deep Remote Offline Survey**: Enables local enumerators to log smallholder production plots without internet access.
* **Walking GPS Polygon Logger**: Real-time vertex recording with live Shoelace polygon area calculation and 4ha threshold verification.
* **Offline Indexed Queue & One-Click Sync**: Queues field surveys locally and synchronizes directly with the EUDR compliance engine upon reconnection.

---

## ☁️ Production Cloud Deployment

### Deploy to Google Cloud Run (Seoul `asia-northeast3`)

```powershell
.\deploy_gcp.ps1
```

Automatically packages the container, injects production environment variables (Copernicus CDSE credentials, Multi-Chain RPCs, Solana Treasury Wallet), and deploys to **Google Cloud Run** with automated TLS and CDN acceleration.

---

## πŸ“‹ Regulated Annex I Commodities (EUDR)

EUDRAgent provides automatic classification and compliance verification across all 7 Annex I commodities:

* β˜• **Coffee** (HS Chapter 0901)
* 🍫 **Cocoa** (HS Chapter 1801–1806)
* 🌴 **Oil Palm** (HS Chapter 1511, 1207, 2306, 2905, 3823)
* πŸͺ΅ **Wood & Timber** (HS Chapter 4401–4421, 4701–4707, 4801–4823, 9401, 9403)
* 🌱 **Soya** (HS Chapter 1201, 1208, 1507, 2304)
* 🚲 **Rubber** (HS Chapter 4001, 4005, 4006, 4007, 4008, 4011, 4012)
* πŸ₯© **Cattle / Beef & Leather** (HS Chapter 0102, 0201, 0202, 4101, 4104, 4107)

---

## βš–οΈ Legal & Regulatory Disclaimer

This software assists operators and traders in fulfilling statutory compliance obligations under Regulation (EU) 2023/1115. Operators remain legally responsible for the final submission of Due Diligence Statements to EU competent authorities via the TRACES-NT portal.

---

## πŸ“„ License

Released under the **MIT License**. Copyright &copy; 2026 EUDRAgent.com. All rights reserved.

TDQS

B3.2/5.0

Scored across 41 tools

Disambiguation3/5

Many tools target distinct EUDR objects, but there are overlapping clusters in escrow/payment settlement, dispute resolution, and compliance evaluation. Detailed descriptions help, yet an agent could still confuse tools like eudr_agent_micro_pay, eudr_agent_eip3009_pay, and eudr_solana_settle_escrow, or eudr_arbitrate_agent_escrow and eudr_auto_slash_disputed_escrow.

Naming Consistency4/5

All tool names use the eudr_ prefix and snake_case, with a mostly predictable verb_noun pattern. A few names reverse order or embed modifiers (e.g. eudr_agent_micro_pay, eudr_agent_eip3009_pay), but the convention remains readable and consistent overall.

Tool Count2/5

The server exposes 41 tools, which is excessive for a single MCP server and well above the 3-15 well-scoped range. While the EUDR compliance domain is broad, this many tools increases selection complexity and maintenance burden.

Completeness4/5

Coverage is strong across compliance evaluation, DDS/TRACES generation, customs clearance, satellite checks, registry/VAT verification, and escrow/payment lifecycles. Minor gaps exist around querying or listing existing RFQs, bids, escrows, and DDS statuses, but core workflows are well represented.

Maintenance

ActivityActive
ResponsivenessNo issues