---
title: AI Composition
url: https://docs.kaltura.com/docs/conversational-agents/avatar-videos/ai-composition
---

## AI Composition

The compose action uses AI to generate scenes from source video content. It analyzes captions and transcripts from the provided entries and creates a structured narration script.

### Compose Scenes from Content

```bash
curl -s -X POST "$AVATAR_API/video/compose" \
  -H "Authorization: Bearer $KS" \
  -H "Content-Type: application/json" \
  -d "{
    \"id\": \"$VIDEO_ID\",
    \"formatType\": \"session-highlights\",
    \"duration\": 120,
    \"entryIds\": [\"$SOURCE_ENTRY_1\", \"$SOURCE_ENTRY_2\"],
    \"userBrief\": \"Focus on the product roadmap announcements\",
    \"generateName\": true
  }"
```

**Request fields:**

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `id` | string | yes | Video project ID |
| `formatType` | string | yes | `"session-highlights"` or `"video-explainer"` (see below) |
| `duration` | number | yes | Target video duration in seconds. Min: 1, max: 1200 (20 minutes) |
| `entryIds` | array | yes | Kaltura entry IDs with captions to analyze |
| `userBrief` | string | no | Describes the video goals, style, or focus areas for the AI |
| `generateName` | boolean | no | Auto-generate a video name from the content |

**Format types:**

| Format | Source Content | Output |
|--------|---------------|--------|
| `session-highlights` | Video captions only | Short highlights video narrated by the avatar summarizing the key points |
| `video-explainer` | Video captions + documents | Explainer video combining multiple sources into a coherent narrative |

The compose action:
1. Transitions the video status to `composing`  
2. Extracts captions and documents from the source entries  
3. Uses AI (AWS Bedrock Claude) to generate a structured scene-by-scene narration  
4. Populates the video's `scenes` array with the generated content  
5. Transitions to `composed` on success, or `compose-error` on failure  

Source entries require captions or transcripts — add them via REACH before composing. The API returns `CAPTIONS_NOT_FOUND` if text content is missing.

**Response:** Returns the video with status `composing`. Poll `video.get` until status changes to `composed`.
