Metadata-Version: 2.4
Name: pramiti-flight-recorder
Version: 0.2.1
Summary: Standalone AI agent action recorder with OCSF export and compliance reporting
License: MIT
Project-URL: Homepage, https://getpramiti.com
Project-URL: Repository, https://github.com/pramiti-labs/epistom
Keywords: ai,agent,audit,compliance,ocsf,epistom,pramiti
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: sqlalchemy>=2.0
Requires-Dist: alembic>=1.13
Requires-Dist: cryptography>=42.0
Provides-Extra: postgres
Requires-Dist: psycopg2-binary; extra == "postgres"
Dynamic: license-file

# pramiti-flight-recorder

Standalone AI agent action recorder with Ed25519-signed, hash-chained records, OCSF Class 6003 export for SIEM integration, and compliance reporting for EU AI Act, SOC 2, and NIST AI RMF. Works with SQLite (local/dev) or PostgreSQL (production).

## Install

```bash
pip install pramiti-flight-recorder

# For PostgreSQL support:
pip install pramiti-flight-recorder[postgres]
```

## Quick Start

```python
from pramiti_flight_recorder import FlightRecorder

# SQLite by default (sqlite:///flight_recorder.db)
recorder = FlightRecorder()

# Or use PostgreSQL:
# recorder = FlightRecorder("postgresql://user:pass@localhost/mydb")

record_id = recorder.record(
    agent_id="agent-1",
    action="salesforce.update",
    verb="update",
    payload={"id": "C-123", "field": "email"},
    decision="allow",
    rationale="Customer requested email change",
)
```

## OCSF Export

Export records in OCSF Class 6003 (API Activity) format for Splunk, Sentinel, Datadog, or any SIEM:

```python
ocsf_events = recorder.export_ocsf()
# Also available: export_json(), export_csv()
```

## Compliance Reports

Generate compliance reports against three frameworks:

```python
report = recorder.compliance_report(
    framework="eu_ai_act",    # or "soc2" or "nist_ai_rmf"
    period_start="2026-01-01",
    period_end="2026-12-31",
)
print(f"Score: {report.score}, Status: {report.status}")
for check in report.checks:
    print(f"  [{check.id}] {'PASS' if check.passed else 'FAIL'}: {check.description}")
```

| Framework | Checks |
|-----------|--------|
| `eu_ai_act` | Article 13 (transparency/rationale), Article 14 (human oversight), Article 17 (risk management) |
| `soc2` | CC6.1 (logical access/constraints on denials), CC7.2 (monitoring coverage) |
| `nist_ai_rmf` | GOVERN 1.1 (signing key exists), MANAGE 2.4 (escalation workflow active) |

## Ed25519 Signing

All records are cryptographically signed with Ed25519. Signing keys are auto-generated on first use. Set `FR_SIGNING_PRIVATE_KEY` env var to persist the private key across restarts.

Records are hash-chained: each record stores the SHA-256 hash of the previous record for the same agent, forming a tamper-evident chain.

```python
# Verify a record's signature
is_valid = recorder.verify(record_id)
```

## API

| Export | Description |
|--------|-------------|
| `FlightRecorder` | Core recorder. Methods: `record()`, `list()`, `get()`, `verify()`, `export_json()`, `export_csv()`, `export_ocsf()`, `compliance_report()`. |
| `ComplianceReport` | Dataclass: `framework`, `period_start`, `period_end`, `score`, `status`, `checks`. |
| `ComplianceCheck` | Dataclass: `id`, `description`, `passed`, `value`, `threshold`, `detail`. |
| `FrRecord` | SQLAlchemy model for action records (table: `fr_records`). |
| `FrSigningKey` | SQLAlchemy model for Ed25519 signing keys (table: `fr_signing_keys`). |
| `FrComplianceReport` | SQLAlchemy model for persisted compliance reports (table: `fr_compliance_reports`). |

## License

MIT -- Pramiti Labs
