Skip to main content

Python SDK for Watchtower AI - Data Drift & Quality Monitoring

Project description

Watchtower AI SDK

The official Python client for Watchtower AI.

Watchtower AI is a comprehensive observability platform for your data pipelines and machine learning models. It helps you detect data drift, monitor data quality, and evaluate LLM performance in real-time.


🚀 Key Features

  • Data Drift Detection: Automatically detect distribution shifts in your tabular data (KS tests, PSI, etc.).
  • Data Quality Monitoring: Validate schema, check for nulls, duplicates, and ranges.
  • LLM Observability: Monitor token usage, toxicity, and response quality for your GenAI applications.
  • Async Logging: Low-latency, non-blocking API calls designed for high-throughput production environments.
  • Cloud Ready: Optimized for deployment on Render, AWS, and other cloud providers.

📦 Installation

pip install watchtower-sdk

⚙️ Configuration

The SDK is designed to be Zero-Config in production. It automatically reads from environment variables.

Environment Variables (Recommended)

Set these in your local terminal or your cloud provider's dashboard (e.g., Render Environment Variables):

# Your Project API Key (Required)
export WATCHTOWER_API_KEY="your_project_api_key_here"

# Your Watchtower Backend URL (Required for Cloud)
# Defaults to http://localhost:8000 if not set
export WATCHTOWER_API_URL="https://your-watchtower-app.onrender.com"

🛠️ Usage Examples

1. Monitoring Tabular Data (ML Models)

Perfect for validating training data or inference batches.

import pandas as pd
from watchtower.monitor import WatchtowerInputMonitor

# Initialize (reads env vars automatically)
monitor = WatchtowerInputMonitor(project_name="Credit Scoring v1")

# Load your production data
df = pd.read_csv("inference_batch.csv")

# Log data to Watchtower
# This sends the data asynchronously to your backend
response = monitor.log(df)

print(f"Logged {len(df)} rows. Status: {response}")

2. Monitoring LLMs (GenAI)

Track prompts, responses, and token usage.

from watchtower.llm_monitor import WatchtowerLLMMonitor

# Initialize
llm_monitor = WatchtowerLLMMonitor(project_name="Customer Support Bot")

# Log an interaction
llm_monitor.log(
    input_text="How do I reset my password?",
    output_text="You can reset your password by clicking 'Forgot Password' on the login page.",
    metadata={
        "model": "gpt-4",
        "latency_ms": 450,
        "user_id": "user_123"
    }
)

☁️ Cloud Deployment (Render/Railway)

If you are hosting your own Watchtower Backend on Render:

  1. Deploy Backend: Follow the Deployment Guide.
  2. Get URL: Copy your backend URL (e.g., https://my-app.onrender.com).
  3. Set Env Var: Set WATCHTOWER_API_URL to that URL in your production environment.
  4. Run: Your code works exactly the same as it did locally!

🛡️ License

This project is licensed under the MIT License.

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

watchtower_sdk-0.1.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

watchtower_sdk-0.1.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file watchtower_sdk-0.1.1.tar.gz.

File metadata

  • Download URL: watchtower_sdk-0.1.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for watchtower_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b8995f4da3041c0218a9f330c6dccb014f84e23edc3c339dbb6673f48c21d11b
MD5 8488f313baddb7df3496a511f8c3d8db
BLAKE2b-256 57fbbbea689759a4d27934a78287eb91fb93244a329876f44315eeb7a5f408e1

See more details on using hashes here.

File details

Details for the file watchtower_sdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: watchtower_sdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for watchtower_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ce922b81e9ff505ae094fff526a3be111b52052b7ce5244ed38fc207b96e4999
MD5 51fa800f48972e10ec82a069710405db
BLAKE2b-256 0a595f6953a183968ebfba3ab3ed5b999dcb71b6ae182ff4227a7d0a9a4f6df1

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