Metadata-Version: 2.4
Name: aicompliant-discover
Version: 2.0.0
Summary: AICompliant Discovery SDK — automatic AI system detection via explicit wrapping
Author-email: AICompliant <support@aicompliant.ai>
License: MIT
Project-URL: Homepage, https://aicompliant.ai
Project-URL: Documentation, https://aicompliant.ai/dashboard/api-docs
Project-URL: Repository, https://github.com/aicompliant/discover-python
Keywords: ai,compliance,discovery,monitoring,anthropic,openai,google
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.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: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# aicompliant-discover v2.0.0

Enterprise-grade AI system auto-discovery SDK for Python.

**v2.0.0** uses explicit wrapping (no monkey-patching, no global state mutation).

## Installation

```bash
pip install aicompliant-discover
```

## Quick Start

```python
from aicompliant_discover import AIDiscovery
import anthropic

discovery = AIDiscovery(
    api_key="dk_your_api_key",
    endpoint="https://aicompliant.ai/v1/discovery/llm-usage",
)

# Wrap your Anthropic client — automatic usage tracking
client = discovery.wrap_anthropic(anthropic.Anthropic())

msg = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
)
# Usage automatically reported to AICompliant!
```

## Supported Providers

### Anthropic
```python
client = discovery.wrap_anthropic(anthropic.Anthropic())
# or async:
client = discovery.wrap_anthropic(anthropic.AsyncAnthropic())
```

### Google GenAI
```python
model = discovery.wrap_google(genai.GenerativeModel("gemini-2.5-flash"))
response = model.generate_content("Hello")
```

### Any Provider (generic trace)
```python
result = discovery.trace(
    "My System", "OpenAI",
    lambda: openai.chat.completions.create(...),
    model="gpt-4",
    extract_usage=lambda r: {
        "input_tokens": r.usage.prompt_tokens,
        "output_tokens": r.usage.completion_tokens,
    },
)
```

### Manual Reporting
```python
discovery.capture(
    system_name="Resume Screener",
    provider="Anthropic",
    model="claude-sonnet-4-20250514",
    input_tokens=500,
    output_tokens=1500,
)
```

## Configuration

| Parameter | Env Var | Description |
|-----------|---------|-------------|
| `api_key` | `AIC_API_KEY` | AICompliant API key |
| `endpoint` | `AIC_ENDPOINT` | Discovery webhook URL |
| `system_name` | `AIC_SYSTEM_NAME`, `SERVICE_NAME`, `APP_NAME` | Default system name |
| `flush_size` | — | Events before auto-flush (default: 50) |
| `flush_interval` | — | Seconds between flushes (default: 30) |

## v2.0.0 Migration from v1.0.0

v1.0.0 used monkey-patching (`discovery.init()`). v2.0.0 uses explicit wrapping:

```python
# v1.0.0 (deprecated)
discovery.init()
client = anthropic.Anthropic()

# v2.0.0
client = discovery.wrap_anthropic(anthropic.Anthropic())
```

No global state is modified. Multiple discovery instances can coexist.
