respan-instrumentation-cohere
Respan instrumentation plugin for the Cohere Python SDK. It activates opentelemetry-instrumentation-cohere and normalizes Cohere spans to the Respan span contract before export.
Install
pip install respan-ai respan-instrumentation-cohere cohere python-dotenv
Environment
| Variable | Required | Description |
|---|---|---|
RESPAN_API_KEY |
Yes | Respan API key used to export traces. |
RESPAN_BASE_URL |
No | Respan API base URL. Defaults to https://api.respan.ai/api. |
CO_API_KEY |
Yes | Cohere API key used by the Cohere SDK. |
Quickstart
import os
import cohere
from dotenv import load_dotenv
from respan import Respan, workflow
from respan_instrumentation_cohere import CohereInstrumentor
load_dotenv()
respan = Respan(
api_key=os.environ["RESPAN_API_KEY"],
instrumentations=[CohereInstrumentor()],
)
client = cohere.ClientV2(api_key=os.environ["CO_API_KEY"])
@workflow(name="cohere_chat_quickstart")
def run_chat() -> str:
response = client.chat(
model=os.getenv("COHERE_CHAT_MODEL", "command-a-03-2025"),
messages=[
{
"role": "user",
"content": "Say hello in three languages.",
}
],
)
return response.message.content[0].text
print(run_chat())
respan.flush()
Notes
The upstream Cohere OpenTelemetry instrumentor emits Cohere SDK spans. This package adds a Respan span processor that:
- sets
gen_ai.systemtocohere - adds
respan.entity.log_type - publishes both modern and legacy token usage attributes
- converts indexed tool definitions and tool calls into JSON string attributes
- strips off-contract shortcut aliases before export
Metadata
Release files for respan-instrumentation-cohere 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| respan_instrumentation_cohere-0.1.1.tar.gz | 6.8 kB | Without provenance | Details for respan_instrumentation_cohere-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| respan_instrumentation_cohere-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for respan_instrumentation_cohere-0.1.1-py3-none-any.whl |
Total release size: 15.4 kB
Release files / respan_instrumentation_cohere-0.1.1.tar.gz
| Download URL | respan_instrumentation_cohere-0.1.1.tar.gz |
|---|---|
| Size | 6.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d7eb9b7bf4ae066d784fd5546db7ac8ff7b9558b1d05a5f8a5f8b175363c1d98
|
|
BLAKE2b-256 checksum How to use checksums |
83b88275e8d15078bef979e25ed0bb3201fce540829d84d442a09b86b0eff794
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / respan_instrumentation_cohere-0.1.1-py3-none-any.whl
| Download URL | respan_instrumentation_cohere-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e1569341f6b17433d4d1b2260926a38a07dd500e5dd76c45a5d33ddf11dd3520
|
|
BLAKE2b-256 checksum How to use checksums |
2ae2344eb124f38ef16728120b13f8b16911e6c2694a343776f49d392449ed1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for respan-instrumentation-cohere 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.