Metadata-Version: 2.4
Name: lexprotocol
Version: 1.0.0
Summary: EU AI Act compliance attestations for AI agents
Author-email: LexProtocol <legal@thelexprotocol.com>
License: MIT
Project-URL: Homepage, https://thelexprotocol.com
Project-URL: Documentation, https://lexprotocol.fly.dev/docs
Project-URL: Repository, https://github.com/lexprotocol/lexprotocol-py
Project-URL: Bug Tracker, https://github.com/lexprotocol/lexprotocol-py/issues
Keywords: eu-ai-act,compliance,attestation,agents,ai,langchain,crewai,autogen,regulation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Internet :: WWW/HTTP
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Provides-Extra: requests
Requires-Dist: requests>=2.28; extra == "requests"
Provides-Extra: httpx
Requires-Dist: httpx>=0.24; extra == "httpx"

# lexprotocol

EU AI Act compliance attestations for AI agents. One line of code.

**Enforcement date: August 2, 2026.**

```bash
pip install lexprotocol
```

## Quick start

```python
from lexprotocol import attest

# Before or after a regulated action, get a compliance attestation
result = attest("credit_decision", "My lending AI system")

print(result.citation)
# → "LexProtocol Attestation LEX-ATT-20260715-a1b2c3 | credit_decision | EU | Inhouselegal.co"

print(result.risk_tier)       # → "high_risk"
print(result.compliant)       # → True
print(result.applicable_articles)  # → ["Article 6", "Article 9", "Annex III"]
```

## Classify risk tier

```python
from lexprotocol import classify

tier = classify("My hiring recommendation system", use_case="employment_screening")
print(tier.risk_tier)  # → "high_risk"
print(tier.basis)      # → "Employment decisions fall under Annex III..."
```

## For AI agent frameworks

### LangChain
```python
from lexprotocol import attest
from langchain.agents import tool

@tool
def make_credit_decision(applicant_data: str) -> str:
    """Make a credit decision with EU AI Act compliance."""
    decision = your_model.predict(applicant_data)
    attestation = attest("credit_decision", "LangChain credit scoring agent")
    return f"{decision}\n\n{attestation.citation}"
```

### CrewAI
```python
from lexprotocol import attest

class ComplianceAgent(Agent):
    def execute_task(self, task):
        result = super().execute_task(task)
        if task.requires_compliance:
            att = attest(task.action_type, self.role)
            result.metadata["attestation"] = att.citation
        return result
```

### AutoGen
```python
from lexprotocol import attest

def compliant_action(action_type, system_desc, action_fn, *args, **kwargs):
    """Wrapper that attests any agent action."""
    attestation = attest(action_type, system_desc)
    result = action_fn(*args, **kwargs)
    return {"result": result, "attestation": attestation.citation}
```

## EU AI Act risk tiers

| Tier | Examples | Requirements |
|------|----------|-------------|
| `prohibited` | Real-time biometric surveillance, social scoring | Cannot be deployed |
| `high_risk` | Credit decisions, hiring, medical devices | Conformity assessment, audit trail required |
| `limited_risk` | Chatbots, deepfakes | Transparency obligations |
| `minimal_risk` | Spam filters, AI games | No specific obligations |

## Configuration

```python
import os
os.environ["LEXPROTOCOL_API"] = "https://lexprotocol.fly.dev"  # default

# Or use the client directly
from lexprotocol import LexProtocolClient
client = LexProtocolClient(api_base="https://lexprotocol.fly.dev")
result = client.attest("credit_decision", "My system")
```

## Zero dependencies

`lexprotocol` uses Python's built-in `urllib` by default. Optionally install `requests` or `httpx` for better performance:

```bash
pip install lexprotocol[requests]
pip install lexprotocol[httpx]
```

## Links

- Homepage: https://thelexprotocol.com
- API docs: https://lexprotocol.fly.dev/docs
- MCP server: https://smithery.ai/servers/chase-wl9l/lexprotocol-mcp
