Documentation Index
Fetch the complete documentation index at: https://agno-v2-rbac-doc-update.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Code
cookbook/05_agent_os/interfaces/whatsapp/image_generation_model.py
from agno.agent import Agent
from agno.db.sqlite import SqliteDb
from agno.models.google import Gemini
from agno.os.app import AgentOS
from agno.os.interfaces.whatsapp import Whatsapp
agent_db = SqliteDb(db_file="tmp/persistent_memory.db")
image_agent = Agent(
id="image_generation_model",
db=agent_db,
model=Gemini(
id="models/gemini-2.5-flash-image",
response_modalities=["Text", "Image"],
),
)
agent_os = AgentOS(
agents=[image_agent],
interfaces=[Whatsapp(agent=image_agent)],
)
app = agent_os.get_app()
if __name__ == "__main__":
agent_os.serve(app="image_generation_model:app", reload=True)
Usage
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activate
Set Environment Variables
export WHATSAPP_ACCESS_TOKEN=your_access_token
export WHATSAPP_PHONE_NUMBER_ID=your_phone_number_id
export WHATSAPP_VERIFY_TOKEN=your_verify_token
export WHATSAPP_SKIP_SIGNATURE_VALIDATION=true # For local dev
export GOOGLE_API_KEY=your_google_api_key
See the WhatsApp Bot setup guide for how to get these values from the Meta Developer Dashboard.Install dependencies
uv pip install -U agno google-generativeai
Run Example
python cookbook/05_agent_os/interfaces/whatsapp/image_generation_model.py
Key Features
- Direct Image Generation: Gemini Flash with native image generation
- Text-to-Image: Converts descriptions into visual content
- Multimodal Responses: Generates both text and images
- WhatsApp Integration: Sends images directly through WhatsApp