OpenTelemetry-native run-level cost attribution for AI workflows
Project description
botanu SDK for Python
botanu is platform that helps AI companies understand the real cost of their AI features per customer, enabling outcome-based pricing and smarter scaling. This SDK is built on OpenTelemetry for event-level cost attribution for AI workflow. For more email- deborah@botanu.ai
Getting Started
An event is one business transaction — resolving a support ticket, processing an order, generating a report. Each event may involve multiple runs (LLM calls, retries, sub-workflows) across multiple services. By correlating every run to a stable event_id, Botanu gives you per-event cost attribution and outcome tracking without sampling artefacts.
Install
pip install botanu
An event is one business transaction — resolving a support ticket, processing
an order, generating a report. Each event may involve multiple runs (LLM calls,
retries, sub-workflows) across multiple services. By correlating every run to a
stable event_id, botanu gives you per-event cost attribution and outcome
tracking without sampling artifacts.
export BOTANU_API_KEY=<your-api-key>
Wrap your agent:
import botanu
with botanu.event(event_id=ticket.id, customer_id=user.id, workflow="Support"):
agent.run(ticket)
That single wrap captures every LLM call, HTTP call, and DB call inside and stamps them with event_id, customer_id, and workflow.
Decorator form
import botanu
@botanu.event(
workflow="Support",
event_id=lambda ticket: ticket.id,
customer_id=lambda ticket: ticket.user_id,
)
def handle_ticket(ticket):
return agent.run(ticket)
Works for both sync and async def functions.
Multi-phase workflows
with botanu.event(event_id=ticket.id, customer_id=user.id, workflow="Support"):
with botanu.step("retrieval"):
docs = vector_db.query(ticket.query)
with botanu.step("generation"):
response = llm.complete(docs)
See the Quickstart for the full five-minute walkthrough.
Documentation
| Topic | |
|---|---|
| Installation | Install and configure |
| Quickstart | Zero-to-first-trace in five minutes |
| Configuration | Env vars, YAML, trusted-host auth |
| Run Context | Events, runs, retries, baggage |
| Context Propagation | Cross-service and queue propagation |
| Architecture | SDK + collector split |
| LLM Tracking | Manual LLM instrumentation (usually not needed) |
| Data Tracking | DB, storage, messaging (usually not needed) |
| Content Capture | Prompt/response capture for eval, with PII scrubbing |
| Outcomes | Diagnostic annotations and server-side resolution |
| Auto-Instrumentation | Supported libraries |
| Kubernetes | Zero-code instrumentation at scale |
| Existing OTel / Datadog | Brownfield coexistence |
event / step API |
Primary API reference |
| Best Practices | Patterns that work |
| Anti-Patterns | Patterns that break cost attribution |
Requirements
- Python 3.9 or newer
- An OpenTelemetry Collector (Botanu Cloud runs one for you; self-hosted is supported too)
Contributing
Contributions are welcome. Read the Contributing Guide before opening a pull request.
All commits require DCO sign-off:
git commit -s -m "Your commit message"
Looking for a place to start? See the good first issues.
Community
- GitHub Discussions — questions, ideas, show & tell
- GitHub Issues — bugs and feature requests
Governance
See GOVERNANCE.md for roles, decision-making, and the contributor ladder. Current maintainers are in MAINTAINERS.md.
Security
Report security vulnerabilities via GitHub Security Advisories or see SECURITY.md. Do not file a public issue.
Code of Conduct
This project follows the LF Projects Code of Conduct. See CODE_OF_CONDUCT.md.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file botanu-0.1.dev77.tar.gz.
File metadata
- Download URL: botanu-0.1.dev77.tar.gz
- Upload date:
- Size: 52.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce494493d1fdbf076b1893c185e0f4a8e75ac2de93394ee56a103f011d28804e
|
|
| MD5 |
0a16f496d0f9407c1c9dfa1520062f84
|
|
| BLAKE2b-256 |
894dbae0555969e6f56bac0295341418e0090de8ff03256965edd22e9ac435b9
|
Provenance
The following attestation bundles were made for botanu-0.1.dev77.tar.gz:
Publisher:
release.yml on botanu-ai/botanu-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
botanu-0.1.dev77.tar.gz -
Subject digest:
ce494493d1fdbf076b1893c185e0f4a8e75ac2de93394ee56a103f011d28804e - Sigstore transparency entry: 1384050855
- Sigstore integration time:
-
Permalink:
botanu-ai/botanu-sdk-python@8a1c1927d92b6add5658375dc09029a27cdb6f5d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/botanu-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8a1c1927d92b6add5658375dc09029a27cdb6f5d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file botanu-0.1.dev77-py3-none-any.whl.
File metadata
- Download URL: botanu-0.1.dev77-py3-none-any.whl
- Upload date:
- Size: 62.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf182522dd02015c9741633935f13f71e9e3f00894ad7732ca43fe022c97bdf2
|
|
| MD5 |
2aa834e5e96e36df73f85cd4db98b846
|
|
| BLAKE2b-256 |
e7bbc75db4f514247acb0a2725119714011186542308296867315effed9217d0
|
Provenance
The following attestation bundles were made for botanu-0.1.dev77-py3-none-any.whl:
Publisher:
release.yml on botanu-ai/botanu-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
botanu-0.1.dev77-py3-none-any.whl -
Subject digest:
cf182522dd02015c9741633935f13f71e9e3f00894ad7732ca43fe022c97bdf2 - Sigstore transparency entry: 1384050887
- Sigstore integration time:
-
Permalink:
botanu-ai/botanu-sdk-python@8a1c1927d92b6add5658375dc09029a27cdb6f5d -
Branch / Tag:
refs/heads/main - Owner: https://github.com/botanu-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@8a1c1927d92b6add5658375dc09029a27cdb6f5d -
Trigger Event:
workflow_dispatch
-
Statement type: