Lightweight drop-in wrapper for the OpenAI Python client that logs telemetry and detects PII risks.
Project description
AgentWatch: Proactive LLM Governance Platform
AgentWatch is an ultra-low latency API proxy and SDK designed to solve the "runaway agent" problem for enterprise engineering teams. It intercepts, manages, and enforces budget constraints on LLM API requests at the edge, acting as a proactive governance layer between your application and upstream providers like OpenAI and Anthropic.
The Problem It Solves
As engineering teams adopt autonomous LLM agents (e.g., coding assistants, research bots, recursive planners), they face a critical financial vulnerability: the runaway loop.
If an agent gets stuck in a recursive error-correction loop, it can execute hundreds of API calls per minute. Because each iteration typically appends the previous output to the context window, the token size grows quadratically. This can result in a single stuck agent burning thousands of dollars in minutes—a scenario that passive monitoring tools will only report after the budget is already gone.
AgentWatch was built from the ground up to prevent this.
Core Features
1. Session-Aware Identity Tracking
Instead of treating API requests as isolated events, AgentWatch tracks iterative agent loops as Sessions.
- Every request is tagged with a
session_idand aniteration_index. - The cumulative token count for a session is securely computed and maintained server-side in the AgentWatch Global Distributed State. This ensures that even if a local agent process crashes, restarts, or runs in parallel, the session's financial state cannot be bypassed or reset.
2. Synchronous Pre-Call Budget Enforcement
AgentWatch acts as a strict financial gatekeeper for agent sessions.
- Developers define a budget ceiling (e.g.,
$2.00) per session via the AgentWatch Python SDK. - Before any upstream LLM call is made, the SDK performs a sub-millisecond synchronous pre-flight check to the AgentWatch Edge Engine.
- If the session's cumulative token cost exceeds the limit, the SDK instantly blocks the execution and raises an
AgentBudgetExceededexception. - Fail-Open Resilience: By default, if the AgentWatch infrastructure experiences downtime, the budget check silently fails open. This ensures our infrastructure never causes a hard outage for your production traffic.
3. Inline Anomaly Detection
AgentWatch heuristically detects runaway behavior before the budget is even exhausted.
- The AgentWatch Edge Engine maintains a rolling window of the last 5 iterations for every active session.
- It calculates the token growth ratio synchronously on every ingest request.
- If three consecutive iterations show a
>1.4xprompt growth—a hallmark signature of a context-appending loop—it asynchronously fires a webhook alert to your security team, adding zero latency to the critical API path.
4. Zero-Latency Proxying & Resilient Telemetry
- Ultra-Low Latency: The hot path of the proxy only handles authentication, routing, and credential management.
- Asynchronous Telemetry: Payload logging and risk scanning are offloaded to our Async Telemetry Pipeline. The client receives the provider's response immediately.
- Data Security & Compliance: Strict data retention policies automatically purge payloads according to your enterprise compliance requirements.
Python SDK Integration
AgentWatch integrates seamlessly via composition with standard OpenAI client wrappers:
from agentwatch import WatchedOpenAI
client = WatchedOpenAI(
agentwatch_api_key="your_aw_key",
agentwatch_project="checkout-service",
agentwatch_team="payments-eng",
agentwatch_session_id="ci-run-123",
agentwatch_session_budget_usd=2.00, # Strict $2 limit
agentwatch_enforcement_mode=True
)
# Standard OpenAI API usage
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Refactor this module..."}]
)
Supported Providers
AgentWatch acts as a unified proxy. The client token is never forwarded upstream; AgentWatch seamlessly authenticates the request to the target provider.
- OpenAI: Supported fully.
- Anthropic: Supported fully.
- Groq (Meta AI, Llama 3): Supported fully.
- Grok (xAI): Supported fully.
- Gemini: Supported fully.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aw_sdk-1.0.0.tar.gz.
File metadata
- Download URL: aw_sdk-1.0.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11b0254a75b4c7bea12dbdeb46748fea326395caf1536efa48c816d853574fa2
|
|
| MD5 |
c9b02b647a82667bfdd6614164631081
|
|
| BLAKE2b-256 |
a0c54c339f856ad9d080d13823e304a0cbfe9001832222d2ecaf4fa89de6b676
|
File details
Details for the file aw_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: aw_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
287cb0821ee3ec53020798895f8b56f55b82985d735e69ad04492f73a9b8bc8d
|
|
| MD5 |
73c96ef00b024afaec3228c71bc6e8cf
|
|
| BLAKE2b-256 |
68e693f729a87279c99d9f75e13d82b4f07f03d672230c897da0618256d46f8b
|