Long-horizon LLM agents fail in predictable ways: they loop on the same tool calls, storm-edit one file, and flood their own context until the task collapses — and you usually notice only after the tokens are already spent.
Sotis lives inside your agent's loop and catches it live. It detects the spiral (sliding-window entropy + exact/semantic loop detection), rolls the workspace back to a verified-good state — one proven to still parse, not just the last snapshot — distills the bloated history into a compact resumption prompt, and lets the agent keep going.
Proven on real agents. Validated on live runs (Groq Llama-3.3-70B, OpenRouter Gemini) detecting real meltdowns and restoring clean, resumable workspaces; 100% meltdown-detection across a 6-scenario gauntlet. Detection + rollback add <0.2 ms per step.
Drop-in. pip install sotis → wrap your loop in ~3 lines, or add the native LangGraph guard node. Works with OpenAI, Anthropic, DeepSeek, Google, and any OpenAI-compatible endpoint.
Key features:
Real-time meltdown detection — entropy + exact/semantic loop detection + workspace edit-storm guard
Verified-good rollback — restores a state proven safe, not just the most recent (possibly corrupted) one
Context distillation — a compact resumption prompt instead of replaying the spiral (~86% fewer tokens)
Native LangGraph guard node, plus a drop-in wrapper for custom ReAct / tool-calling loops
Any LLM provider (OpenAI / Anthropic / DeepSeek / Google / OpenAI-compatible)
Observability — Streamlit dashboard + structured JSON logs
Community-driven roadmap — feature requests from people who actually ran it became shipped features.
Honest scope: Sotis bounds the failure mode and keeps your agent resumable — it doesn't make a weak model smart. It's a library for developers building their own agents, not a plugin for closed agents (Claude Code, Codex) that expose no hook into their loop.
Built with