Skip to main content

AICompliant Discovery SDK — automatic AI system detection via explicit wrapping

Project description

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

pip install aicompliant-discover

Quick Start

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

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

Google GenAI

model = discovery.wrap_google(genai.GenerativeModel("gemini-2.5-flash"))
response = model.generate_content("Hello")

Any Provider (generic trace)

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

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:

# 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aicompliant_discover-2.0.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aicompliant_discover-2.0.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file aicompliant_discover-2.0.0.tar.gz.

File metadata

  • Download URL: aicompliant_discover-2.0.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for aicompliant_discover-2.0.0.tar.gz
Algorithm Hash digest
SHA256 c95181324529b5319f02b020f02c2a6b98e84a849576c2a51eeb292aef4e2ef1
MD5 c38c742a840b2eb769e8d0fd62b4620c
BLAKE2b-256 2f63125005d2bc0d14dcd9c42aebdf23852a9cbf2ab4fcb8c07a0ade728e35d2

See more details on using hashes here.

File details

Details for the file aicompliant_discover-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aicompliant_discover-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59b1ffb1fc703e56135a35b9855dcc742ef62210402ff4e5d4efc14f274ca9b9
MD5 8173b9674211196e88cb9c82cdde9b93
BLAKE2b-256 cad61e452f83e0ce572c42282e3f119195ad9b635146fa7465306563125000f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page