This is a living integration. Should you need any added functionality message us on Discord!

Cohere

First class support for Command-R-Plus thumbnail

1

Install the AgentOps SDK

pip install agentops
Give us a star on GitHub while you’re at it (you may be our 2,000th 😊)
2

Add 3 lines of code

import agentops

# Beginning of program (i.e. main.py, __init__.py)
# IMPORTANT: Must be before calling `co = cohere.Client()`
agentops.init(<INSERT YOUR API KEY HERE>)
co = cohere.Client()
...
# End of program (e.g. main.py)
agentops.end_session("Success") # Success|Fail|Indeterminate

Requires cohere>=5.4.0

Instantiating the AgentOps client will automatically instrument Cohere, meaning you will be able to see all of your sessions on the AgentOps Dashboard along with the full LLM chat histories, cost, token counts, etc.

For more features see our Usage section.

3

Set your API key

Retrieve an API Key from your Settings > Projects & API Keys page.

Settings > Projects & API Keys

API keys are tied to individual projects.
A Default Project has been created for you, so just click Copy API Key

Set this API Key in your environment variables

.env
AGENTOPS_API_KEY=<YOUR API KEY>
4

Run your Agent

Execute your program and visit app.agentops.ai/drilldown to observe your Agents! 🕵️

After your run, AgentOps prints a clickable url to console linking directly to your session in the Dashboard

Clickable link to session

Full Examples

import cohere
import agentops

agentops.init(<INSERT YOUR API KEY HERE>)

co = cohere.Client()

chat = co.chat(
    message="Is it pronounced ceaux-hear or co-hehray?"
)

print(chat)

agentops.end_session('Success')