Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

botanu SDK for Python

License

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

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

Apache License 2.0

Metadata

Release files for botanu 0.1.dev77

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

Source distribution (sdist)

Source distribution for botanu 0.1.dev77
File Size Uploaded Provenance Actions
botanu-0.1.dev77.tar.gz 52.3 kB With provenance Details for botanu-0.1.dev77.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for botanu 0.1.dev77
File Interpreter ABI Platform Actions
botanu-0.1.dev77-py3-none-any.whl Python 3 none any Details for botanu-0.1.dev77-py3-none-any.whl

Total release size: 115.0 kB

Release files / botanu-0.1.dev77.tar.gz

Download URL botanu-0.1.dev77.tar.gz
Size 52.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ce494493d1fdbf076b1893c185e0f4a8e75ac2de93394ee56a103f011d28804e
BLAKE2b-256 checksum
How to use checksums
894dbae0555969e6f56bac0295341418e0090de8ff03256965edd22e9ac435b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 25, 2026.

Transparency log

Release files / botanu-0.1.dev77-py3-none-any.whl

Download URL botanu-0.1.dev77-py3-none-any.whl
Size 62.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf182522dd02015c9741633935f13f71e9e3f00894ad7732ca43fe022c97bdf2
BLAKE2b-256 checksum
How to use checksums
e7bbc75db4f514247acb0a2725119714011186542308296867315effed9217d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 25, 2026.

Transparency log

Security for botanu 0.1.dev77

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for botanu-0.1.dev77.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 25, 2026.

Transparency log

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.

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