Skip to main content
MiniMaxTools enable an Agent to generate videos from text prompts with MiniMax’s video generation API. Generation is asynchronous on MiniMax’s side: the tool submits the job, polls until it finishes, and returns the video as a remote URL.

Prerequisites

No extra package is required beyond agno — the toolkit uses httpx, an Agno core dependency. The example also uses the openai library:
Set the MINIMAX_API_KEY environment variable. Get your key from MiniMax’s platform.
Without the key, construction logs an error and every call returns “Please set the MINIMAX_API_KEY” as the tool result.

Example

cookbook/91_tools/minimax_tools.py

How Generation Runs

generate_video submits the prompt, reads the task id from the response, and polls the task status every poll_interval seconds until MiniMax reports it succeeded, failed, or cancelled — or until max_wait_time is reached. The tool call blocks for the whole wait; each poll request times out at timeout seconds, clipped to the remaining budget. On success, the tool returns “Video generated successfully” with the video attached as an agno.media.Video artifact carrying a remote URL (video/mp4). The bytes are never downloaded — how long MiniMax serves the URL is MiniMax’s side; see MiniMax’s platform docs. The tool never raises. Every failure comes back as the tool result’s text: a missing task id or video URL, the failure message on a failed or cancelled task, “Video generation timed out after max_wait_time seconds”, or “Error generating video: …” for HTTP errors.

Custom Endpoints

region selects the default endpoint: "global_en" uses https://api.minimax.io/v2/video_generation and "cn_zh" uses https://api.minimaxi.com/v2/video_generation. Any other value raises a ValueError at construction — also when base_url is set. base_url, when set, overrides the region default and must be the full video-generation endpoint. The task-status endpoint is not configurable separately: it is derived by replacing /v2/video_generation with /v2/query/video_generation in base_url, with the task id appended. A trailing slash is stripped.
A base_url without the /v2/video_generation path breaks polling: the submit request goes to the URL as-is and the status poll goes to <base_url>/<task_id>, failing at request time as an “Error generating video” tool result. Nothing fails at construction.

Toolkit Params

Toolkit Functions

The function has an async variant registered under the same name, used automatically with arun and aprint_response.

Developer Resources