Copy
Ask AI
from agno.agent import Agent
from agno.models.cohere import Cohere
agent = Agent(
model=Cohere(id="command-r-plus"),
markdown=True,
)
agent.print_response("Explain RAG architecture", stream=True)
Tool Use
Copy
Ask AI
from agno.agent import Agent
from agno.models.cohere import Cohere
from agno.tools.yfinance import YFinanceTools
agent = Agent(
model=Cohere(id="command-r-plus"),
tools=[YFinanceTools(stock_price=True)],
markdown=True,
)
agent.print_response("What's GOOGL's stock price?", stream=True)
Structured Output
Copy
Ask AI
from pydantic import BaseModel, Field
from agno.agent import Agent
from agno.models.cohere import Cohere
class Analysis(BaseModel):
summary: str = Field(..., description="Brief summary")
key_points: list[str] = Field(..., description="Key points")
agent = Agent(
model=Cohere(id="command-r-plus"),
output_schema=Analysis,
)
agent.print_response("Analyze enterprise AI adoption trends")
Run Examples
Copy
Ask AI
export CO_API_KEY=xxx
git clone https://github.com/agno-agi/agno.git
cd agno/cookbook/92_models/cohere
python basic.py
python tool_use.py
python structured_output.py