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