Event Overview
As a video generation job progresses, the worker emits events that provide real-time feedback about what’s happening. These events can be retrieved via the GET /api/jobs/:id/events endpoint.Event Structure
Each event has the following structure:Unique, auto-incrementing event identifier. Use this for incremental polling with the
after query parameter.Event type. Currently, most events use
"log", but the system supports custom event types.Common values:log- General progress messageerror- Error notification (also logged as level: “error”)progress- Progress update with percentage
Log severity level. Determines how the event should be displayed.Values:
info- Informational message (e.g., “Generating script…”)success- Success message (e.g., “Script generated successfully”)warning- Warning message (e.g., “Fewer video clips found than requested”)error- Error message (e.g., “Failed to fetch video clip”)
Human-readable event message. This is the primary content to display to users.Examples:
"Generating script...""Searching for footage: mountain landscapes""Rendering video with subtitles...""Video generation complete"
Optional structured data associated with the event. Contents vary by event type.Example payloads:
{"wordCount": 250}- Script generation complete{"clipCount": 5}- Video clips downloaded{"duration": 45.2}- Video duration in seconds{"progress": 0.75}- 75% complete
Unix timestamp (seconds since epoch) when the event was created.Example:
1710499805.123Example Events
Job Started
Script Generation
Video Search
Audio Generation
Video Rendering
Completion
Error Event
Warning Event
Event Timeline
A typical successful job produces events in this order:- Job Start - “Starting video generation…”
- Script Generation - “Generating script with model: …”
- Script Complete - “Script generated successfully”
- Video Search - “Searching for footage: …”
- Clips Downloaded - “Downloaded N video clips”
- Audio Generation - “Generating voiceover with TikTok TTS”
- Music Addition (if enabled) - “Adding background music”
- Subtitle Generation - “Generating subtitles”
- Video Rendering - “Rendering final video with subtitles…”
- Completion - “Video generation complete”
Polling for Events
Basic Polling
Filtering by Level
Progress Bar Integration
Database Schema
Events are stored in thegeneration_events table:
~/workspace/source/Backend/models.py lines 61-79 for the full definition.
Best Practices
Display Guidelines
Performance Considerations
- Use incremental polling with the
afterparameter to avoid fetching duplicate events - Batch event processing - Wait 1-2 seconds between polls to reduce API calls
- Stop polling terminal states - Once a job reaches
completed,failed, orcancelled, stop polling for events
Error Handling
Frontend Integration Example
From the MoneyPrinter frontend (Frontend/script.js):