{"repo":"Emmimal/control-layer","free":true,"listed":false,"github":"https://github.com/Emmimal/control-layer","clone":"git clone https://github.com/Emmimal/control-layer.git","description":"A production-grade control layer that sits between your application logic and any LLM — input validation, schema enforcement, circuit breaking, targeted retry, and audit logging in one composable pipeline.","language":"Python","stars":62,"topics":["anthropic","circuit-breaker","generative-ai","input-validation","llm","llm-guardrails","llm-ops","production-ai","prompt-engineering","python"],"license":"MIT","category":"ai-agents","readme_excerpt":"control-layer A production-grade control layer that sits between your application logic and any LLM — input validation, schema enforcement, circuit breaking, targeted retry, and audit logging in one composable pipeline. Most LLM integrations stop at: write a prompt, call the model, use the response. This library handles what prompt engineering cannot — enforcing what the model actually returns, blocking what should never reach it, and recovering cleanly when things break. Read the full write-up on Towards Data Science → Prompt Engineering Failed in Production — I Built the Control Layer That Actually Works --- What It Does Component Job --- --- InputGuard Blocks injection attempts and oversized input before any LLM call CircuitBreaker Opens after N consecutive failures; rejects calls instantly during recovery TokenBudget tiktoken-accurate slot-based allocator; prevents silent overflow PromptBuilder Assembles prompt in priority order with hard constraints injected structurally LLMCaller Wraps any callable LLM with thread-based timeout enforcement ResponseValidator Validates JSON structure, required keys, length, forbidden phrases RetryEngine Maps each failure mode to a targeted mutation hint; jittered exponential backoff FallbackRouter Registered fallback chain; first non-empty response wins AuditLogger Thread-safe JSONL audit log; P50/P90/P99 latency stats; failure distribution --- Installation No ML dependencies. No GPU required. All functionality runs on the Python standard","default_branch":null,"files":null,"tree":[],"storefront":"/r/Emmimal","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Emmimal/control-layer/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}