Skip to content

Latest commit

 

History

History
49 lines (38 loc) · 2.91 KB

File metadata and controls

49 lines (38 loc) · 2.91 KB

Changelog

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

Added

  • Enforcement engine — configurable warn / throttle / kill actions per policy.
  • Loop detection — dual strategy support (exact hash match + pattern cycle detection).
  • on_kill callback — 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_result field on StepResponse — full enforcement details from the server.
  • Framework integrations:
    • unitcause.integrations.langchainUnitCauseCallbackHandler and AsyncUnitCauseCallbackHandler for LangChain.
    • unitcause.integrations.crewaiunitcause_step_callback() factory and UnitCauseCrewListener for CrewAI.
    • unitcause.integrations.autogenUnitCauseHook with attach() for AutoGen / AG2.
  • Built-in cost estimationunitcause.integrations.pricing with 60+ model pricing table and register_pricing() for custom models.
  • Optional dependency extras: pip install unitcause[langchain], unitcause[crewai], unitcause[autogen], unitcause[all].

Changed

  • StepResponse.action is now a str (was Literal["continue", "warn"]) to support "throttle" and "kill" actions.
  • Transport.request() and AsyncTransport.request() accept allow_error_body parameter for parsing enforcement responses from 429/403 status codes.
  • Session and AsyncSession fully 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

Added

  • Initial release of the UnitCause Python SDK.
  • UnitCause client with session() and async_session() context managers.
  • Session and AsyncSession for sync/async agent run tracking.
  • report_step() for manual LLM call reporting with cost, tokens, and model info.
  • Budget enforcement with on_budget_warning and on_budget_exceeded callbacks.
  • Loop detection with LoopDetectedError.
  • BudgetExceededError raised when budget limits are hit.
  • Retry logic with configurable max_retries and backoff_factor.
  • Config dataclass with environment variable support (UNITCAUSE_API_KEY, UNITCAUSE_BASE_URL, etc.).
  • health_check() for API connectivity verification.
  • Full type hints and py.typed marker for PEP 561 compliance.
  • MIT license.