Back to directory

shekel

A Python library that enforces spend limits on AI agents by monkey-patching LLM provider calls, stopping runs, warning, or downgrading models before a budget is exceeded.

shekel

shekel is a Python library for controlling AI agent spend. It wraps a budget context manager around agent code and monkey-patches the OpenAI, Anthropic, and other provider clients for the duration of the run, so no code changes to the agent itself are required.

It supports a hard cap that raises an error once spend crosses the limit, a configurable warning threshold, automatic fallback to a cheaper model near the limit, and a tracking-only mode. Framework integrations auto-patch LangChain, LangGraph, CrewAI, AutoGen, the OpenAI Agents SDK, and MCP, with optional per-agent budgets in AutoGen and the OpenAI Agents SDK.

It installs via pip with optional extras for OpenAI, Anthropic, or all supported providers, and ships a shekel run command that enforces a budget on an existing script without editing it.

More in AI evals

See all 269
  • Provenance gate

    github.com

    A deterministic authorization gateway that sits between an AI agent and its tools, tracing where each parameter of a side-effect call came from, and blocking the call or asking a human when the source does not check out.

  • JevBench

    benchmarkheaven.com

    A reproducible benchmark from Benchmark Heaven that ranks Jev-class typed decision models on intelligence, calibration, speed, and cost, with a published harness, scoring rules, and results.

  • A co-evolutionary adversarial red-teaming tool for AI agents that uses quality-diversity evolutionary search to autonomously breed edge-case scenarios, testing whether an agent with tool access can be made to hallucinate, deadlock or leak funds.