Metadata-Version: 2.5
Name: sonar-tracing
Version: 0.1.0
Summary: One-line OpenTelemetry tracing for AI agents, across frameworks.
Project-URL: Homepage, https://github.com/deep-dive-mexico/sonar
Project-URL: Repository, https://github.com/deep-dive-mexico/sonar
Project-URL: Issues, https://github.com/deep-dive-mexico/sonar/issues
Author-email: Matthew Ahmon <matthew.ahmon@gmail.com>
Maintainer-email: Matthew Ahmon <matthew.ahmon@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: agents,ai,llm,observability,opentelemetry,otel,tracing
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Monitoring
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: opentelemetry-api>=1.30
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.30
Requires-Dist: opentelemetry-sdk>=1.30
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Description-Content-Type: text/markdown

# sonar-tracing

One-line OpenTelemetry tracing for AI agents, across frameworks.

```python
import sonar_tracing as tracing

tracing.init(service_name="support-agent", framework="strands")

with tracing.identity(tenant_id="acme", session_id=session_id):
    result = agent(prompt)
```

That is the whole integration. No exporter wiring, no `TracerProvider`, no OTLP
setup — `init()` builds the production processor/exporter chain for you and
`identity()` stamps tenant/session context onto every span in scope.

## Install

```bash
pip install sonar-tracing
```

Framework support ships as a separate package. For AWS Strands, also install the
adapter — it registers itself, so there is nothing to import:

```bash
pip install sonar-tracing sonar-tracing-strands
```

## What it does

- **`init()`** — stands up a `TracerProvider` wired to an OTLP HTTP exporter,
  with redaction and identity-stamping built into the pipeline.
- **`identity()`** — a context manager that attaches tenant/session attributes
  to spans created within it.
- **Framework support is a plugin, not a branch.** Adapters are discovered from
  the `sonar_tracing.adapters` entry point group, so a new framework ships as a
  new package — core never changes.

## Requirements

- Python 3.11+
- An OTLP-compatible collector endpoint

## License

MIT — see [LICENSE](LICENSE).
