generate • AI Agent SDK

generate: Generate a video from a text prompt.

generate

Method

</div>

This is a method of the VideoAgent class in the video_agent module.

Generate a video from a text prompt.

Signature

python
def generate(prompt: str, seconds: Optional[str], size: Optional[str], input_reference: Optional[Any]) -> Any

Parameters

ParamField str

Text description of the desired video

ParamField Optional[str]

Video duration (e.g., “8”, “16”). Defaults to config value.

ParamField Optional[str]

Video dimensions (e.g., “720×1280”). Defaults to config value.

ParamField Optional

Reference image for image-to-video (first-frame) generation **kwargs: Additional provider-specific parameters, forwarded to LiteLLM. For Veo 3.1 interpolation/reference features, pass them here (no dedicated params are added to keep the surface lightweight): – last_frame=&lt;image&gt; # first + last frame (Veo 3.1 only) – reference_images=[…] # up to 3 reference images

Returns

ResponseField Any

VideoObject with id, status, and metadata

Usage

python
video = agent.generate(
        prompt="A cat playing with yarn",
        seconds="8",
        size="1280x720"
    )
    print(f"Video ID: {video.id}")
    print(f"Status: {video.status}")

    # Veo 3.1 first + last frame interpolation (via kwargs passthrough)
    veo = VideoAgent(llm="gemini/veo-3.1-generate-preview")
    veo.generate(
        prompt="Sunrise timelapse",
        input_reference=start_image,  # first frame
        last_frame=end_image,         # last frame (Veo 3.1)
    )

Uses

  • to_dict
  • Progress
  • SpinnerColumn
  • TextColumn
  • progress.add_task

Used By

Source

View on GitHub

praisonaiagents/agent/video_agent.py at line 361