Input Formats
Send text and images through Agno media objects or an explicit Chat-compatible model.
"""
Input Formats
=============================
Input Formats.
"""
from agno.agent import Agent
# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------
agent = Agent()
# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
agent.print_response(
{
"role": "user",
"content": [
{"type": "text", "text": "What's in this image?"},
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg",
},
},
],
},
stream=True,
markdown=True,
)Use the current default model
The preserved cookbook block uses Chat-format text and image_url parts, but Agent() currently defaults to OpenAIResponses. That adapter expects Responses content types. Save this complete version as input_formats.py for the run steps below; Agno converts Image to the model's input format:
from agno.agent import Agent
from agno.media import Image
agent = Agent()
agent.print_response(
"What's in this image?",
images=[Image(url="https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg")],
stream=True,
markdown=True,
)To keep the original Chat-format dict instead, import OpenAIChat from agno.models.openai and construct Agent(model=OpenAIChat(id="gpt-5.2")).
Run the Example
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateInstall dependencies
uv pip install -U agno openaiExport your OpenAI API key
export OPENAI_API_KEY="your_openai_api_key_here"Run the example
Save the current adaptation as input_formats.py, then run:
python input_formats.pyFull source: cookbook/02_agents/02_input_output/input_formats.py