█

AI/TLDR

मुझे पिलाएं कॉफ़ी
मुझे एक कॉफ़ी पिलाएँ

Invariant Gateway

एक LLM प्रॉक्सी जो दिखाती है और डीबग करने देती है कि आपके AI एजेंट क्या कर रहे हैं

Guardrails & Securityओपन सोर्स
भाषा
Python
लाइसेंस
Apache-2.0
संक्षेप में

Invariant Gateway क्या है?

Invariant Gateway एक LLM प्रॉक्सी जो दिखाती है और डीबग करने देती है कि आपके AI एजेंट क्या कर रहे हैं. यह Evaluation & Production Ops टूल्स की Guardrails & Security श्रेणी में आता है; ओपन सोर्स है, Python में लिखा गया है और Apache-2.0 लाइसेंस के तहत है। शुरू करने के लिए: अपने क्लाइंट को Gateway की ओर भेजें.

सारांश

Invariant Gateway, Invariant Labs की एक ओपन सोर्स सेवा है जो आपके AI एजेंट और उसके LLM प्रोवाइडर के बीच बैठती है। यह एक प्रॉक्सी की तरह काम करती है: OpenAI, Anthropic या Gemini को सीधे कॉल करने के बजाय आपका क्लाइंट अपना base URL Gateway की ओर कर देता है, जो अनुरोध को आगे भेजती है और जो हुआ उसे रिकॉर्ड करती है। ट्रेस Invariant Explorer में सेव होते हैं, ताकि आप उन्हें बाद में देख सकें।

यह उन डेवलपर्स के लिए है जो agentic systems बना रहे हैं और रनटाइम पर देखना चाहते हैं कि उनके एजेंट असल में क्या भेज और प्राप्त कर रहे हैं। चूँकि यह LLM स्तर पर काम करता है, यह एजेंट का लॉजिक दोबारा लिखे बिना सामान्य chat completions, tool calls और computer-use interactions को कैप्चर कर लेता है।

एक guardrail और observability टूल के रूप में Gateway का फोकस विज़िबिलिटी और debugging पर है। यह standard I/O, Server-Sent Events और Streamable HTTP पर MCP protocol को सपोर्ट करता है और streaming responses को आगे भेजता है, इसलिए यह उन एजेंट्स के सामने आसानी से फिट होता है जो model APIs और MCP सर्वर, दोनों से बात करते हैं।

यह क्या करता है

  • एक लाइन में सेटअप: अपने LLM क्लाइंट का base URL Gateway की ओर करें और एक header जोड़ें, कोड दोबारा लिखने की ज़रूरत नहीं
  • अलग-अलग प्रोवाइडर्स में डीबगिंग और विश्लेषण के लिए LLM स्तर पर कॉल इंटरसेप्ट करता है
  • सिर्फ़ सामान्य chat ही नहीं, tool calling और computer-use interactions भी कैप्चर करता है
  • standard I/O, Server-Sent Events और Streamable HTTP पर MCP protocol सपोर्ट
  • OpenAI, Anthropic, Gemini और दूसरे प्रोवाइडर्स को अनुरोध भेजता है और responses stream करता है
  • Invariant Explorer में runtime traces सेव और व्यवस्थित करता है

शुरू करें

Gateway इस्तेमाल करने का सबसे तेज़ तरीका hosted Explorer endpoint है: अपना मौजूदा क्लाइंट रखें, बस उसका base URL बदलें और Invariant-Authorization header जोड़ें। नीचे दिए उदाहरण में Anthropic क्लाइंट इस्तेमाल हुआ है।

अपने क्लाइंट को Gateway की ओर भेजें

अपने Anthropic (या OpenAI/Gemini) क्लाइंट को Gateway base URL के ज़रिए अनुरोध भेजने के लिए कॉन्फ़िगर करें, और Invariant-Authorization header में अपनी Invariant API key शामिल करें। dataset name को अपने नाम से बदलें; अगर वह मौजूद नहीं है तो वह अपने-आप बन जाएगा।

pythonpython
from httpx import Client
from anthropic import Anthropic

client = Anthropic(
    http_client=Client(
        headers={
            "Invariant-Authorization": "Bearer your-invariant-api-key"
        },
    ),
    base_url="https://explorer.invariantlabs.ai/api/v1/gateway/{add-your-dataset-name-here}/anthropic",
)

अपना क्लाइंट हमेशा की तरह इस्तेमाल करें

कॉल बिल्कुल वैसे ही करें जैसे आप सामान्य रूप से करते हैं। Gateway हर अनुरोध प्रोवाइडर तक पहुँचाता है, response को वापस stream करता है, और trace को Invariant Explorer में रिकॉर्ड करता है।

या Gateway को लोकल चलाएँ

hosted endpoint के बजाय खुद होस्ट करने के लिए प्रकाशित Docker image pull करके चलाएँ। यह Gateway को http://localhost:8005/api/v1/gateway/ पर सर्व करता है।

bashbash
docker pull --platform linux/amd64 ghcr.io/invariantlabs-ai/invariant-gateway/gateway:latest
docker run -p 8005:8005 -e PORT=8005 --platform linux/amd64 ghcr.io/invariantlabs-ai/invariant-gateway/gateway:latest

कमांड और कोड प्रोजेक्ट के अपने दस्तावेज़ों से लिए गए हैं — हमेशा जांचें आधिकारिक repo ताज़ा जानकारी के लिए।

कब इस्तेमाल करें

  • रनटाइम पर बने exact prompts, tool calls और responses की जाँच करके multi-step एजेंट को डीबग करना
  • stdio, SSE या Streamable HTTP पर MCP सर्वर इस्तेमाल करने वाले एजेंट में observability जोड़ना
  • OpenAI, Anthropic और Gemini के LLM interactions को एक ही जगह से trace और व्यवस्थित करना
  • जब कोई एजेंट अप्रत्याशित काम करे, तब computer-use या tool-calling व्यवहार की समीक्षा करना

How Invariant Gateway compares

Invariant Gateway alongside other open-source guardrails & security tools AI/TLDR tracks, ranked by GitHub stars.

टूलस्टारयह क्या करता है
SkillSpector★ 28.6kइंस्टॉल करने से पहले कोई agent skill दुर्भावनापूर्ण पैटर्न के लिए स्कैन करें
Presidio★ 12.2kटेक्स्ट, इमेज और स्ट्रक्चर्ड डेटा में PII की पहचान करें और उसे हटाएं
Failproof AI★ 10.5kएक policy API, जो Claude Code, Codex, Cursor और नौ अन्य agent harnesses से जुड़कर हर event पर agent को block, warn या steer करता है
Guardrails AI★ 7.7kPython में कंपोज़ेबल गार्ड्स से LLM के इनपुट और आउटपुट वैलिडेट करें
NeMo Guardrails★ 7.6kLLM चैट ऐप्स में programmable rails जोड़ें, ताकि वे सुरक्षित रहें और विषय पर बनी रहें
BLA (Blind LLM Agents)★ 7.5kआपके रिलीज़ किए गए build को इतना मज़बूत बनाएं कि AI reverse-engineering agents का बजट खत्म हो जाए और वे नकली चीज़ों के पीछे भागें
dcg (Destructive Command Guard)★ 6.4kएक Rust pre-tool hook जो coding agent के चलाने से पहले destructive shell और git commands को ब्लॉक करता है
Invariant Gateway★ 83एक LLM प्रॉक्सी जो दिखाती है और डीबग करने देती है कि आपके AI एजेंट क्या कर रहे हैं