Metadata-Version: 2.4
Name: liebreich
Version: 1.0.0
Summary: Zero-bloat Python SDK, CLI, and AI Agent Tool Adapters (OpenAI, Anthropic, LangChain, CrewAI) for Liebreich Software's deterministic B2B enrichment, EU compliance, and Ed25519 proof-carrying attestation APIs.
Author-email: Liebreich Software <support@liebreichsoftware.com>
License: MIT
Project-URL: Homepage, https://liebreichsoftware.com/agents/
Project-URL: Documentation, https://github.com/Liebreich-Software/liebreich-python#readme
Project-URL: Repository, https://github.com/Liebreich-Software/liebreich-python
Project-URL: Bug Tracker, https://github.com/Liebreich-Software/liebreich-python/issues
Project-URL: MCP Server, https://github.com/Liebreich-Software/liebreich-mcp-compliance
Keywords: ai-agents,b2b-enrichment,clearbit-alternative,compliance,dora,ed25519,gdpr,langchain,mcp,nis2,openai-agents,wcag,xrechnung
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
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: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: crypto
Requires-Dist: cryptography>=42.0.0; extra == "crypto"
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: cryptography>=42.0.0; extra == "dev"
Dynamic: license-file

# `liebreich` — Official Python SDK & AI Agent Tools (`v1.0.0`)

[![WCAG 2.2 AA · Liebreich](https://liebreichsoftware.com/api/v1/badge.svg?domain=liebreichsoftware.com&kind=bfsg)](https://liebreichsoftware.com/verify/?domain=liebreichsoftware.com)
[![Cyber Hygiene · Liebreich](https://liebreichsoftware.com/api/v1/badge.svg?domain=liebreichsoftware.com&kind=cyber)](https://liebreichsoftware.com/verify/?domain=liebreichsoftware.com)
[![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-3776AB?style=flat-square&logo=python&logoColor=white)](https://github.com/Liebreich-Software/liebreich-python)
[![Dependencies: Zero](https://img.shields.io/badge/dependencies-zero_stdlib_only-16a34a?style=flat-square)](pyproject.toml)

**Zero-bloat, fully typed Python SDK, CLI, and AI Agent Tool Adapters** for **[Liebreich Software](https://liebreichsoftware.com)**'s deterministic B2B enrichment, EU compliance, and **Ed25519 Proof-Carrying Attestation** engines.

Replace brittle headless scrapers and manual multi-vendor compliance spreadsheets with **zero mandatory dependencies** (pure Python stdlib `urllib`), built-in **OpenAI / Anthropic / LangChain / CrewAI** tool adapters, automatic **`HTTP 402` & `X-Liebreich-Credits-Remaining`** prepaid wallet telemetry, and **offline cryptographic Ed25519 verification**.

---

## Install (Zero Mandatory Dependencies)

```bash
pip install git+https://github.com/Liebreich-Software/liebreich-python.git
```

Optional: enable **offline local Ed25519 signature verification** against `/.well-known/jwks.json` (zero data leaves your machine):

```bash
pip install "liebreich[crypto] @ git+https://github.com/Liebreich-Software/liebreich-python.git"
```

---

## 1. Quick Start (`LiebreichClient`)

Works immediately with **zero signup** on the public free tier (`8 req/min`), or pass a **`€19` Prepaid Wallet key** (`500` Pro calls = `€0.038/call`, `120 req/min`, never expires, zero subscription) via `LIEBREICH_API_KEY`:

```python
from liebreich import LiebreichClient, LiebreichPaymentRequiredError

client = LiebreichClient()  # or LiebreichClient(api_key="lb_live_...")

# 1. Global B2B Company, Tech-Stack (up to 75 fingerprints), GLEIF LEI/VAT & Live ATS Hiring Enrichment
company = client.enrich_company("stripe.com")
print(company["companyProfile"]["name"], company["hiring"]["hiringVelocityBand"])

# 2. 4-Pillar 360° EU Website Legal & Security Audit (GDPR + WCAG/BFSG + Imprint + Cyber)
audit = client.audit_website_360("https://liebreichsoftware.com")
print(audit["overallScore"], audit["overallGrade"])

# 3. Cryptographically Verify the Attached Ed25519 Proof (Online or Strictly Offline)
check = client.verify_attestation(audit)            # via POST /api/v1/verify-attestation
offline = client.verify_attestation(audit, offline=True)  # via /.well-known/jwks.json
assert check["valid"] and offline["valid"]

# 4. Wallet Telemetry (automatically parsed from X-Liebreich-Credits-Remaining)
print("Credits remaining:", client.credits_remaining)
```

---

## 2. Drop-In AI Agent Framework Adapters (OpenAI, Anthropic, LangChain, CrewAI)

Zero framework lock-in — export standard JSON tool schemas and dispatch calls safely with built-in **`HTTP 402` / `HTTP 429` graceful agent recovery**:

### OpenAI Chat Completions / Agents SDK
```python
from liebreich import LiebreichClient, agent_tools

client = LiebreichClient()
tools = agent_tools.openai_tools()  # or agent_tools.openai_responses_tools()

# Pass `tools` to client.chat.completions.create(model="...", messages=..., tools=tools)
# Then execute any model tool_call cleanly:
result = agent_tools.dispatch_tool_call(
    client,
    tool_name="enrich_b2b_company",
    arguments='{"domain": "sap.com"}',
    auto_checkout_on_402=True,  # automatically initiates €19 wallet top-up if credits hit 0
)
```

### Anthropic Claude Tool Use
```python
from liebreich import LiebreichClient, agent_tools

client = LiebreichClient()
tools = agent_tools.anthropic_tools(
    include=["enrich_b2b_company", "audit_nis2_supplier", "verify_attestation"]
)
# Pass `tools` directly to anthropic.Anthropic().messages.create(..., tools=tools)
```

### LangChain / LangGraph & CrewAI
```python
from liebreich import LiebreichClient, agent_tools

client = LiebreichClient()
lc_tools = agent_tools.langchain_tools(client)  # returns StructuredTool if langchain_core is installed
cr_tools = agent_tools.crewai_tools(client)     # returns BaseTool if crewai is installed
```

---

## 3. Headless AI Agent Commerce (`€19` Prepaid Wallet — Zero Forms)

```python
from liebreich import LiebreichClient, LiebreichPaymentRequiredError

client = LiebreichClient(api_key="lb_live_existing_key")

try:
    dossier = client.audit_nis2_supplier("deutsche-boerse.com")
except LiebreichPaymentRequiredError:
    # Step 1: Mint 1-tap Stripe approval link (€19 = 500 Pro calls, never expires)
    checkout = client.start_agent_checkout(product_id="agent-credits-19")
    print("Approve payment here:", checkout["approvalUrl"])

    # Step 2: After human 1-tap approval, claim live key directly into client memory
    claimed = client.claim_agent_purchase(checkout["sessionId"], checkout["claimToken"])
    # `client.api_key` is automatically updated when `apiKey` is returned!
```

---

## 4. Built-in `liebreich` CLI

```bash
liebreich enrich stripe.com
liebreich audit https://example.com --json > report.json
liebreich verify report.json --offline
liebreich bfsg https://example.com
liebreich gdpr https://example.com
liebreich nis2 deutsche-boerse.com --hint 529900G3SW56SHYNPR95
liebreich vat IT00743110157
liebreich cve CVE-2021-44228
liebreich erechnung ./xrechnung-3.0.xml
liebreich tenders --country DE --q cyber
liebreich wallet agent-credits-19
liebreich tools-schema --format openai
```

---

## 5. Complete Endpoint Coverage

| Method (`LiebreichClient`) | Endpoint | Ed25519 Proof | What It Does |
|---|---|---|---|
| `enrich_company(domain)` | `POST /api/v1/company-enrich` | Yes | 4-in-1 B2B company, tech stack (up to 75 fingerprints), LEI/VAT, contacts & ATS hiring velocity |
| `audit_website_360(url)` | `POST /api/v1/website-360-check` | Yes | 4-pillar GDPR + WCAG/BFSG + Imprint + Cyber audit |
| `audit_bfsg(url)` | `POST /api/v1/bfsg-check` | Yes | 26-rule WCAG 2.2 AA / EAA / § 14 BFSG auditor with HTML fixes |
| `audit_gdpr(url)` | `POST /api/v1/dsgvo-check` | Yes | GDPR / § 25 TDDDG pre-consent cookies, Google Fonts & US trackers |
| `audit_nis2_supplier(domain)` | `POST /api/v1/nis2-supplier-check` | Yes | 4-layer NIS2 (§ 30 BSIG) & EU DORA supplier KYB dossier |
| `validate_erechnung(payload)` | `POST /api/v1/erechnung-check` | Yes | XRechnung 3.0 (UBL/CII) & ZUGFeRD EN 16931 validator (RAM-only) |
| `audit_domain(domain)` | `POST /api/v1/domain-audit` | — | RDAP, SPF 10-lookup, DMARC, CAA, TLS & HTTP security headers |
| `extract_impressum(domain)` | `POST /api/v1/impressum-check` | — | DACH § 5 DDG Impressum, CEO, VAT & Handelsregister extractor |
| `verify_vat_lei(query)` | `POST /api/v1/vat-lei-check` | — | Official EU Commission VIES VAT & GLEIF v1 ISO-17442 LEI |
| `triage_cve(cve_id)` | `POST /api/v1/cve-triage` | — | CISA KEV + FIRST EPSS + NIST NVD SLA patch triage |
| `list_tenders(...)` | `GET /api/v1/tenders` | — | Filterable pan-EU TED v3 & German DÖE public procurement feed |
| `verify_attestation(doc)` | `POST /api/v1/verify-attestation` | — | Online or offline (`/.well-known/jwks.json`) Ed25519 proof verifier |
| `start_agent_checkout(...)` | `POST /api/v1/agent/checkout` | — | Headless 1-tap Stripe checkout (€19 / 500 Pro calls) |
| `claim_agent_purchase(...)` | `POST /api/v1/agent/claim` | — | Exchange paid session + claim token for live `lb_live_...` key |

---

## Ecosystem & Links

- **Remote MCP Server & Node CLI:** [`Liebreich-Software/liebreich-mcp-compliance`](https://github.com/Liebreich-Software/liebreich-mcp-compliance) (`https://liebreichsoftware.com/mcp`)
- **CI/CD GitHub Action Gate:** [`Liebreich-Software/eu-compliance-action`](https://github.com/Liebreich-Software/eu-compliance-action)
- **Open Compliance Benchmarks (190 German Corporations & Banks, CC-BY-4.0):** [`Liebreich-Software/german-corporate-compliance-benchmarks`](https://github.com/Liebreich-Software/german-corporate-compliance-benchmarks)
- **Public Ed25519 JWKS:** <https://liebreichsoftware.com/.well-known/jwks.json>
- **Interactive Verifier:** <https://liebreichsoftware.com/verify/>
- **Pricing (€19 Prepaid Wallet / €49/mo API Pro):** <https://liebreichsoftware.com/pricing/>

## License

MIT © [Liebreich Software](https://liebreichsoftware.com)
