The AnalyzeAsyncClient.TasksClient class provides methods to analyze videos asynchronously, generate text, and extract structured, timestamped segments. The platform supports two analysis modes: general analysis (prompt-based text generation) with both Pegasus 1.2 and Pegasus 1.5, and video segmentation with Pegasus 1.5.
When to use this class:
Do not use this class for:
analyze method instead.On the Free plan, analysis hours count toward a shared limit that also covers indexing - the number of segment definitions does not affect this limit. On paid plans, you pay based on how much video you process and how many segment definitions you include - see the Frequently asked questions page for examples.
Analyzing videos asynchronously requires three steps:
create method. The platform returns a task ID.retrieve method. Wait until the status is ready.ready using the retrieve method.Description: This method returns a list of the analysis tasks in your account. The platform returns your analysis tasks sorted by creation date, with the newest at the top of the list.
Function signature and example:
Parameters:
Return value: Returns a TasksListResponse object.
The TasksListResponse class contains the following properties:
The PageInfo class contains the following properties:
For details about AnalyzeTaskResponse, see Retrieve task status and results.
API Reference: List async analysis tasks
Description: This method asynchronously analyzes your videos. It supports two modes: general analysis (prompt-based text generation) with both Pegasus 1.2 and Pegasus 1.5, and video segmentation with Pegasus 1.5.
This method is rate-limited. For details, see the Rate limits page.
Function signature and example:
Parameters:
The VideoContext type specifies the source of the video. Provide exactly one of the following:
The AsyncResponseFormat class contains the following properties:
The AnalyzePromptV2 class defines a structured prompt with image references.
The SegmentDefinition class defines a type of segment to extract from the video.
The SegmentField class defines a custom field to extract for each segment.
The SmeMediaSource class defines a reference image that provides visual context for segment identification. Provide exactly one of url, asset_id, or base64_string.
Return value: Returns a CreateAnalyzeTaskResponse object containing the task details.
The CreateAnalyzeTaskResponse class contains the following properties:
API Reference: Create an async analysis task
Description: This method retrieves the status and results of an analysis task.
Task statuses:
queued: The task is waiting to be processed.pending: The task is queued and waiting to start.processing: The platform is analyzing the video.ready: Processing is complete. Results are available in the response.failed: The task failed. No results were generated.Call this method repeatedly until status is ready or failed. When status is ready, use the results from the response.
Function signature and example:
Parameters:
Return value: Returns an AnalyzeTaskResponse object containing the task status and results.
The AnalyzeTaskResponse class contains the following properties:
The AnalyzeTaskResponseVideoSource class contains the following properties:
The AnalyzeTaskResponseVideoSourceSystemMetadata class contains the following properties:
The AnalyzeTaskResponseRequestParams class contains the following properties:
The AnalyzeTaskResult class contains the following properties:
The AnalyzeTaskResultUsage class contains the following properties:
The AnalyzeTaskError class contains the following properties:
API Reference: Retrieve analysis task status and results
Description: This method deletes an analysis task. You can only delete tasks that are not currently being processed.
Function signature and example:
Parameters:
Return value: Returns None. If successful, the platform returns a 204 No Content response.
API Reference: Delete an analysis task