Skip to main content

Detect when your LLM's behavior has statistically shifted — one line of code to instrument, one Docker container to run.

Project description

argus-sdk

Detect when your LLM's behavior has statistically shifted — one line of code to instrument.


What it does

LLMs change. Model providers silently update weights, swap infrastructure, or adjust safety filters. Your evals pass, but production quietly drifts. Argus catches this.

argus-sdk wraps your existing Anthropic or OpenAI client and captures derived signals from every LLM call — output tokens, latency, finish reason. It ships those signals in the background to Argus, which runs statistical tests (Mann-Whitney U + Bonferroni correction) to detect distribution shifts and alerts you via Slack when drift is confirmed.

No prompt text. No completion text. Derived signals only.


Install

pip install argus-sdk

For OpenAI support:

pip install "argus-sdk[openai]"

Quick start

Cloud (argus-sdk.com)

from argus_sdk import patch
patch(api_key="argus_sk_...")  # defaults to https://argus-sdk.com

import anthropic
client = anthropic.Anthropic()  # automatically instrumented

response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello"}],
)

Self-hosted

docker run -p 4000:4000 -p 3000:3000 -v argus-data:/data ghcr.io/whozpj/argus:latest
from argus_sdk import patch
patch(endpoint="http://localhost:4000")

import anthropic
client = anthropic.Anthropic()

Supported clients

Client Sync Async Streaming
anthropic.Anthropic
anthropic.AsyncAnthropic
openai.OpenAI
openai.AsyncOpenAI

Streaming calls (stream=True) are transparently intercepted — the signal is reported after the stream is exhausted. User code is unchanged.

Note: client.messages.stream() (Anthropic context manager API) is not intercepted.


Explicit mode

Instrument a specific instance instead of all future clients:

import anthropic
from argus_sdk import patch

client = anthropic.Anthropic()
patch(endpoint="https://argus-sdk.com", client=client, api_key="argus_sk_...")

Flush on exit (short scripts & CLIs)

Signals are sent in a background worker thread. For short-lived scripts:

from argus_sdk import patch, flush

patch(api_key="argus_sk_...")

# ... your LLM calls ...

flush()  # blocks until all queued events are sent

What gets captured

Field Example
model claude-sonnet-4-6
provider anthropic
input_tokens 312
output_tokens 87
latency_ms 843
finish_reason stop
timestamp_utc 2026-04-07T14:22:01Z

No prompt text. No completion text.


How drift detection works

The Argus server builds a baseline per model using Welford's online algorithm (ready after 200 events). Every 60 seconds it runs a Mann-Whitney U test on output tokens and latency against the current window. Bonferroni correction controls false positives across multiple signals. A hysteresis state machine fires alerts when drift score exceeds 0.7 and clears when it drops below 0.4 for three consecutive windows.


Self-hosted environment variables

Variable Default Description
ARGUS_ADDR :4000 Server listen address
ARGUS_DB_PATH argus.db SQLite file path (self-hosted)
ARGUS_SLACK_WEBHOOK (empty) Slack webhook URL for alerts

License

MIT

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

argus_sdk-0.2.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

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

argus_sdk-0.2.1-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file argus_sdk-0.2.1.tar.gz.

File metadata

  • Download URL: argus_sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for argus_sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 30cbe0e1ae3a4e907a1a98b947bc1ad3f46f3b2e6c9279405d24dc19619e0c02
MD5 7b76eab1c0d9635055f56f9b11a27468
BLAKE2b-256 f12877ca64fd77a11692c0eef26645b6f060136a1beb7362fe78f87b0aab9ebb

See more details on using hashes here.

File details

Details for the file argus_sdk-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: argus_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for argus_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5eb30a8a97313cd381822ef1fcc45c050c831c9797bbd6ba4153da26b0af17d6
MD5 b1df432f74d9a4ae3cb4a8c300db280f
BLAKE2b-256 821ed2244e6bb1b8a0a41743c5d75305680bd49b2f0d33a12c30d0463e94842f

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