Appearance
Troubleshooting
Common Issues
401 Unauthorized
Symptom: All API calls return 401.
Causes:
- Missing
Authorizationheader - Wrong token format (must be
Bearer aw_live_xxx, notToken aw_live_xxx) - Token not in
TENANT_TOKEN_MAPor KV store
Fix:
python
# Correct format
client = WatchedOpenAI(
agentwatch_api_key="aw_live_xxx", # Must start with aw_
...
)Budget Check Always Passes
Symptom: AgentBudgetExceeded is never raised even when spending exceeds the limit.
Causes:
agentwatch_enforcement_modeisFalse(default)agentwatch_session_budget_usdis not set- Session ID is not consistent across calls
Fix:
python
client = WatchedOpenAI(
agentwatch_enforcement_mode=True, # Must be True
agentwatch_session_budget_usd=2.00, # Must be set
agentwatch_session_id="consistent-id", # Must be consistent
...
)AgentWatch Outage Affecting Production
Symptom: API calls fail when AgentWatch is down.
Cause: Using proxy mode (agentwatch_primary_provider) without failover.
Fix:
python
# Option 1: Use SDK-only mode (recommended)
client = WatchedOpenAI(
agentwatch_api_key="aw_live_xxx",
# No agentwatch_primary_provider — calls go directly to OpenAI
)
# Option 2: Enable failover
client = WatchedOpenAI(
agentwatch_primary_provider="openai",
agentwatch_fallback_provider="anthropic",
...
)Streaming Calls Not Counting Toward Budget
Symptom: Streaming calls bypass budget enforcement.
Cause: Token counts are unavailable until stream completion. Budget enforcement uses estimated counts.
Fix: This is expected behavior. Use non-streaming calls for strict budget enforcement.
Rate Limiting (429)
Symptom: Requests return 429 Too Many Requests.
Cause: Exceeded 100 requests per minute per tenant.
Fix:
- Reduce request frequency
- Contact support to increase limits
- Use batch APIs where available
Telemetry Not Appearing
Symptom: Logs don't appear in Supabase dashboard.
Causes:
SUPABASE_URLorSUPABASE_SERVICE_ROLE_KEYnot configured- Queue consumer not running
- 90-day retention purged old logs
Fix: Check Worker logs for Supabase connection errors.
Performance Issues
Slow Budget Checks
Budget checks involve a network round-trip to Cloudflare KV (5-50ms). If consistently slow:
- Check Cloudflare status page
- Verify Worker is deployed to the correct region
- Consider using Durable Objects for atomic operations
High Latency on First Request
First requests may be slower due to Worker cold start (V8 compilation). Subsequent requests are fast.
Getting Help
- Email: mohil.sharma@agent-watch.dev
- Health Check:
curl https://agent-watch.dev/healthz