image_input_file.py
Run the Example
1
Set up your virtual environment
2
Install dependencies
3
Export your Meta Llama API key
4
Run the example
Save the code above as
image_input_file.py, then run:Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Attach a local image file to a Llama 4 Maverick agent and stream its description.
"""
Meta Image Input File
=====================
Cookbook example for `meta/llama/image_input_file.py`.
"""
from pathlib import Path
from agno.agent import Agent
from agno.media import Image
from agno.models.meta import Llama
from agno.utils.media import download_image
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent(
model=Llama(id="Llama-4-Maverick-17B-128E-Instruct-FP8"),
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),
)
agent.print_response(
"Tell me about this image?",
images=[Image(filepath=image_path)],
stream=True,
)
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
pass
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
Install dependencies
uv pip install -U agno llama-api-client
Export your Meta Llama API key
export LLAMA_API_KEY="your_llama_api_key_here"
$Env:LLAMA_API_KEY="your_llama_api_key_here"
Run the example
image_input_file.py, then run:python image_input_file.py
Was this page helpful?