Releases: arieradle/shekel
Releases · arieradle/shekel
v1.2.0 — AutoGen Adapter and Per-Tenant Budget Enforcement
What's new in 1.2.0
AutoGen adapter
- Patches
ConversableAgent.initiate_chatandgenerate_replytransparently — no code changes needed - Per-agent caps via
b.agent("name", max_usd=X)withAgentBudgetExceededError - Spend visible in
budget.tree(); auto-skipped whenpyautogenis not installed
Per-tenant budget enforcement
budget(max_usd=X, tenant_id=user.id, name="api", backend=RedisBackend())— isolated cap per user, one shared backend- Redis key namespaced as
shekel:tb:{name}:{tenant_id}; 30-day rolling window by default BudgetConfigMismatchErroron limit mismatch;Budget.tenant_idproperty;summary()surfaces tenant
Quota management API (RedisBackend / AsyncRedisBackend)
get_tenant_spend·get_tenant_limit·set_tenant_limit·reset_tenant·list_tenants- Full async equivalents on
AsyncRedisBackend
shekel tenants CLI
shekel tenants list --name api— table with spend, limit, utilization--jsonflag;set-limitandresetsubcommands
Install
pip install shekel==1.2.0
pip install shekel[redis]==1.2.0 # for per-tenant enforcementFull changelog
See docs/changelog.md for the complete entry.
v1.1.0
What's Changed
- feat: v1.1.0 — Loop Guard, Spend Velocity, OpenAI Agents SDK adapter by @arieradle in #25
Full Changelog: v1.0.2...v1.1.0
v1.0.2
Full Changelog: v1.0.1...v1.0.2
v1.0.1
Full Changelog: v1.0.0...v1.0.1
v0.2.9
What's Changed
- feat: shekel run — non-invasive CLI budget enforcement (v0.2.9) by @arieradle in #23
Full Changelog: v0.2.8...v0.2.9
v0.2.8
What's Changed
- feat: temporal budgets with rolling-window spend enforcement (v0.2.8) by @arieradle in #21
- feat: Tool Budget API (v0.2.8) — max_tool_calls, tool_prices, auto-interception by @arieradle in #22
Full Changelog: v0.2.7...v0.2.8
v0.2.7
What's Changed
- feat: full async support for Gemini, HuggingFace, and nested budgets by @arieradle in #19
- feat: OpenTelemetry metrics integration (ShekelMeter) by @arieradle in #20
Full Changelog: v0.2.6...v0.2.7
v0.2.6
What's Changed
- feat: v0.2.6 — call limits, dict fallback API, breaking-change cleanup by @arieradle in #12
- feat: add LiteLLM provider adapter (v0.2.6) by @arieradle in #14
- feat: add LangGraph integration helper (v0.2.6) by @arieradle in #13
- feat: LangGraph integration docs + mypy CI fix by @arieradle in #15
- test: LangGraph integration tests (Groq, Gemini, mock) by @arieradle in #16
- feat: add Google Gemini and HuggingFace provider adapters by @arieradle in #17
- feat: release hardening for v0.2.6 by @arieradle in #18
Full Changelog: v0.2.5...v0.2.6
v0.2.5
What's Changed
- feat: implement ProviderAdapter pattern for pluggable LLM provider integration (v0.2.5) by @arieradle in #8
- test & ci: add comprehensive performance testing suite with CI/CD integration by @arieradle in #9
- feat: comprehensive Ollama/Groq/Gemini integration tests by @arieradle in #10
Full Changelog: v0.2.4...v0.2.5
v0.2.4 — Langfuse Integration
What's New
🔭 Langfuse Integration — Full LLM Observability
Track costs, visualize budget hierarchies, and debug overruns in Langfuse — automatically.
from langfuse import Langfuse
from shekel import budget
from shekel.integrations import AdapterRegistry
from shekel.integrations.langfuse import LangfuseAdapter
lf = Langfuse(public_key="pk-lf-...", secret_key="sk-lf-...")
AdapterRegistry.register(LangfuseAdapter(client=lf, trace_name="my-app"))
with budget(max_usd=10.00, fallback="gpt-4o-mini", name="agent") as b:
run_agent() # costs flow to Langfuse automaticallyFour features out of the box:
- 💰 Real-time cost streaming —
shekel_spent,shekel_limit,shekel_utilizationon every LLM call - 🌳 Nested budget hierarchy — child budgets become child spans (perfect waterfall view)
⚠️ Circuit break events — WARNING events when budgets are exceeded, with overage metadata- 🔄 Fallback annotations — INFO events when fallback models activate, with savings data
Install
pip install shekel[langfuse] # Langfuse only
pip install shekel[all] # OpenAI + Anthropic + LangfuseAlso in this release
AdapterRegistry.unregister()— remove individual adaptersnameparameter on@with_budgetdecorator — enables named parent budgets for nestingeffective_limitenforcement fix — auto-capped nested budgets now raise at their capped limit (notmax_usd)- 267 tests, 95%+ coverage