Sentry integration
Cohere's Sentry integration allows you to attach Cohere Replay sessions directly to Sentry reports.
In order to use the Sentry integration, you must be on a Pro plan or have the Cohere Replay add-on. To upgrade, return to your dashboard and go to Settings → Add Cohere Replay.

cohere-sentry NPM module

First, make sure you're using @sentry/browser >=1.0.0 and cohere-js >=1.0.19. Next, install the NPM module:
npm install --save cohere-sentry
Finally, update your Sentry initialization:
import * as Sentry from '@sentry/browser';
import Cohere from 'cohere-js';
import CohereSentry from 'cohere-sentry';
integrations: [ new CohereSentry(), ],
// ...

Manual integration

If you're unable to use the NPM module, you can manually integrate into Sentry. Copy the following code and paste it right after you initialize Sentry and Cohere:
const sessionUrlListener = (sessionUrl) => {
Sentry.configureScope((scope) => {
scope.addEventProcessor((event) => {
event.contexts = {
Cohere: {
"Cohere Session URL": `${sessionUrl}${
event.timestamp ? `?ts=${event.timestamp * 1000}` : ""
return event;
// If calling the above code multiple times (e.g. React useEffect), don't forget to clean up!
// Cohere.removeSessionUrlListener(sessionUrlListener);
Don't add any other Sentry configuration in the session URL listener, as the listener will not run if a session URL is not found, and the listener will run every time a new session URL is generated. To avoid any unexpected behavior, put unrelated Sentry configuration outside the listener.
Copy link
On this page
cohere-sentry NPM module
Manual integration