Agent with Image Input

Migrate a classic Foundry image example to a current vision deployment.

Classic adapter: its SDK is retired. See the migration example.

The retained example below is historical: Llama-3.2-11B-Vision-Instruct retired on June 13, 2026. For a current version, follow the Foundry API setup with a vision-capable Chat Completions deployment and use this local-image adaptation:

foundry_image.py
from os import environ
from pathlib import Path

from agno.agent import Agent
from agno.media import Image
from agno.models.openai.like import OpenAILike

image_path = Path("sample.jpg")
if not image_path.is_file():
    raise FileNotFoundError("Place sample.jpg in the working directory")

agent = Agent(model=OpenAILike(
    id=environ["FOUNDRY_DEPLOYMENT"],
    api_key=environ["FOUNDRY_API_KEY"],
    base_url=environ["FOUNDRY_BASE_URL"],
))
agent.print_response("Describe this image.", images=[Image(filepath=image_path)])

Save this adaptation as foundry_image.py, place sample.jpg in the working directory, and run python foundry_image.py. The code and usage steps below describe the legacy integration and cannot provision the retired model.

Code

from agno.agent import Agent
from agno.media import Image
from agno.models.azure import AzureAIFoundry

agent = Agent(
    model=AzureAIFoundry(id="Llama-3.2-11B-Vision-Instruct"),
    markdown=True,
)

agent.print_response(
    "Tell me about this image.",
    images=[
        Image(
            url="https://raw.githubusercontent.com/Azure/azure-sdk-for-python/main/sdk/ai/azure-ai-inference/samples/sample1.png",
            detail="high",
        )
    ],
    stream=True,
)

Usage

Set up your virtual environment

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

Set your API key

export AZURE_API_KEY=xxx
export AZURE_ENDPOINT=xxx

Install dependencies

uv pip install -U azure-ai-inference aiohttp agno

Run Agent

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

python image_agent.py