> ## 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.

# Wait For Completion • AI Agent SDK

> wait_for_completion: Wait for video generation to complete.

# wait\_for\_completion

<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.

Wait for video generation to complete.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def wait_for_completion(video_id: str, poll_interval: Optional[int], max_wait_time: Optional[int]) -> Any
```

## Parameters

<ParamField query="video_id" type="str" required={true}>
  The video ID to poll
</ParamField>

<ParamField query="poll_interval" type="Optional" required={false}>
  Seconds between status checks (default: 10)
</ParamField>

<ParamField query="max_wait_time" type="Optional" required={false}>
  Maximum wait time in seconds (default: 600)
</ParamField>

### Returns

<ResponseField name="Returns" type="Any">
  VideoObject with status "completed" or "failed"
</ResponseField>

### Exceptions

<AccordionGroup>
  <Accordion title="TimeoutError">
    If max\_wait\_time is exceeded
  </Accordion>
</AccordionGroup>

## Uses

* `time.time`
* `Progress`
* `SpinnerColumn`
* `TextColumn`
* `progress.add_task`
* `status`
* `time.sleep`
* `TimeoutError`

## Used By

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

## Source

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