agent_with_media.py
"""
Agent With Media
================
AG-UI agent that accepts multimodal input (images, audio, video, documents).
Uses Google Gemini to analyze attached files. Set GOOGLE_API_KEY env var.
"""
from agno.agent.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.google import Gemini
from agno.os import AgentOS
from agno.os.interfaces.agui import AGUI
# ---------------------------------------------------------------------------
# Create Example
# ---------------------------------------------------------------------------
media_agent = Agent(
name="Media Agent",
model=Gemini(id="gemini-2.5-flash"),
db=SqliteDb(db_file="/tmp/agui_agent_with_media.db"),
instructions="Analyze any image, audio, video, or document the user sends and answer their question about it.",
add_datetime_to_context=True,
markdown=True,
)
# Setup your AgentOS app
# Dojo expects: http://localhost:9001/agentic_chat_multimodal/agui
agent_os = AgentOS(
agents=[media_agent],
interfaces=[AGUI(agent=media_agent, prefix="/agentic_chat_multimodal")],
)
app = agent_os.get_app()
# ---------------------------------------------------------------------------
# Run Example
# ---------------------------------------------------------------------------
if __name__ == "__main__":
agent_os.serve(app="agent_with_media:app", port=9001, reload=True)
Run the Example
1
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
uv venv --python 3.12
.venv\Scripts\activate
2
Install dependencies
uv pip install -U "agno[agui,os]" google-genai
3
Export your Google API key
export GOOGLE_API_KEY="your_google_api_key_here"
$Env:GOOGLE_API_KEY="your_google_api_key_here"
4
Run the example
Save the code above as
agent_with_media.py, then run:python agent_with_media.py