Image Agent
Code
1from kern.agent import Agent2from kern.media import Image3from kern.models.cohere import Cohere45agent = Agent(6 model=Cohere(id="c4ai-aya-vision-8b"),7 markdown=True,8)910agent.print_response(11 "Tell me about this image.",12 images=[13 Image(14 url="https://upload.wikimedia.org/wikipedia/commons/0/0c/GoldenGateBridge-001.jpg"15 )16 ],17 stream=True,18)Usage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateSet your API key
1export CO_API_KEY=xxxInstall dependencies
1uv pip install -U cohere kern-aiRun Agent
1python cookbook/11_models/cohere/image_agent.py