Together Image Agent Bytes

Send local image bytes to a current Together vision model and stream the description.

Together retired the source's meta-llama/Llama-Vision-Free serverless model. Select a current vision model from the Together serverless catalog before running. See Together vision inputs.

image_agent_bytes.py
"""
Together Image Agent Bytes
==========================

Cookbook example for `together/image_agent_bytes.py`.
"""

from pathlib import Path

from agno.agent import Agent
from agno.media import Image
from agno.models.together import Together

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

agent = Agent(
    model=Together(id="meta-llama/Llama-Vision-Free"),
    markdown=True,
)

image_path = Path(__file__).parent.joinpath("sample.jpg")

# Read the image file content as bytes
image_bytes = image_path.read_bytes()

agent.print_response(
    "Tell me about this image",
    images=[
        Image(content=image_bytes),
    ],
    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 TOGETHER_API_KEY="your_together_api_key_here"
export TOGETHER_VISION_MODEL_ID="your_current_together_vision_model_id_here"

Use the selected vision model

Add import os, then replace Together(id="meta-llama/Llama-Vision-Free") with Together(id=os.environ["TOGETHER_VISION_MODEL_ID"]) in the saved file.

Add the sample image

Place a JPEG named sample.jpg in the same directory as image_agent_bytes.py.

Run the example

Save the code above as image_agent_bytes.py, then run:

python image_agent_bytes.py

Full source: cookbook/90_models/together/image_agent_bytes.py