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.0.tar.gz (14.6 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.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for argus_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 472b0db99c1e2e32395778938e54c26914ae39c638294d18021386986bffc576
MD5 3d91bb43b7052cb8ec5070388458ad28
BLAKE2b-256 27638c177522d46872fd2f325063261b7a9c8cce8c8f1ca8ec1a49bd2f9fcbc4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for argus_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 825a45c9676194410eba85cc12517c2db3ed7c7bc7ec2e0b7b5f99ab70cf65ae
MD5 d69226bbc2e9d8299cfb4deef7b6be42
BLAKE2b-256 80faca804513022a98c4766261563e3fd351af760eb53a1fa4eff9e380671998

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