mirror of
https://github.com/invariantlabs-ai/invariant-gateway.git
synced 2026-03-10 11:35:41 +00:00
76644778a1d6b470ca66630e69dce696eaebfa3a
Remove custom compression and rely on starlette_compress to perform the compression as a middleware.
Explorer Proxy
Explorer Proxy is a lightweight Docker service that acts as an intermediary between AI Agents and LLM providers (such as OpenAI and Anthropic). It captures and forwards agent interactions to the Invariant Explorer, enabling seamless visualization and exploration of traces.
Why Use Explorer Proxy?
- ✅ Intercept AI interactions for better debugging and analysis.
- ✅ Seamlessly forward API requests to OpenAI, Anthropic, and other LLM providers.
- ✅ Automatically store and organize traces in Invariant Explorer.
Getting Started
To integrate Explorer Proxy with your AI agent, you’ll need to modify how your client interacts with LLM providers.
🔹 OpenAI Integration
-
Get an API Key
Follow the instructions here to obtain an API key. -
Modify OpenAI Client Setup
Instead of connecting directly to OpenAI, configure yourOpenAIclient to use the proxy.from httpx import Client from openai import OpenAI client = OpenAI( http_client=Client( headers={ "Invariant-Authorization": "Bearer <invariant-api-key>" }, ), base_url="https://explorer.invariantlabs.ai/api/v1/proxy/<add-your-dataset-name-here>/openai", ) # Make API requests to OpenAI as usual.
🔹 Anthropic Integration
Coming Soon!
Description
Languages
Python
98.1%
Shell
1.9%