All notable changes to the UnitCause Python SDK will be documented in this file.
This project adheres to Semantic Versioning and follows Keep a Changelog.
0.2.0 — 2026-02-24
- Enforcement engine — configurable warn / throttle / kill actions per policy.
- Loop detection — dual strategy support (exact hash match + pattern cycle detection).
on_killcallback — react when sessions are killed by enforcement, manual kill, or budget/loop triggers.- Throttle handling — SDK auto-sleeps when the server responds with a throttle action (
429+X-Throttle-Delay-Ms). SessionKilledError— new exception raised when a session is killed for any reason.enforcement_resultfield onStepResponse— full enforcement details from the server.- Framework integrations:
unitcause.integrations.langchain—UnitCauseCallbackHandlerandAsyncUnitCauseCallbackHandlerfor LangChain.unitcause.integrations.crewai—unitcause_step_callback()factory andUnitCauseCrewListenerfor CrewAI.unitcause.integrations.autogen—UnitCauseHookwithattach()for AutoGen / AG2.
- Built-in cost estimation —
unitcause.integrations.pricingwith 60+ model pricing table andregister_pricing()for custom models. - Optional dependency extras:
pip install unitcause[langchain],unitcause[crewai],unitcause[autogen],unitcause[all].
StepResponse.actionis now astr(wasLiteral["continue", "warn"]) to support"throttle"and"kill"actions.Transport.request()andAsyncTransport.request()acceptallow_error_bodyparameter for parsing enforcement responses from429/403status codes.SessionandAsyncSessionfully rewritten to handle enforcement actions (throttle sleep, kill callbacks, error raising).- Budget warning callback now only fires once per session when utilization crosses the warning threshold.
0.1.0 — 2026-02-20
- Initial release of the UnitCause Python SDK.
UnitCauseclient withsession()andasync_session()context managers.SessionandAsyncSessionfor sync/async agent run tracking.report_step()for manual LLM call reporting with cost, tokens, and model info.- Budget enforcement with
on_budget_warningandon_budget_exceededcallbacks. - Loop detection with
LoopDetectedError. BudgetExceededErrorraised when budget limits are hit.- Retry logic with configurable
max_retriesandbackoff_factor. Configdataclass with environment variable support (UNITCAUSE_API_KEY,UNITCAUSE_BASE_URL, etc.).health_check()for API connectivity verification.- Full type hints and
py.typedmarker for PEP 561 compliance. - MIT license.