feat: Add BrandKitAgent with public demo asset fallback (closes #158)
Summary
Closes #158.
Replaces the original env-var approach with a proper agent UX:
- New file:
backend/director/agents/brand_kit.py—BrandKitAgent - Updated:
backend/director/handler.py— registersBrandKitAgent - Updated:
backend/director/constants.py— addsBRANDKIT_DEMO_*constants for public demo asset IDs
Behaviour
| Scenario | What happens |
|---|---|
User provides their own intro_video_id, outro_video_id, brand_image_id |
Uses those directly |
| User provides some but not all | Uses theirs where available, fills gaps with demo assets |
| User has no assets | Applies full demo brand kit so they can preview the effect |
| No user assets AND no demo assets configured | Returns a helpful message guiding the user to upload their own assets |
How to configure demo assets
The three demo asset IDs are constants in director/constants.py:
BRANDKIT_DEMO_INTRO_VIDEO_ID = None # TODO: fill with VideoDB public asset ID
BRANDKIT_DEMO_OUTRO_VIDEO_ID = None # TODO: fill with VideoDB public asset ID
BRANDKIT_DEMO_BRAND_IMAGE_ID = None # TODO: fill with VideoDB public asset ID
The VideoDB team should replace these None values with the canonical public collection asset IDs. No env vars needed.
Test plan
- [ ] Ask "apply brand kit to video X" with no asset IDs → demo assets applied, user sees preview with prompt to replace
- [ ] Ask "apply brand kit to video X with intro Y and logo Z" → custom assets used, outro falls back to demo
- [ ] Ask "apply brand kit to video X" when all demo constants are
None→ helpful upload guidance message shown - [ ] Verify
brand_kitappears in/agent/endpoint response
🤖 Generated with Claude Code
Summary by CodeRabbit
- New Features
- Brand kit: add intro/outro videos and a brand image to projects, with automatic fallbacks to demo assets when custom assets aren’t supplied. Publishes progress updates, returns a preview stream URL and metadata about which slots used demo assets, and shows upload instructions if no assets are available.
- Chores
- Brand kit defaults added and the feature is registered in the app’s processing pipeline.
[!NOTE]
Reviews paused
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.Use the checkboxes below for quick actions:
- [ ] ▶️ Resume reviews
- [ ] 🔍 Trigger review
📝 Walkthrough
Walkthrough
Adds a new BrandKitAgent that composes a target video with optional intro/outro clips and a brand logo, resolves asset IDs from user input or demo constants, publishes progress and final VideoContent, invokes VideoDBTool.add_brandkit, and returns success or error AgentResponse with metadata.
Changes
| Cohort / File(s) | Summary |
|---|---|
BrandKitAgent implementation backend/director/agents/brand_kit.py |
New agent class implementing run(...): resolves intro/outro/brand IDs (user or demo constants), computes demo-usage metadata, handles "no assets" error path, publishes progress VideoContent, appends timeline action, calls VideoDBTool.add_brandkit(...), publishes final VideoContent with VideoData(stream_url=...), and returns AgentResponse (SUCCESS/ERROR) with resolved IDs and metadata. |
Demo asset constants backend/director/constants.py |
Added BRANDKIT_DEMO_INTRO_VIDEO_ID, BRANDKIT_DEMO_OUTRO_VIDEO_ID, BRANDKIT_DEMO_BRAND_IMAGE_ID (initialized to None) and minor whitespace normalization for DOWNLOADS_PATH. |
Agent registration backend/director/handler.py |
Imported and registered BrandKitAgent in ChatHandler's self.agents and agents mapping so it can be selected/executed by the ReasoningEngine. |
Sequence Diagram
sequenceDiagram
participant Client
participant Handler as ChatHandler
participant Agent as BrandKitAgent
participant Tool as VideoDBTool
participant Pub as Publisher
Client->>Handler: Request (video_id, collection_id, optional intro/outro/logo)
Handler->>Agent: run(video_id, collection_id, intro?, outro?, brand_image?)
Agent->>Pub: publish VideoContent (progress)
Agent->>Agent: resolve asset IDs (user IDs or BRANDKIT_DEMO_* constants)
Agent->>Agent: compute demo_slots / used_demo_assets
alt no assets resolved
Agent->>Pub: publish TextContent (error + upload instructions)
Agent-->>Handler: return AgentResponse (ERROR)
else assets resolved
Agent->>Agent: append timeline-building action
Agent->>Tool: add_brandkit(video_id, intro_id, outro_id, brand_image_id)
Tool-->>Agent: return VideoData(stream_url)
Agent->>Pub: publish VideoContent (stream_url, status message)
Agent-->>Handler: return AgentResponse (SUCCESS, stream_url, resolved_ids, demo_metadata)
end
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
- video-db/Director#163: Modifies the BrandKitAgent and its registration; directly related and may conflict with these additions.
Suggested reviewers
- ankit-v2-3
- ashish-spext
Poem
🐰 I hopped in code with a whiskered grin,
Intro, outro, and logo — I'll tuck them in.
If your assets are missing, a demo I’ll borrow,
Stitching frames to brighten your morrow.
Watch the stream; the rabbit fixed your show! 🎬✨
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title clearly and concisely describes the main addition of BrandKitAgent with public demo asset fallback functionality, directly corresponding to the changeset. |
| Linked Issues check | ✅ Passed | The changes meet the requirements from issue #158: the agent no longer reads defaults from environment variables, provides demo assets via public collection ID constants, handles mixed user and demo assets, and returns clear messages when no assets are available. |
| Out of Scope Changes check | ✅ Passed | All changes are within scope: new BrandKitAgent, demo constants, and handler registration directly implement the linked issue requirements with no unrelated modifications. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
This doesn't solve below mentioned point in the issue:
- If user doesn't have brandkit element, add VideoDB's publicly available asset, create a public collection and use their asset ID.