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 | |
|---|---|---|---|
| respan_instrumentation_cohere-0.1.1.tar.gz | 6.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| respan_instrumentation_cohere-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
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
|