Cohere
Use Cohere's Command models with Agno agents.
Pass a model ID from the Cohere model catalog to Cohere. The default is command-a-03-2025.
Installation
uv pip install -U agno cohereAuthentication
Set CO_API_KEY. Create a key in the Cohere dashboard.
export CO_API_KEY="YOUR_API_KEY"Example
Use Cohere with your Agent:
from agno.agent import Agent
from agno.models.cohere import Cohere
agent = Agent(
model=Cohere(id="command-a-03-2025"),
markdown=True
)
# Print the response in the terminal
agent.print_response("Share a 2 sentence horror story.")
Params
| Parameter | Type | Default | Description |
|---|---|---|---|
id | str | "command-a-03-2025" | The specific model ID used for generating responses. |
name | str | "cohere" | The name identifier for the model. |
provider | str | "Cohere" | The provider of the model. |
temperature | Optional[float] | None | Non-negative sampling temperature. Higher values increase randomness; see the Cohere Chat API for model-specific guidance. |
max_tokens | Optional[int] | None | The maximum number of tokens to generate in the response. |
top_k | Optional[int] | None | The number of highest probability vocabulary tokens to keep for top-k-filtering. |
top_p | Optional[float] | None | Nucleus sampling parameter. The model considers the results of the tokens with top_p probability mass. |
frequency_penalty | Optional[float] | None | Number between 0 and 1. Higher values reduce repetition based on each token's frequency. |
presence_penalty | Optional[float] | None | Number between 0 and 1. Higher values reduce repetition based on whether a token has appeared. |
seed | Optional[int] | None | Random seed for best-effort reproducibility; determinism is not guaranteed. |
logprobs | Optional[bool] | None | Whether to return log probabilities of the output tokens. |
request_params | Optional[Dict[str, Any]] | None | Additional parameters to include in the request. |
strict_tools | bool | False | Whether to use strict mode for tools (enforce strict parameter requirements). |
add_chat_history | bool | False | Compatibility field; currently has no effect. Use Agent history configuration to include stored messages. |
api_key | Optional[str] | None | The API key for authenticating requests to the Cohere service. |
client_params | Optional[Dict[str, Any]] | None | Compatibility field; currently ignored. Pass a configured cohere.ClientV2 or cohere.AsyncClientV2 through client or async_client. |
http_client | Optional[Union[httpx.Client, httpx.AsyncClient]] | None | A custom httpx client to use for requests. Pass an httpx.Client for the sync client or an httpx.AsyncClient for the async client. |
client | Optional[CohereClient] | None | A pre-configured instance of the Cohere client. |
async_client | Optional[CohereAsyncClient] | None | A pre-configured instance of the async Cohere client. |
Cohere is a subclass of the Model class and has access to the same params.
For stored conversation history, configure Agent(db=..., add_history_to_context=True). The adapter formats the messages supplied by the agent; add_chat_history does not switch to a provider-managed conversation. See the Cohere Chat API for request constraints.