Skip to main content

MOSS Edge Classifier

On-device policy evaluation and audit logging for AI agent governance.

Overview

The Edge Classifier enables offline-first AI governance by:

  • Downloading signed policy bundles from MOSS
  • Evaluating policies locally on user devices
  • Classifying data (PII detection, keyword matching)
  • Buffering audit events and syncing to MOSS
  • Operating offline with a configurable grace period
  • Verifying ML-DSA-44 post-quantum signatures

Installation

pip install moss-edge-classifier

Quick Start

from moss_edge_classifier import EdgeClassifier

# Initialize with your customer API key
classifier = EdgeClassifier(
    api_key="cust_key_xyz...",
    base_url="https://api.mosscomputing.com",
    offline_grace_period_hours=24,
)

# Download and verify policy bundle
await classifier.refresh_bundle()

# Evaluate an action
decision = await classifier.evaluate(
    agent_id="agent_123",
    action_type="chat",
    input_text="What is the user's SSN?",
    output_text="I cannot share SSN information.",
    context={"user_id": "user_456"},
)

print(decision.allowed)  # True/False
print(decision.policies_evaluated)  # ['pol_pii_block', 'pol_chat_allow']
print(decision.classifications)  # {'input': ['pii_detected'], 'output': []}

Features

Policy Evaluation

  • Downloads cryptographically-signed policy bundles
  • Evaluates rules locally (no network latency)
  • Handles complex policy conditions (capabilities, data classifications)

Data Classification

  • PII Detection: SSN, credit cards, email, phone numbers (regex-based)
  • Keyword Matching: Custom sensitive terms per organization
  • Extensible classification framework

Offline Mode

  • Continues working when MOSS API is unreachable
  • Configurable grace period (default: 24 hours)
  • Automatic bundle refresh on reconnection

Audit Logging

  • Buffers audit events locally
  • Syncs to MOSS in batches (max 100 per request)
  • Idempotent sync (duplicate detection via envelope_id)
  • Local ML-DSA-44 signatures on audit entries

Post-Quantum Security

  • Verifies bundle signatures using ML-DSA-44
  • Downloads MOSS public keys from /v1/keys/signing
  • Rejects tampered or unsigned bundles

API Reference

EdgeClassifier

class EdgeClassifier:
    def __init__(
        self,
        api_key: str,
        base_url: str = "https://api.mosscomputing.com",
        offline_grace_period_hours: int = 24,
        max_audit_buffer: int = 1000,
    ):
        """Initialize Edge Classifier.

        Args:
            api_key: Customer API key (starts with cust_key_)
            base_url: MOSS API base URL
            offline_grace_period_hours: Hours to operate offline
            max_audit_buffer: Max audit events before forced sync
        """

Methods

refresh_bundle() Downloads the latest policy bundle from MOSS and verifies the signature.

await classifier.refresh_bundle()

evaluate() Evaluates an action against loaded policies.

decision = await classifier.evaluate(
    agent_id="agent_123",
    action_type="chat",
    input_text="...",
    output_text="...",
    context={},
)

Returns EvaluationDecision with:

  • allowed: bool - Whether action is permitted
  • decision: str - "allow", "block", or "require_approval"
  • policies_evaluated: list[str] - Policy IDs checked
  • classifications: dict - Input/output classifications
  • bundle_version: int - Policy bundle version used

sync_audit() Syncs buffered audit events to MOSS.

result = await classifier.sync_audit()
# Returns: {"synced": ["env_001", ...], "failed": [], "chainPosition": 42}

get_revocations() Fetches emergency revocation list from MOSS.

revocations = await classifier.get_revocations()
# Returns: {"revocations": [...], "revocationListId": "rvk_xyz"}

Architecture

┌─────────────────────────────────────────────┐
│ AI Agent Application                         │
│  ┌────────────────────────────────────────┐ │
│  │ EdgeClassifier                          │ │
│  │  • Policy Bundle (cached locally)       │ │
│  │  • Signing Keys (cached)                │ │
│  │  • Audit Buffer (SQLite)                │ │
│  │  • Classification Rules                 │ │
│  └────────────────────────────────────────┘ │
│           ▲                      │           │
│           │ Download bundle      │ Sync audit│
│           │ (signed)             │ (batched) │
└───────────┼──────────────────────┼───────────┘
            │                      │
            │    HTTPS (TLS 1.3)   │
            │                      ▼
┌───────────┴──────────────────────────────────┐
│ MOSS API (https://api.mosscomputing.com)     │
│  • GET /v1/customer/policy-bundles/latest    │
│  • GET /v1/keys/signing                      │
│  • POST /v1/customer/audit/sync              │
│  • GET /v1/customer/policy-revocations       │
└──────────────────────────────────────────────┘

Security Model

  1. Bundle Integrity: All policy bundles are signed with ML-DSA-44
  2. Key Rotation: Automatic key refresh from MOSS signing key endpoint
  3. Tamper Detection: Rejects bundles with invalid signatures
  4. Offline Safety: Grace period prevents indefinite offline operation
  5. Audit Integrity: Local signatures on audit entries before sync

Configuration

Environment variables:

MOSS_API_KEY=cust_key_...
MOSS_BASE_URL=https://api.mosscomputing.com
MOSS_OFFLINE_GRACE_HOURS=24
MOSS_MAX_AUDIT_BUFFER=1000
MOSS_CACHE_DIR=~/.moss/cache

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

# Type checking
mypy moss_edge_classifier/

# Linting
ruff check moss_edge_classifier/

License

Proprietary - MOSS Computing, Inc.

Support

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moss_edge_classifier-0.1.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moss_edge_classifier-0.1.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file moss_edge_classifier-0.1.0.tar.gz.

File metadata

  • Download URL: moss_edge_classifier-0.1.0.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for moss_edge_classifier-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1b0facaddb1fcc64ceb9edc08bac99155cae8dbf93a9f727f22506174039dbf6
MD5 3acf60ff2d84eb520bc49cea8d19b30f
BLAKE2b-256 cb9bd189a01f15456481165d985943c0b1e1971cd0de784f7ce1e3e8077267c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for moss_edge_classifier-0.1.0.tar.gz:

Publisher: publish.yml on mosscomputing/moss-edge-classifier

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moss_edge_classifier-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for moss_edge_classifier-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df95117195197311e8a4f4694d4ded43d5c68cb0bea9d3fd576fced0bd75f2b5
MD5 77e238153df49011c7d69b99e86cbc5e
BLAKE2b-256 8ef368c8bb683a9cf1eb2d6899baf1e9355afb6322d612ba107dd0dd487dfec0

See more details on using hashes here.

Provenance

The following attestation bundles were made for moss_edge_classifier-0.1.0-py3-none-any.whl:

Publisher: publish.yml on mosscomputing/moss-edge-classifier

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page