Metadata-Version: 2.4
Name: akhu-observer
Version: 0.1.0
Summary: AKHU Observer SDK — Evidence infrastructure adapter for AI systems
License: SEE LICENSE IN ROOT
Keywords: ai,audit,compliance,eu-ai-act,evidence,observability
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
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.10
Provides-Extra: anthropic
Requires-Dist: anthropic>=0.20.0; extra == 'anthropic'
Provides-Extra: dev
Requires-Dist: hypothesis>=6.0; extra == 'dev'
Requires-Dist: pytest-timeout>=2.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Provides-Extra: openai
Requires-Dist: openai>=1.0.0; extra == 'openai'
Description-Content-Type: text/markdown

# akhu-observer (Python)

𓅂 **AKHU Observer SDK** — Evidence infrastructure adapter for AI systems.

Zero-dependency Python SDK for connecting AI applications to the AKHU evidence ledger.

## Install

```bash
pip install akhu-observer
```

With provider support:

```bash
pip install "akhu-observer[openai]"      # OpenAI wrapper
pip install "akhu-observer[anthropic]"   # Anthropic wrapper
```

## Quick Start

### Direct Client

```python
from akhu_observer import AkhuClient

client = AkhuClient(url="http://akhu-api:3000", channel_id="my-system")
client.observe("DOCUMENT_PROCESSED", {"doc_id": "abc-123", "pages": 12})
```

### OpenAI Wrapper

```python
from openai import OpenAI
from akhu_observer import observe_openai

client = observe_openai(OpenAI(), akhu_url="http://akhu-api:3000")
response = client.chat.completions.create(model="gpt-4o", messages=[...])
# Observation sent automatically — response unmodified
```

### Anthropic Wrapper

```python
from anthropic import Anthropic
from akhu_observer import observe_anthropic

client = observe_anthropic(Anthropic(), akhu_url="http://akhu-api:3000")
response = client.messages.create(model="claude-sonnet-4-20250514", max_tokens=1024, messages=[...])
```

### Environment Variables

```bash
export AKHU_URL="http://akhu-api:3000"
export AKHU_CHANNEL_ID="my-channel"
```

```python
# No config needed — reads from environment
client = AkhuClient()
```

## Architecture

- **Zero runtime dependencies** — uses only Python stdlib (`http.client`, `threading`, `json`)
- **Fail-open** — observation failures never affect the observed system
- **Privacy by default** — content redacted unless explicitly opted in
- **Security always** — credentials stripped even with `capture_content=True`
- **Thread-safe** — safe to use from any thread, background flush via daemon threads

Full API reference: [OBSERVER-SDK-REFERENCE.md](../../docs/OBSERVER-SDK-REFERENCE.md)

## Development

```bash
cd packages/observer-python
pip install -e ".[dev]"
pytest
pytest tests/invariants/       # Property-based tests
pytest tests/adversarial/      # Injection/attack resistance
```
