Hello, I’ve been trying to create an agent with video input. Is it not possible to pass a video URL to the agent?
If I try to pass a url then I get Value error, One of 'filepath' or 'content' must be provided.
Hi there, thanks for reaching out and supporting Agno. I’ve shared this with the team, we’re working through all requests one by one and will get back to you soon.
If it’s urgent, please let us know.
In the meantime please help me with your agent configuration
We appreciate your patience!
Sharing a code snippet below:
from agno.agent import Agent
from agno.media import Video
from agno.models.google import Gemini
agent = Agent(
model=Gemini(id="gemini-2.0-flash-exp"),
markdown=True,
)
video_url = "https://storage.googleapis.com/generativeai-downloads/images/GreatRedSpot.mp4"
agent.print_response("Tell me about this video", videos=[Video(url=video_url)])
Hey @vish, currently video inputs for agents only support local files. Can you provide a local file URL? Alternatively, you can create a function to download the video and then pass the local URL to the agent. Something like this -
def download_video(video_url, local_file_name="downloaded_video.mp4"):
response = requests.get(video_url, stream=True)
response.raise_for_status() # Raise an error if the download fails
with open(local_file_name, "wb") as file:
for chunk in response.iter_content(chunk_size=8192):
file.write(chunk)
return local_file_name
# Usage example:
video_url = "https://storage.googleapis.com/generativeai-downloads/images/GreatRedSpot.mp4"
video_path = download_video(video_url, "GreatRedSpot_local.mp4")
print("Video downloaded to:", video_path)