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, one Docker container to run.


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 a self-hosted Argus server, 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

Quick start

1. Run the Argus server

docker run -p 4000:4000 -p 3000:3000 -v argus-data:/data ghcr.io/whozpj/argus:latest

Dashboard: http://localhost:3000
Ingest API: http://localhost:4000

2. Instrument your client

Auto-mode — instruments all clients created after patch():

from argus_sdk import patch
patch(endpoint="http://localhost:4000")

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

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

Explicit mode — instrument a specific instance:

import anthropic
from argus_sdk import patch

client = anthropic.Anthropic()
patch(endpoint="http://localhost:4000", client=client)

Both OpenAI and Anthropic sync clients are supported.


Flush on exit (short scripts & CLIs)

By default, signals are sent in a background worker thread and flushed automatically when your process exits. For short-lived scripts where you want to guarantee delivery before exit:

from argus_sdk import patch, flush

patch(endpoint="http://localhost:4000")

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


Environment

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

Self-hosted

Argus is fully self-hosted. No data leaves your infrastructure. The server is a single Go binary backed by SQLite, bundled with the Next.js dashboard into one Docker image.


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.1.2.tar.gz (7.7 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.1.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: argus_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 7.7 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.1.2.tar.gz
Algorithm Hash digest
SHA256 62d96af663c96e182e741217c493340c518babe6f3926077d502a47ae18890b3
MD5 0a821aa75169ef094c94e943fbf94c25
BLAKE2b-256 5d11efc9c5b029a8bba9a77b2606c69a3742c036ad8575769ec0fbf080ca2649

See more details on using hashes here.

File details

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

File metadata

  • Download URL: argus_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.9 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.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3c605bb9e6ec1ef9982b527bd87924a4272893cacc797647d44bf32398306c47
MD5 bff3807a1e4ceb32121c83d4a5595380
BLAKE2b-256 a085a5745dd42e48c8f25ccee27ee919b899a66719db64b4edd8aacb2ba9c6d2

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