Fleshed out LLM Proxy - #63
Conversation
Saaketh0
commented
Sep 2, 2026
- Added telemetry for bedrock
- Added proxy for ventis
- moved folder inside ventis
- every local controller on start would start this separate process
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
091f29d to
6ae6d83
Compare
…cture Implements automatic LLM telemetry capture with zero agent code changes. ## Architecture - Distributed proxy: One per container, auto-starts on port 8081 - boto3 hook: Injects X-Ventis-Future-Id header from thread-local context - Token extraction: Automatic parsing of Bedrock responses - Redis persistence: All 7 metrics written to future:<id> keys ## Key Components - ventis/llm_proxy/: Complete proxy package (app, hooks, providers) - ventis/controller/local_controller.py: Auto-starts proxy subprocess - ventis/controller/utils/process_supervisor.py: Subprocess management - ventis/stub_generator.py: Copies llm_proxy with full package structure ## Metrics Captured (Bedrock only) - model: Full model ID from request path - input_token_count, output_token_count, token_count - input_cache_tokens (cache reads) - input_cache_write_tokens (cache writes) - errors: HTTP status >= 400 ## Key Fixes - Package structure: llm_proxy copied as ventis/llm_proxy/ to preserve imports - Infinite loop prevention: Proxy's boto3 client uses explicit AWS endpoint - Hooks initialization: Import hooks inside proxy_request() to get configured instance - Flask header normalization: Handle X-Ventis-Future-Id (Title-Case) - Dependencies: Added flask and requests to BASE_AGENT_REQUIREMENTS ## Agent Changes Agents use standard boto3 - zero telemetry code needed: - examples/portfolio/agents/advisor_agent.py: Removed ventis.llm imports - examples/portfolio/agents/intent_agent.py: Removed ventis.llm imports - examples/text2sql/agents/vllm_agent.py: Removed ventis.llm imports ## Removed - ventis/llm/: Old bedrock wrapper (deprecated in favor of proxy) - Planning docs: Consolidated into llm_proxy/README.md ## Testing Verified end-to-end on EC2: - LLM calls succeed through proxy - Token extraction works (inputTokens, outputTokens, cache tokens) - Redis writes confirmed with all 7 fields - Environment: boto3 + AWS_ENDPOINT_URL_BEDROCK_RUNTIME auto-routing ## Scope Bedrock-only for now. OpenAI/Anthropic use different SDKs (not boto3), would need separate hooks in their HTTP clients. Achieves complete parity with old ventis/llm/bedrock.py telemetry.
6ae6d83 to
3c43b67
Compare
|
#73 Having all of this code, closing this PR |