Releases: ENDEVSOLS/LongGuard
Release list
LongGuard v0.1.4
🚀 What's Changed in v0.1.4
🚀 Added
- CrewAI Integration (
CrewGuard&add_guard_to_crew): Added native CrewAI support inlongguard.integrations.crewai. Protects multi-agent crews from delegation loops and repetitive tool calls viastep_callbackand 1-lineadd_guard_to_crew(crew). - Universal
@guardedDecorator: Added@guardeddecorator inlongguard.core.decorator(exported top-level aslongguard.guarded). Wraps arbitrary Python functions, SDK calls, generators, and async coroutines with circuit breaker protection in 1 line. - PEP 561 Typing Support (
py.typed): Addedsrc/longguard/py.typedmarker file andTyping :: Typedpackage classifier for strict IDE and static analysis support (MyPy, Pyright, VS Code Pylance). - CircuitBreakerTrippedError / CircuitBreakerError: Added explicit exception classes carrying
reason,report, anddecisionfor programmatic inspection when an agent is terminated. - Documentation & Theme Polish: Enhanced MkDocs configuration with logo, favicon, GitHub repository icon, back-to-top navigation, tab synchronization, social footer, and new documentation guides for CrewAI and the
@guardeddecorator.
🔄 Changed
- PyPI Metadata & SEO Optimization: Updated official documentation URL to
https://endevsols.github.io/LongGuard/, expanded keywords to 15 high-intent discovery tags, and addedOperating System :: OS IndependentandTopic :: System :: Monitoringclassifiers. - README Links: Converted relative markdown links to absolute GitHub URLs to prevent 404 errors when rendered on PyPI.
- Expanded Test Suite: Added 16 new test cases (271 tests total, 100% passing) covering
@guarded(sync, async, generators, cost limits, fallbacks) andCrewGuard(action/finish parsing, crew wrapping, callback chaining).
📦 Install / Upgrade
Defaulting to user installation because normal site-packages is not writeable
Collecting longguard
Downloading longguard-0.1.3-py3-none-any.whl.metadata (14 kB)
Collecting numpy>=1.24.0 (from longguard)
Downloading numpy-2.5.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (6.6 kB)
Downloading longguard-0.1.3-py3-none-any.whl (49 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 49.5/49.5 kB 1.9 MB/s eta 0:00:00
Downloading numpy-2.5.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (16.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.7/16.7 MB 21.0 MB/s eta 0:00:00
Installing collected packages: numpy, longguard
Successfully installed longguard-0.1.3 numpy-2.5.3
🔗 Resources
| Link | |
|---|---|
| 📖 Documentation | https://endevsols.github.io/LongGuard/ |
| 🐍 PyPI | https://pypi.org/project/longguard/ |
| 🌐 EnDevSols Long Suite | https://endevsols.com/open-source |
| 🐛 Report a Bug | https://github.com/ENDEVSOLS/LongGuard/issues |
| 📜 Full Changelog | https://github.com/ENDEVSOLS/LongGuard/blob/main/CHANGELOG.md |
✅ Quality
- All tests passing (ruff + mypy strict + pytest)
- Supported: Python 3.10, 3.11, 3.12 · Ubuntu & macOS
Part of the EnDevSols Long Suite — production AI tooling for Python.
LongGuard v0.1.3
🚀 What's Changed in v0.1.3
🚀 Added
- Raw Client Integration (OpenAI & Anthropic): Added
AgentStep.from_openai_response()andAgentStep.from_anthropic_response()class methods. Enables using LongGuard directly with standardopenaiandanthropicSDK client loops without requiring LangGraph or LangChain. - Dollar Cost Tracking: Built-in pricing engine (
PRICING_TABLE,compute_cost,list_supported_models) supporting 40+ major LLM models (OpenAI GPT-4o/o1/o3, Anthropic Claude 3.5/4, Gemini 1.5/2.0/2.5, LLaMA 3.1/3.3, Mistral, Cohere). - Budget Hard Cap (
max_cost_usd): Configure hard dollar spend limits on agent runs (max_cost_usd) to immediately trip the circuit breaker and prevent runaway API bills. - Custom Token Pricing Overrides: Added
cost_per_input_tokenandcost_per_output_tokeninGuardConfigfor private/fine-tuned or unlisted models. - Report Persistence (
save/load): Persist telemetry to disk viareport.save("run.json")and restore full state usingGuardReport.load("run.json"). Supports JSON natively and YAML (whenpyyamlis installed). - Runnable Examples & Docs: Added standalone example in
examples/openai_raw_guard.pyand documentation indocs/integrations/raw-client.md.
🔄 Changed
- GuardReport Telemetry:
GuardReport.summary()now displaysEstimated Cost: $X.XXXX USD (model)when cost tracking is configured. - Expanded Test Suite: Added 76 new test cases (255 tests total, 100% passing) covering SDK response parsing, pricing calculations, breaker cost limits, and report serialization.
- Automated GitHub Releases: Enhanced GitHub Actions workflow to parse release notes directly from
CHANGELOG.mdand exclude internal build metadata from release assets.
📦 Install / Upgrade
pip install --upgrade longguard
# or
uv add longguard🔗 Resources
| Link | |
|---|---|
| 📖 Documentation | https://endevsols.github.io/LongGuard/ |
| 🐍 PyPI | https://pypi.org/project/longguard/ |
| 🌐 EnDevSols Long Suite | https://endevsols.com/open-source |
| 🐛 Report a Bug | https://github.com/ENDEVSOLS/LongGuard/issues |
✅ Quality
- All tests passing (ruff + mypy strict + pytest)
- Supported: Python 3.10, 3.11, 3.12 · Ubuntu & macOS
Part of the EnDevSols Long Suite — production AI tooling for Python.
Full Changelog: v0.1.1...v0.1.3
v0.1.1
🛡️ LongGuard v0.1.1 — Initial Public Release
We are excited to introduce the initial open-source release of LongGuard — a lightweight, in-flight circuit breaker and reasoning loop recovery middleware designed specifically for autonomous AI agents built with LangGraph, LangChain, or custom loops.
⚡ What is LongGuard?
When autonomous LLM agents encounter ambiguous tool responses, rate limits, or unexpected hurdles, they often get stuck in destructive loops — calling identical tools repeatedly, oscillating between conflicting decisions, or drifting aimlessly while burning thousands of tokens.
LangGraph's built-in recursion_limit is a hard crash (GraphRecursionError) that drops user state with zero chance of recovery.
LongGuard catches loops early, injects a dynamic "Reflect & Pivot" prompt to guide the agent back on track, and only halts gracefully if recovery fails.
🚀 Key Features
🔄 4-State Circuit Breaker State Machine
CLOSED→ Normal agent operation; every step is monitored with sub-millisecond overhead.REFLECTING→ Loop detected; injects recovery prompt to force course-correction.HALF_OPEN→ Monitoring recovery step to verify the agent successfully pivoted.OPEN→ Graceful circuit trip (kill) with complete conversation state preserved.
🔍 4 Autonomous Loop Detectors
- Tool Repeat Detector: Catches identical tool calls with duplicate parameters using SHA256 argument fingerprinting.
- Semantic Oscillation Detector: Detects thought cycles and conceptual loops across a rolling window using embedding variance.
- Dead-End Drift Detector: Flags repeated uninformative, empty, or error-laden tool observations using Jaccard similarity.
- Token Velocity Detector: Monitors exponential token spikes per step against dynamic rolling baselines.
🔌 Seamless Integrations
- LangGraph 1.0+: Wrap your graph nodes in a single line of code with
add_guard_to_graph(). - LangChain: Drop-in wrapper via
GuardedAgentExecutor. - Standalone Loops: Full control using
CircuitBreakerandAgentStepin custom Pythonwhileloops.
📊 Comprehensive Telemetry
- Detailed
GuardReporttracking step latency, token consumption, detection events, and circuit breaker transitions.
📦 Install
pip install longguard
# or
uv add longguard
# With optional extras:
pip install "longguard[langgraph]" # For LangGraph 1.0+
pip install "longguard[langchain]" # For LangChain
pip install "longguard[embeddings]" # For fast local semantic embeddingsFull Changelog: https://github.com/ENDEVSOLS/LongGuard/commits/v0.1.1