Skip to main content

📊 Bonanza Observe

AI agent cost observability — track spending, latency, and token usage across all your agent sessions

PyPI Python License

Stop guessing how much your AI agents cost. Bonanza Observe gives you real-time cost tracking, token usage analytics, and latency monitoring for every LLM call.

Why?

AI agents make dozens of LLM calls per task. Without observability:

  • You don't know what you're spending until the bill arrives
  • You can't optimize what you can't measure
  • You can't budget without tracking

Bonanza Observe is the missing open() for AI agent economics.

Installation

pip install bonanza-observe

Quick Start

from bonanza_observe import Tracker

# Create a tracker with a budget
tracker = Tracker(name="my-agent", budget_usd=10.00)

# Start tracking
session = tracker.start_session("research-task")

# Track LLM calls
span = tracker.start_span("web-search")
tracker.record_cost(
    provider="openai",
    model="gpt-4o",
    input_tokens=1500,
    output_tokens=800,
    latency_ms=1200,
)
tracker.finish_span()

# Check your budget
print(tracker.check_budget())
# {
#   "total_usd": 0.01175,
#   "budget_usd": 10.00,
#   "remaining_usd": 9.98825,
#   "percentage": 0.12,
#   "over_budget": False,
#   "alert": False
# }

# Get a full summary
print(tracker.summary())
# {
#   "total_cost_usd": 0.01175,
#   "total_tokens": 2300,
#   "by_model": {"gpt-4o": {"cost": 0.01175, "calls": 1}},
#   "by_provider": {"openai": {"cost": 0.01175, "calls": 1}},
#   ...
# }

Features

💰 Cost Tracking

  • Per-model, per-provider cost breakdown
  • Auto-calculates cost from token counts (supports GPT-4o, Claude 3.5, Gemini, Llama, and more)
  • Manual cost override for custom pricing
  • Budget alerts at configurable thresholds (default 80%)

📊 Token Usage

  • Input/output/total token tracking per call
  • Aggregate stats across sessions
  • Per-model token breakdown

⏱️ Latency Monitoring

  • Per-call latency tracking
  • Average latency across sessions
  • Nested span timing

📁 Session Management

  • Group calls into sessions and spans
  • Nested spans for complex agent workflows
  • Tags for filtering and grouping

📤 Export

from bonanza_observe import Tracker, JsonExporter, CsvExporter

tracker = Tracker(name="my-agent")
# ... track calls ...

# Export as JSON
json_str = JsonExporter.export(tracker)
JsonExporter.save(tracker, "costs.json")

# Export as CSV
csv_str = CsvExporter.export(tracker)
CsvExporter.save(tracker, "costs.csv")

Supported Models (Pricing)

Model Input (per 1M tokens) Output (per 1M tokens)
GPT-4o $2.50 $10.00
GPT-4o Mini $0.15 $0.60
GPT-4 Turbo $10.00 $30.00
Claude 3.5 Sonnet $3.00 $15.00
Claude 3 Haiku $0.25 $1.25
Claude 3 Opus $15.00 $75.00
Gemini 1.5 Pro $1.25 $5.00
Gemini 1.5 Flash $0.075 $0.30
Llama 3.1 70B $0.60 $0.60
Llama 3.1 8B $0.05 $0.05

Comparison

Feature Bonanza Observe Revenium Helicone LangSmith
Cost tracking ✅ ✅ ✅ ✅
Token tracking ✅ ✅ ✅ ✅
Latency monitoring ✅ ✅ ✅ ✅
Budget alerts ✅ ✅ ❌ ✅
Session/span grouping ✅ ❌ ❌ ✅
JSON/CSV export ✅ ✅ ✅ ✅
Nested spans ✅ ❌ ❌ ❌
Auto cost calculation ✅ ✅ ✅ ❌
Zero dependencies ✅ ❌ ❌ ❌
Self-hosted ✅ ✅ ❌ ❌
Python-native ✅ ❌ ✅ ✅

Requirements

  • Python 3.10+

License

Apache License 2.0 — see LICENSE for details.

Links


Built by Bonanza Labs 📊

Metadata

Release files for bonanza-observe 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bonanza-observe 0.1.0
File Size Uploaded Provenance
bonanza_observe-0.1.0.tar.gz 9.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for bonanza-observe 0.1.0
File Interpreter ABI Platform
bonanza_observe-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.9 kB

Release files / bonanza_observe-0.1.0.tar.gz

Download URL bonanza_observe-0.1.0.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8d9fa22b5e7d51c9da93b22ae779d37e6ea84671ac456a068a3e679d3f50c9b1
BLAKE2b-256 checksum
How to use checksums
e791e6ee4640980b313663695615bbd9ea84d0c2f9695594bb9237832feeb34b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / bonanza_observe-0.1.0-py3-none-any.whl

Download URL bonanza_observe-0.1.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a219e31189dc5cc88a6adc9bc218302183da3612de1670b18782a81780c51b30
BLAKE2b-256 checksum
How to use checksums
bb5cc95184e447ba2a241bad3eb14df18db840074dbdf074fdfb73a0c525815b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Security for bonanza-observe 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page