Image analysis example using CometAPI with vision models
Stream an image description from a vision model through CometAPI.
"""
Image analysis example using CometAPI with vision models.
"""
from agno.agent import Agent
from agno.media import Image
from agno.models.cometapi import CometAPI
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
# Use a vision-capable model from CometAPI
agent = Agent(
model=CometAPI(id="gpt-5.6-luna"), # gpt-5.6-luna has vision capabilities
markdown=True,
)
agent.print_response(
"Describe this image in detail and tell me what you can see",
images=[
Image(
url="https://httpbin.org/image/png" # Reliable test image
)
],
stream=True,
)
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
passRun the Example
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U agno openaiExport environment variables
export COMETAPI_KEY="your_cometapi_key_here"Run the example
Save the code above as image_agent.py, then run:
python image_agent.pyFull source: cookbook/90_models/cometapi/image_agent.py