Metadata-Version: 2.5
Name: sonar-tracing-langchain
Version: 0.5.1
Summary: LangChain / LangGraph adapter for sonar-tracing.
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,langchain,langgraph,opentelemetry,sonar,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: langchain-core>=0.3
Requires-Dist: openinference-instrumentation-langchain>=0.1
Requires-Dist: sonar-tracing>=0.1
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Description-Content-Type: text/markdown

# sonar-tracing-langchain

LangChain / LangGraph adapter for [`sonar-tracing`](https://pypi.org/project/sonar-tracing/).

Installing this package makes the `langchain` framework available to
`sonar-tracing` — the adapter is discovered automatically via the
`sonar_tracing.adapters` entry point group, so there's nothing to import or wire
up by hand.

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

```python
import sonar_tracing as tracing

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

Unlike Strands, LangChain is not OpenTelemetry-native. This adapter installs the
OpenInference `LangChainInstrumentor`, handing it the tracer provider
`sonar-tracing` owns. The instrumentor patches `langchain-core`'s callback
manager, so the same integration captures both LangChain and LangGraph — there
is no separate LangGraph package to install.

Spans are emitted under the OpenInference semantic conventions and normalised by
the `openinference@1` mapping pack on the ingest side.

## License

MIT — see [LICENSE](LICENSE).
