Image analysis example using CometAPI with vision models

Stream an image description from a vision model through CometAPI.

image_agent.py
"""
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__":
    pass

Run the Example

Set up your virtual environment

uv venv --python 3.12
source .venv/bin/activate

Install dependencies

uv pip install -U agno openai

Export 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.py

Full source: cookbook/90_models/cometapi/image_agent.py