Skip to main content

AI-assisted reverse proxy core: anomaly detection, adaptive routing, traffic shaping, observability.

Project description

ai-proxy-core

PyPI version Python versions License CI

ai-proxy-core is a Python reverse proxy that adds AI-driven decision logic for routing, anomaly detection, and adaptive traffic shaping.

This is a foundational library for building:

  • AI-powered API gateways
  • fraud/anomaly-aware reverse proxies
  • inference traffic routers
  • intelligent load balancers

MVP Features

  • Reverse proxy with backend pools
  • Adaptive backend scoring based on:
    • latency
    • active connections
    • error rate
  • Basic anomaly detection (moving average / z-score)
  • Circuit breaker auto-disable for failing backends
  • Prometheus metrics
  • Connection pooling (reused httpx.AsyncClient)
  • Graceful shutdown with cleanup hooks
  • Configurable request timeout per proxy instance

Quickstart

pip install -e .
ai-proxy run -c examples/config.yml

Test:

curl http://localhost:9200/
curl http://localhost:9200/metrics

Changelog

0.1.1 (2025-XX-XX)

  • Migrated build system to hatchling
  • Added connection pooling via module-level httpx.AsyncClient
  • Added graceful shutdown (startup/shutdown events in FastAPI app)
  • Added logging across proxy, app, and CLI modules
  • Added ProxyConfig with configurable timeout_seconds
  • Wired window_size from config to ZScoreDetector
  • Added --log-level CLI option
  • Fixed bare except in app.py (returns JSONResponse 502)
  • Expanded test suite (backend, balancer, config, proxy tests)
  • Added ruff linting configuration
  • Added CI workflow (GitHub Actions)
  • Added LICENSE and .gitignore

0.1.0 (Initial release)

  • Reverse proxy with backend pools
  • Adaptive backend scoring
  • Z-score anomaly detection
  • Circuit breaker
  • Prometheus metrics

Roadmap

  • Plug-in ML models (sklearn/onnx)
  • LLM-based WAF rules generation
  • Token bucket rate limiting
  • Geo routing
  • Request classification + prioritization
  • Web dashboard

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

kubenew_ai_proxy-0.1.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

kubenew_ai_proxy-0.1.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for kubenew_ai_proxy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f147826390c9fb54991993326273d777a864be42c90820d7ac3cb328516b6be7
MD5 fee71a29127ef43e424e1359db753585
BLAKE2b-256 422b46aa643789733fd4a2611fe994214eb92bec98c7f8a8d59a390eb92daeb6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kubenew_ai_proxy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5bdea535cca331b03a0c016969a858b4d50d61e201d676733920aed8b5913dd3
MD5 c3144e4335467b492506ddfa09158a6b
BLAKE2b-256 3aacc33daa53f52926aa51a8259b0741b011bfc36adf06191fee4fe849636f73

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