Lago Releases Open-Source Agent SDK for Frictionless LLM Token Billing
Key Takeaways
- ▸Open-source SDK eliminates API changes and code modifications needed to instrument LLM cost tracking across AWS Bedrock, Mistral, OpenAI, Anthropic, and Google Gemini
- ▸Sub-5ms wrapper overhead with production-grade resilience ensures instrumentation never blocks LLM calls or impacts application performance
- ▸Multi-tenant support with flexible subscription resolution (per-call, context-bound, or default) and contextvars-safe async propagation enables billing across multiple workloads
Summary
Lago has released an open-source Python SDK that wraps existing LLM client libraries to automatically capture and meter token usage without requiring changes to application code. The Lago Agent SDK currently supports AWS Bedrock and Mistral's native SDKs, with OpenAI, Anthropic, and Google Gemini support coming in Phase 2.
The SDK uses in-memory buffering and batches usage events to Lago's metering API, maintaining a p99 overhead under 5 milliseconds and surviving provider and Lago outages through exponential backoff and bounded recovery queues. It employs contextvars for safe multi-tenant support, allowing per-call subscription overrides and context-bound tenant resolution across async tasks.
Designed as a drop-in wrapper, the SDK never blocks application calls—if instrumentation fails due to adapter bugs, network errors, or Lago downtime, the LLM call returns normally with errors logged and optionally forwarded to monitoring systems like Sentry or Datadog.
Editorial Opinion
Lago's open-source Agent SDK addresses a critical infrastructure gap in LLM cost transparency and attribution. By removing API surface changes and adding sub-5ms overhead, the company dramatically lowers adoption friction for teams managing multiple LLM providers and billing complexity. The design sophistication—contextvars support, bounded resilience queues, and fail-open semantics—suggests a mature approach to production LLM workloads. However, uptake will depend on whether the broader industry standardizes on Lago as the metering layer versus building proprietary solutions.


