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

Metadata

Release files for moss-edge-classifier 0.1.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 moss-edge-classifier 0.1.0
File Size Uploaded
moss_edge_classifier-0.1.0.tar.gz 16.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for moss-edge-classifier 0.1.0
File Interpreter ABI Platform
moss_edge_classifier-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.5 kB

Release files / moss_edge_classifier-0.1.0.tar.gz

Download URL moss_edge_classifier-0.1.0.tar.gz
Size 16.0 kB
Tags Source
SHA-256 checksum
How to use checksums
1b0facaddb1fcc64ceb9edc08bac99155cae8dbf93a9f727f22506174039dbf6
BLAKE2b-256 checksum
How to use checksums
cb9bd189a01f15456481165d985943c0b1e1971cd0de784f7ce1e3e8077267c6
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 Aug 21, 2026.

Transparency log

Release files / moss_edge_classifier-0.1.0-py3-none-any.whl

Download URL moss_edge_classifier-0.1.0-py3-none-any.whl
Size 15.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df95117195197311e8a4f4694d4ded43d5c68cb0bea9d3fd576fced0bd75f2b5
BLAKE2b-256 checksum
How to use checksums
8ef368c8bb683a9cf1eb2d6899baf1e9355afb6322d612ba107dd0dd487dfec0
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 Aug 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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