What's New in v1.2.1
CostTracker Improvements
- Per-span cost events: CostTracker now includes running total in span end events (
cost_usdfield) - Model pricing accuracy: Updated model pricing for latest OpenAI, Anthropic, and Google models
- Warning on unknown models:
estimate_cost()logs a warning when encountering unrecognized model names
Bug Fixes
- Fixed span end events not including accumulated cost data
- Improved CostTracker thread safety
Full Changelog
Full Changelog: v1.2.0...v1.2.1
Installation
pip install agentguard47==1.2.1Quick Start
from agentguard import Tracer, BudgetGuard
guard = BudgetGuard(max_budget_usd=5.00)
tracer = Tracer(service="my-agent", guards=[guard])
with tracer.span("agent-run"):
# Your agent code here
pass # BudgetExceeded raised if cost > $5