Code
generate_video_using_models_lab.py
Usage
1
Set up your virtual environment
2
Install dependencies
3
Export your OpenAI API key
4
Run Agent
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.models_labs import ModelsLabTools
video_agent = Agent(
model=OpenAIResponses(id="gpt-5.2"),
tools=[ModelsLabTools()],
description="You are an AI agent that can generate videos using the ModelsLabs API.",
instructions=[
"When the user asks you to create a video, use the `generate_media` tool to create the video.",
"The video will be displayed in the UI automatically below your response, so you don't need to show the video URL in your response.",
"Politely and courteously let the user know that the video has been generated and will be displayed below as soon as its ready.",
],
markdown=True,
)
video_agent.print_response("Generate a video of a cat playing with a ball")
# print(video_agent.run_response.videos)
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
Export your OpenAI API key
export OPENAI_API_KEY="your_openai_api_key_here"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
Run Agent
python cookbook/03_agents/multimodal/generate_video_using_models_lab.py
Was this page helpful?