Open-source TokenShield cuts off CrewAI retry loops before token burn explodes
bulleykebaal · reddit · 2026-07-25
A developer says they fixed runaway retry loops in CrewAI by adding turn-scoped sliding-window hashes to TokenShield, an open-source FastAPI gateway proxy.
- The problem: an agent stuck on a failing database tool would retry repeatedly, and each retry kept appending more context, driving prompt tokens from about 139 to 600+ per turn.
- The fix uses normalized signatures within a single turn only, avoiding false positives across later turns.
- The gateway now applies two defenses: first, soft steering with replanning instructions; then, if needed, a hard 429 cutoff to stop token burn immediately.
- The author says this helped cut off runaway multi-agent loops in CrewAI and similar frameworks before the bill arrives.
Related event: TokenShield fixes CrewAI retry loops with turn-scoped hashing(2 posts)→
More from coding & agent
- Bio is building a domain-specific research agent and surveying researchers first — melnykowycz · 2026-07-25
- Kimi K3 lands in NEO and beats GLM 5.2 on a real AI engineering task — Nilofer_tweets · 2026-07-25
- A non-programmer built a multi-agent prototype for petrochemical trading and learned why agents must be modular — Sphere_Project · 2026-07-25
- Browser agent benchmark shows diff-based page memory cuts token growth 37% — Desperate_Title1595 · 2026-07-25
- Hermes pitch claims persistent memory and skill generation can make agents self-improving — Teknium · 2026-07-25
- Cass aims to search across Claude Code, Codex, Cursor and Gemini CLI sessions — doodlestein · 2026-07-25