> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# generate • AI Agent SDK

> generate: Generate a video from a text prompt.

# generate

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**VideoAgent**](../classes/VideoAgent) class in the [**video\_agent**](../modules/video_agent) module.

Generate a video from a text prompt.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def generate(prompt: str, seconds: Optional[str], size: Optional[str], input_reference: Optional[Any]) -> Any
```

## Parameters

<ParamField query="prompt" type="str" required={true}>
  Text description of the desired video
</ParamField>

<ParamField query="seconds" type="Optional[str]" required={false}>
  Video duration (e.g., "8", "16"). Defaults to config value.
</ParamField>

<ParamField query="size" type="Optional[str]" required={false}>
  Video dimensions (e.g., "720x1280"). Defaults to config value.
</ParamField>

<ParamField query="input_reference" type="Optional" required={false}>
  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=\<image>        # first + last frame (Veo 3.1 only) - reference\_images=\[...]     # up to 3 reference images
</ParamField>

### Returns

<ResponseField name="Returns" type="Any">
  VideoObject with id, status, and metadata
</ResponseField>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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

* [`CodeAgent.generate_code`](../functions/CodeAgent-generate_code)
* [`VideoAgent.start`](../functions/VideoAgent-start)
* [`VideoAgent.run`](../functions/VideoAgent-run)

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/agent/video_agent.py#L303">
  `praisonaiagents/agent/video_agent.py` at line 303
</Card>
