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 cohere

Authentication

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

ParameterTypeDefaultDescription
idstr"command-a-03-2025"The specific model ID used for generating responses.
namestr"cohere"The name identifier for the model.
providerstr"Cohere"The provider of the model.
temperatureOptional[float]NoneNon-negative sampling temperature. Higher values increase randomness; see the Cohere Chat API for model-specific guidance.
max_tokensOptional[int]NoneThe maximum number of tokens to generate in the response.
top_kOptional[int]NoneThe number of highest probability vocabulary tokens to keep for top-k-filtering.
top_pOptional[float]NoneNucleus sampling parameter. The model considers the results of the tokens with top_p probability mass.
frequency_penaltyOptional[float]NoneNumber between 0 and 1. Higher values reduce repetition based on each token's frequency.
presence_penaltyOptional[float]NoneNumber between 0 and 1. Higher values reduce repetition based on whether a token has appeared.
seedOptional[int]NoneRandom seed for best-effort reproducibility; determinism is not guaranteed.
logprobsOptional[bool]NoneWhether to return log probabilities of the output tokens.
request_paramsOptional[Dict[str, Any]]NoneAdditional parameters to include in the request.
strict_toolsboolFalseWhether to use strict mode for tools (enforce strict parameter requirements).
add_chat_historyboolFalseCompatibility field; currently has no effect. Use Agent history configuration to include stored messages.
api_keyOptional[str]NoneThe API key for authenticating requests to the Cohere service.
client_paramsOptional[Dict[str, Any]]NoneCompatibility field; currently ignored. Pass a configured cohere.ClientV2 or cohere.AsyncClientV2 through client or async_client.
http_clientOptional[Union[httpx.Client, httpx.AsyncClient]]NoneA custom httpx client to use for requests. Pass an httpx.Client for the sync client or an httpx.AsyncClient for the async client.
clientOptional[CohereClient]NoneA pre-configured instance of the Cohere client.
async_clientOptional[CohereAsyncClient]NoneA 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.

Developer Resources