# Azure Image Agent Bytes (/examples/models/azure/ai-foundry/image-agent-bytes)



The source-fidelity code uses a retired Azure AI Foundry model. Replace it with Llama 4 Scout before running the example.

<Warning>
  Microsoft retired `Llama-3.2-11B-Vision-Instruct` on June 13, 2026. Deploy `Llama-4-Scout-17B-16E-Instruct`, point `AZURE_ENDPOINT` at that deployment, and replace the model ID before running. See the [Azure model retirement schedule](https://learn.microsoft.com/en-us/azure/foundry/openai/concepts/model-retirement-schedule?view=foundry-classic).
</Warning>

<Note>
  This source uses Agno's classic `AzureAIFoundry` adapter and the `azure-ai-inference` package, which Microsoft [retired on August 26, 2026](https://learn.microsoft.com/en-us/azure/foundry/how-to/navigate-from-classic#sdk-mapping). Existing endpoint availability is separate from SDK retirement. For a new integration, use the [current Foundry API setup](/models/providers/cloud/azure-ai-foundry/overview#current-foundry-api) with a compatible deployment. The classic setup below applies only to an existing compatible endpoint unless a current adaptation is explicitly provided.
</Note>

```python title="image_agent_bytes.py"
"""
Azure Image Agent Bytes
=======================

Cookbook example for `azure/ai_foundry/image_agent_bytes.py`.
"""

from pathlib import Path

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

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

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

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

download_image(
    url="https://upload.wikimedia.org/wikipedia/commons/0/0c/GoldenGateBridge-001.jpg",
    output_path=str(image_path),
)

# 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 Classic Example [#run-the-classic-example]

<Steps>
    <Step title="Set up your virtual environment">
      <CodeBlockTabs defaultValue="Mac">
        <CodeBlockTabsList>
          <CodeBlockTabsTrigger value="Mac">
            Mac
          </CodeBlockTabsTrigger>

          <CodeBlockTabsTrigger value="Windows">
            Windows
          </CodeBlockTabsTrigger>
        </CodeBlockTabsList>

        <CodeBlockTab value="Mac">
          ```bash
          uv venv --python 3.12
          source .venv/bin/activate
          ```
        </CodeBlockTab>

        <CodeBlockTab value="Windows">
          ```bash
          uv venv --python 3.12
          .venv\Scripts\activate
          ```
        </CodeBlockTab>
      </CodeBlockTabs>
    </Step>

  <Step title="Install dependencies">
    ```bash
    uv pip install -U agno aiohttp azure-ai-inference
    ```
  </Step>

  <Step title="Export environment variables">
    <CodeBlockTabs defaultValue="Mac/Linux">
      <CodeBlockTabsList>
        <CodeBlockTabsTrigger value="Mac/Linux">
          Mac/Linux
        </CodeBlockTabsTrigger>

        <CodeBlockTabsTrigger value="Windows">
          Windows
        </CodeBlockTabsTrigger>
      </CodeBlockTabsList>

      <CodeBlockTab value="Mac/Linux">
        ```bash
        export AZURE_API_KEY="your_azure_api_key_here"
        export AZURE_ENDPOINT="your_azure_endpoint_here"
        ```
      </CodeBlockTab>

      <CodeBlockTab value="Windows">
        ```powershell
        $Env:AZURE_API_KEY="your_azure_api_key_here"
        $Env:AZURE_ENDPOINT="your_azure_endpoint_here"
        ```
      </CodeBlockTab>
    </CodeBlockTabs>
  </Step>

  <Step title="Use Llama 4 Scout">
    Deploy `Llama-4-Scout-17B-16E-Instruct`, update `AZURE_ENDPOINT`, and replace `Llama-3.2-11B-Vision-Instruct` in the saved file.
  </Step>

  <Step title="Run the example">
    Save the code above as `image_agent_bytes.py`, then run:

    ```bash
    python image_agent_bytes.py
    ```
  </Step>
</Steps>

Full source: [cookbook/90\_models/azure/ai\_foundry/image\_agent\_bytes.py](https://github.com/agno-agi/agno/blob/8f36eaf2d18e91afa7b327eec66a3cd3685dcb87/cookbook/90_models/azure/ai_foundry/image_agent_bytes.py)
