Cohere Integration
Updated on Aug 14, 2026
Use this integration when your app is implemented in Python or TypeScript.
Setup
- Install SDK
bash
pip install progress-observability
- Instrument your app
python
Observability.instrument(
app_name=os.getenv("OBSERVABILITY_APP_NAME"),
api_key=os.getenv("OBSERVABILITY_API_KEY")
)
- Complete example
python
import os
from dotenv import load_dotenv
import cohere
from progress.observability import Observability
load_dotenv()
Observability.instrument(
app_name=os.getenv("OBSERVABILITY_APP_NAME"),
api_key=os.getenv("OBSERVABILITY_API_KEY"),
)
client = cohere.ClientV2(api_key=os.getenv("COHERE_API_KEY"))
model = os.getenv("COHERE_MODEL", "command-a-03-2025")
response = client.chat(
model=model,
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of France?"},
],
temperature=0.0,
max_tokens=64,
)
Observability.shutdown()
To get a richer trace tree when building agents on top of this provider, use the
@agent,@tool,@workflow, or@taskdecorators. See the Python SDK for details.
- Install SDK
bash
npm install @progress/observability
- Instrument your app
TS
import '@progress/observability/register/hooks';
import { Observability } from '@progress/observability';
await Observability.instrument({
appName: process.env.OBSERVABILITY_APP_NAME,
apiKey: process.env.OBSERVABILITY_API_KEY
});
Note: Some span attributes such as input message, tokens and cost may not be captured for Cohere TypeScript.
- Complete example
TS
import '@progress/observability/register/hooks';
import 'dotenv/config';
// Use CohereClient (v1) — CohereClientV2 is not yet instrumented by the
// upstream OpenTelemetry package, so it produces no spans.
import { CohereClient } from 'cohere-ai';
import { Observability } from '@progress/observability';
async function main() {
await Observability.instrument({
appName: process.env.OBSERVABILITY_APP_NAME,
apiKey: process.env.OBSERVABILITY_API_KEY,
});
try {
const client = new CohereClient({ token: process.env.COHERE_API_KEY });
const model = process.env.COHERE_MODEL ?? 'command-a-03-2025';
const response = await client.chat({
model,
message: 'What is the capital of France?',
});
console.log(response.text);
} finally {
await Observability.shutdown();
}
}
main().catch(e => { console.error(e); process.exitCode = 1; });
To get a richer trace tree when building agents on top of this provider, use the
@agent,@tool,@workflow, or@taskdecorators. See the TypeScript SDK for details.