AI News Hub Logo

AI News Hub

One Decorator Away From Production-Ready AI Agents

DEV Community
Hedi Manai

Every agent developer hits the same wall. The demo works. Then it goes to production — and the cracks show up fast. No retry logic when APIs fail. Identical queries hammering your LLM endpoint over and over. No visibility into what's actually happening. And before long, you're writing the same cache managers, retry decorators, and circuit-breaker wrappers you wrote on the last project. ToolOps is built to make that boilerplate disappear. What It Is: Think of it the way a service mesh works for microservices: the infrastructure wraps around your code without touching it. What It Does: Caching that actually fits production. ToolOps supports in-memory caching for speed, file-based for lightweight persistence, and PostgreSQL for durable, distributed caching shared across processes. Pick the backend that fits the function. Semantic caching for LLM calls. Standard caches match on exact strings — so "weather in Paris" and "Paris weather" hit the LLM twice. ToolOps uses vector embeddings to match by meaning, collapsing semantically similar queries into a single cached result. For agents handling natural language, this can cut LLM calls by up to 90%. Request coalescing. When dozens of agents request the same data at once during a cache miss, ToolOps fires one real API call and returns the result to all of them. The thundering herd problem, solved automatically. Stale-if-error fallback. When an upstream service goes down, ToolOps can serve the last known good value instead of crashing your agent — exactly what you want for slowly-changing data like exchange rates or configuration. Observability out of the box. Every cache hit, miss, retry, and circuit-breaker event is logged as structured JSON. Add the optional OpenTelemetry extra and you get full distributed tracing and Prometheus metrics — production-grade visibility in a few lines of setup. Works With Your Stack: When you migrate frameworks — and most teams eventually do — your infrastructure layer doesn't budge. The Practical Upside: Two decorators cover every case: @readonly for functions that read data, @sideeffect for functions that act on the world. That's the entire model. Try It: GitHub: https://github.com/hedimanai-pro/toolops https://pypi.org/project/toolops/ https://hedimanai.vercel.app/projects/toolops.html