You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"// PURPOSE": "Makes Cursor / VS Code show ruff + mypy warnings inline while you edit. Install the 'Ruff' and 'Python' extensions from the Cursor extension panel for full effect.",
runs `twine check`, installs into a fresh venv, validates the public
41
-
API surface, runs an end-to-end decorator + `emit_outcome` smoke test.
10
+
### Breaking
42
11
43
-
### Fixed
12
+
- Primary API is now `botanu.event(...)` — works as context manager, async context manager, and decorator. The legacy `@botanu_workflow`, `workflow` alias, `run_botanu`, and `@botanu_outcome` decorators are removed.
13
+
-`emit_outcome` is keyword-only and no longer accepts a `status` argument. Authoritative event outcome is resolved server-side from SoR connectors, HITL reviews, or eval verdict rollup.
14
+
- Lean baggage propagation is removed. All seven baggage keys (plus any retry/deadline keys when set) always propagate. The `BOTANU_PROPAGATION_MODE` env var, the `propagation_mode` field on `BotanuConfig`, `BAGGAGE_KEYS_LEAN`, and the `lean_mode` parameter on `RunContextEnricher` / `RunContext.to_baggage_dict` are all gone.
44
15
45
-
-`SampledSpanProcessor.on_start` now gates on the same ratio decision as
46
-
`on_end`; forwarding `on_start` unconditionally while gating `on_end`
-`botanu.event(...)` as context manager, async context manager, and decorator — a single API for marking business events.
19
+
-`botanu.step(name)` for nested phase spans inside an event.
20
+
- SDK initialises automatically on the first `botanu.event(...)` call. Customers no longer need to call any bootstrap function by hand.
21
+
-`botanu.set_correlation(**keys)` for SoR Tier-1 correlation.
22
+
- Security: OTLP bearer token is attached only when the endpoint host is botanu-owned (`*.botanu.ai`) or a local dev host, preventing tenant API-key leakage via a customer-supplied `OTEL_EXPORTER_OTLP_ENDPOINT`. Authorization / `x-api-key` / `botanu-api-key` headers and `user:pass@` URL credentials are redacted in logs.
23
+
- OTel coexistence: when the host app already has the OTel SDK wired up, botanu preserves the existing sampling ratio and adds itself alongside. `register.py` module for zero-code initialisation in containers / gunicorn / process runners.
24
+
- Content capture for eval, gated by `content_capture_rate`. Writes `botanu.eval.input_content` / `botanu.eval.output_content` with in-process PII scrub (regex by default; optional Microsoft Presidio via `pip install botanu[pii-nlp]`).
25
+
-`ResourceEnricher` span processor for deployment attributes.
26
+
- Release tooling: `scripts/pre_publish_check.py` — builds sdist + wheel, runs `twine check`, installs into a fresh venv, validates the public API surface, runs an end-to-end smoke test.
50
27
51
-
Carried forward from the pre-tag scaffolding (never published):
- Data tracking: `track_db_operation()`, `track_storage_operation()`,
59
-
`track_messaging_operation()`; 30+ system normalizations.
60
-
- W3C Baggage propagation with `RunContext` (retry tracking + deadline).
61
-
- Cloud resource detectors via optional extras (`aws`, `gcp`, `azure`,
62
-
`container`, `cloud`).
63
-
- Auto-instrumentation bundled in the base install — HTTP clients, web
64
-
frameworks, databases, messaging, and GenAI providers; instrumentation
65
-
packages no-op when their target library is not installed.
30
+
-`SampledSpanProcessor.on_start` now gates on the same ratio decision as `on_end`; forwarding `on_start` unconditionally while gating `on_end` leaked span bookkeeping inside wrapped exporters.
Copy file name to clipboardExpand all lines: README.md
+64-45Lines changed: 64 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,13 @@ This SDK is built on [OpenTelemetry](https://opentelemetry.io/) for event-level
8
8
9
9
## Getting Started
10
10
11
+
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.
11
12
13
+
## Install
14
+
15
+
```bash
16
+
pip install botanu
17
+
```
12
18
13
19
An **event** is one business transaction — resolving a support ticket, processing
14
20
an order, generating a report. Each event may involve multiple **runs** (LLM calls,
@@ -17,91 +23,104 @@ stable `event_id`, botanu gives you per-event cost attribution and outcome
17
23
tracking without sampling artifacts.
18
24
19
25
```bash
20
-
pip install botanu
26
+
export BOTANU_API_KEY=<your-api-key>
21
27
```
22
28
23
-
One install. Includes OTel SDK, OTLP exporter, and auto-instrumentation for
24
-
50+ libraries.
29
+
Wrap your agent:
25
30
26
31
```python
27
-
from botanu import enable, botanu_workflow, emit_outcome
32
+
import botanu
33
+
34
+
with botanu.event(event_id=ticket.id, customer_id=user.id, workflow="Support"):
35
+
agent.run(ticket)
36
+
```
37
+
38
+
That single wrap captures every LLM call, HTTP call, and DB call inside and stamps them with `event_id`, `customer_id`, and `workflow`.
28
39
29
-
enable() # reads config from environment variables
|[`event` / `step` API](./docs/api/event.md)| Primary API reference |
86
+
|[Best Practices](./docs/patterns/best-practices.md)| Patterns that work |
87
+
|[Anti-Patterns](./docs/patterns/anti-patterns.md)| Patterns that break cost attribution |
58
88
59
89
## Requirements
60
90
61
-
- Python 3.9+
62
-
- OpenTelemetry Collector (recommended for production)
91
+
- Python 3.9 or newer
92
+
-An OpenTelemetry Collector (Botanu Cloud runs one for you; self-hosted is supported too)
63
93
64
94
## Contributing
65
95
66
-
We welcome contributions from the community. Please read our
67
-
[Contributing Guide](./CONTRIBUTING.md) before submitting a pull request.
96
+
Contributions are welcome. Read the [Contributing Guide](./CONTRIBUTING.md) before opening a pull request.
68
97
69
-
This project requires [DCO sign-off](https://developercertificate.org/) on all
70
-
commits:
98
+
All commits require [DCO sign-off](https://developercertificate.org/):
71
99
72
100
```bash
73
101
git commit -s -m "Your commit message"
74
102
```
75
103
76
-
Looking for a place to start? Check the
77
-
[good first issues](https://github.com/botanu-ai/botanu-sdk-python/labels/good%20first%20issue).
104
+
Looking for a place to start? See the [good first issues](https://github.com/botanu-ai/botanu-sdk-python/labels/good%20first%20issue).
78
105
79
106
## Community
80
107
81
108
-[GitHub Discussions](https://github.com/botanu-ai/botanu-sdk-python/discussions) — questions, ideas, show & tell
82
-
-[GitHub Issues](https://github.com/botanu-ai/botanu-sdk-python/issues) — bug reports and feature requests
109
+
-[GitHub Issues](https://github.com/botanu-ai/botanu-sdk-python/issues) — bugs and feature requests
83
110
84
111
## Governance
85
112
86
-
See [GOVERNANCE.md](./GOVERNANCE.md) for details on roles, decision-making,
87
-
and the contributor ladder.
88
-
89
-
Current maintainers are listed in [MAINTAINERS.md](./MAINTAINERS.md).
113
+
See [GOVERNANCE.md](./GOVERNANCE.md) for roles, decision-making, and the contributor ladder. Current maintainers are in [MAINTAINERS.md](./MAINTAINERS.md).
or see [SECURITY.md](./SECURITY.md) for full details. **Do not file a public issue.**
117
+
Report security vulnerabilities via [GitHub Security Advisories](https://github.com/botanu-ai/botanu-sdk-python/security/advisories/new) or see [SECURITY.md](./SECURITY.md). **Do not file a public issue.**
96
118
97
119
98
120
## Code of Conduct
99
121
100
-
This project follows the
101
-
[LF Projects Code of Conduct](https://lfprojects.org/policies/code-of-conduct/).
102
-
See [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md).
122
+
This project follows the [LF Projects Code of Conduct](https://lfprojects.org/policies/code-of-conduct/). See [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md).
0 commit comments