In-Flight Circuit Breaker & Reasoning Loop Recovery
When autonomous LLM agents hit an unexpected hurdle, they often get trapped repeating the exact same tool call, oscillating between two thoughts, or burning thousands of tokens in a dead-end loop. LongGuard monitors your agent in real time, injects a Reflect & Pivot prompt to recover gracefully, and enforces hard token and USD cost guardrails.
pip install longguardReal-time loop detection, intelligent prompt recovery, and hard dollar-cost caps for production AI agents.
Catches Tool Repeat, Semantic Oscillation, Dead-End Drift, and Token Velocity spikes with sub-millisecond evaluation overhead.
Injects targeted recovery prompts when an agent gets stuck, guiding it to change strategy before resorting to a graceful halt.
Drop-in support for LangGraph 1.0+ (`add_guard_to_graph`), LangChain (`GuardedAgentExecutor`), CrewAI (`add_guard_to_crew`), and `@guarded`.
Continue eligible stopped runs via `compile_guarded_graph` and `GuardedGraph.resume()` without replaying completed tool calls.
Built-in model pricing registry. Set `max_cost_usd` and `max_tokens_per_run` to hard-stop runaway agents before they burn your budget.
Detailed `GuardReport` with per-step token, cost, and detector analytics. Export to JSON/YAML and keep tool-call histories protocol-clean.
The Long Suite covers the full production AI lifecycle. LongParser prepares your documents. LongTrainer builds the chatbot. LongTracer verifies the answers. LongProbe tests the retrieval. LongGuard protects runtime agent loops. LongCache eliminates repetitive token costs.
View the Long Suite ecosystemWe build reliable LangGraph and multi-agent systems using the full Long Suite stack. Book a free discovery call to discuss your requirements.