<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 程宏峰</title>
    <description>The latest articles on DEV Community by 程宏峰 (@_19ec095744cd8d9cce9ae).</description>
    <link>https://dev.to/_19ec095744cd8d9cce9ae</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4234645%2F801a6489-e838-44d8-bb76-f09eb5dc3ffb.png</url>
      <title>DEV Community: 程宏峰</title>
      <link>https://dev.to/_19ec095744cd8d9cce9ae</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/_19ec095744cd8d9cce9ae"/>
    <language>en</language>
    <item>
      <title>How We Built a Multi-Agent AI System for Full-Stack Short Drama &amp; Video Production</title>
      <dc:creator>程宏峰</dc:creator>
      <pubDate>Mon, 09 Nov 2026 07:40:43 +0000</pubDate>
      <link>https://dev.to/_19ec095744cd8d9cce9ae/how-we-built-a-multi-agent-ai-system-for-full-stack-short-drama-video-production-2i0m</link>
      <guid>https://dev.to/_19ec095744cd8d9cce9ae/how-we-built-a-multi-agent-ai-system-for-full-stack-short-drama-video-production-2i0m</guid>
      <description>&lt;p&gt;In recent months, vertical short dramas (60-90 second episodic narratives formatted in 9:16) have surged into a multi-billion dollar global entertainment category. However, producing compelling episodic video content with generative AI presents distinct engineering hurdles that conventional text-to-video tools (like Runway, Kling, or Luma) fail to solve out of the box:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Character &amp;amp; Setting Drift&lt;/strong&gt;: AI video models treat each prompt in isolation. In episode 3, the protagonist's face, outfit, and environment inevitably mutate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Narrative Beat Pacing&lt;/strong&gt;: Short dramas rely on micro-hooks every 3-5 seconds and cliffhangers at the end of every 60-second episode. Standard LLM script outputs lack the granular pacing required for visual tension.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-Model Orchestration&lt;/strong&gt;: Achieving high cinematic quality demands mixing specialized models: LLMs for script adaptation, text-to-image (Midjourney/Flux) for keyframe anchors, image-to-video (Kling/Hailuo/CogVideo) for motion, voice cloning (ElevenLabs/CosyVoice) for voice acting, and automated timeline stitching with FFmpeg.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To address these challenges, we built &lt;a href="https://www.getalphadrama.com" rel="noopener noreferrer"&gt;AlphaDrama&lt;/a&gt; — an end-to-end, multi-agent SaaS platform that automates the journey from raw novel / script to multi-episode short drama videos.&lt;/p&gt;

&lt;p&gt;Here is an architectural walkthrough of how we designed the multi-agent system, solved character consistency, and built a fault-tolerant media pipeline.&lt;/p&gt;




&lt;h2&gt;
  
  
  High-Level Architecture Overview
&lt;/h2&gt;

&lt;p&gt;AlphaDrama is architected as an event-driven system with a clear separation of concerns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Frontend&lt;/strong&gt;: Nuxt 3 (Vue 3 + TypeScript) with mixed rendering (SSG/SSR for public discovery pages, highly responsive SPA for the studio episode workbench and replica workbench).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backend API &amp;amp; Service Bus&lt;/strong&gt;: Hono + Node.js (TypeScript) running lightweight micro-routes backed by MySQL (Drizzle ORM) for transactional state and job queues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent Orchestration&lt;/strong&gt;: Built on Mastra agent architecture, isolating distinct cognitive domains into specialized agents with explicit tool contracts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Media Processing Core&lt;/strong&gt;: Asynchronous worker pipeline orchestrating GPU generation clusters, automated speech synthesis (TTS), subtitle auto-alignment, and FFmpeg composite rendering.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;       +-------------------------------------------------------------+
       |                        User Novel / Script                  |
       +-------------------------------------------------------------+
                                     |
                                     v
       +-------------------------------------------------------------+
       |             Agent 1: Script Rewriter &amp;amp; Beat Adapter          |
       |  - Parses story into episodic 60s vertical drama beats       |
       |  - Enforces hooks, conflicts, and cliffhanger milestones    |
       +-------------------------------------------------------------+
                                     |
                                     v
       +-------------------------------------------------------------+
       |             Agent 2: Entity &amp;amp; Style Extractor                |
       |  - Extracts Character Bible &amp;amp; Visual Style DNA              |
       |  - Standardizes facial anchors, clothing, and atmosphere    |
       +-------------------------------------------------------------+
                                     |
                                     v
       +-------------------------------------------------------------+
       |             Agent 3: Storyboard Breaker &amp;amp; Prompter           |
       |  - Splits beats into 10-25 individual visual cuts            |
       |  - Generates camera direction, shot type &amp;amp; motion prompt     |
       +-------------------------------------------------------------+
                                     |
                  +------------------+------------------+
                  |                                     |
                  v                                     v
       +----------------------+              +----------------------+
       | Visual Pipeline      |              | Audio &amp;amp; Speech Engine|
       | - Flux/SDXL Keyframe |              | - Character TTS      |
       | - I2V Kling/Hailuo   |              | - Subtitle timestamp |
       +----------------------+              +----------------------+
                  \                                     /
                   \                                   /
                    v                                 v
       +-------------------------------------------------------------+
       |               Automated FFmpeg Stitching Engine             |
       |  - Smart cut transitions, vertical 9:16 layout normalization |
       |  - Synchronized burnt-in captions &amp;amp; ambient soundscapes     |
       +-------------------------------------------------------------+
                                     |
                                     v
       +-------------------------------------------------------------+
       |                 Exported 4K / 1080p Episode                 |
       +-------------------------------------------------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Deep Dive: Solving Character Consistency Across 50+ Shots
&lt;/h2&gt;

&lt;p&gt;The biggest bottleneck in AI filmmaking is identity drift. In &lt;a href="https://www.getalphadrama.com" rel="noopener noreferrer"&gt;AlphaDrama&lt;/a&gt;, we implemented a multi-stage visual anchor pattern:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Character Bible Normalization
&lt;/h3&gt;

&lt;p&gt;Before generating a single video frame, our &lt;strong&gt;Extractor Agent&lt;/strong&gt; reads the raw text and generates a structured character profile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Evelyn Vance"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"archetype"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Ruthless Tech Heiress"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"visual_dna"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"late 20s, sharp jawline, platinum blonde blunt bob, piercing hazel eyes, charcoal tailored pant-suit with gold lapel pin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"negative_prompt"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"cartoon, lowres, distorted anatomy, casual hoodie, messy hair"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"seed_anchor"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;18493021&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Keyframe-First Generation (Image-to-Video Workflow)
&lt;/h3&gt;

&lt;p&gt;Direct text-to-video generation is too non-deterministic for narrative drama. Instead, we enforce an &lt;strong&gt;Image-to-Video (I2V)&lt;/strong&gt; workflow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;Prompt Generator Agent&lt;/strong&gt; pairs the visual DNA with scene-specific lighting and emotional cues to generate a high-resolution base keyframe using Flux / SDXL.&lt;/li&gt;
&lt;li&gt;The keyframe is evaluated and locked as the visual reference.&lt;/li&gt;
&lt;li&gt;The motion engine (Kling / Hailuo) generates a 3-5 second clip using the locked keyframe as the starting anchor, preserving clothing, facial features, and lighting consistency across cuts.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Video Replica 2.0: Deconstructing Viral Short Dramas
&lt;/h2&gt;

&lt;p&gt;Creators frequently want to study and replicate the visual rhythm of top-performing TikTok and Reels drama clips. We engineered a reverse-engineering subsystem called &lt;strong&gt;Video Replica 2.0&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Boundary &amp;amp; Scene Detection&lt;/strong&gt;: Analyzes input video to calculate precise shot boundaries (using color histogram shifts and optical flow).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Audio Transcription &amp;amp; Alignment&lt;/strong&gt;: Extracts speech timestamps using Whisper to align pacing with visual cuts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shot-by-Shot Vision Inspection&lt;/strong&gt;: Deconstructs every frame with multimodal vision LLMs to describe camera angles (e.g., low-angle Dutch tilt push-in), lighting temperature, character actions, and emotional beats.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Structural Synthesis&lt;/strong&gt;: Automatically generates an editable storyboard replicating the exact dramatic pacing while substituting new characters and story arcs.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  State-Machine Driven Background Orchestration
&lt;/h2&gt;

&lt;p&gt;Generating 20 video cuts, rendering TTS voices, and concatenating video streams can take several minutes. We built a robust state machine worker in Hono:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// hot_produce_jobs state machine&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;StepOrder&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;rewriting&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;      &lt;span class="c1"&gt;// Script adaptation &amp;amp; beat splitting&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;assets&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;         &lt;span class="c1"&gt;// Character &amp;amp; location profile generation&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;images&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;         &lt;span class="c1"&gt;// Keyframe generation &amp;amp; validation&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;storyboarding&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;// Shot sequence &amp;amp; camera prompts&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;            &lt;span class="c1"&gt;// Voice synthesis with character timbres&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;videos&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;         &lt;span class="c1"&gt;// Batch Image-to-Video GPU generation&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;merging&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;        &lt;span class="c1"&gt;// FFmpeg stitching, captions &amp;amp; audio mixing&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;done&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;            &lt;span class="c1"&gt;// Final asset ready for streaming &amp;amp; download&lt;/span&gt;
&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each step is idempotent: if a third-party GPU API times out on Shot 14, the job queue isolates the failed cut, triggers an exponential backoff retry, and resumes without invalidating the already-rendered shots.&lt;/p&gt;




&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Modular Agent Design Wins&lt;/strong&gt;: Combining specialized agents (Rewriter, Extractor, Prompter) with strict JSON schemas produces vastly superior results compared to single monolithic prompts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keyframe Anchoring is Non-Negotiable&lt;/strong&gt;: Direct T2V is too unstable for series production. Using controlled keyframe generation first ensures visual continuity across dozens of episodes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real SaaS Demands Graceful Resilience&lt;/strong&gt;: Generative media APIs fail frequently. Building state-machine job orchestration with granular cut-level retries is critical for production reliability.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you are curious to test the platform or explore AI short drama generation, check out the live version at &lt;a href="https://www.getalphadrama.com" rel="noopener noreferrer"&gt;AlphaDrama (getalphadrama.com)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Feel free to drop any questions about agent orchestration, video pipelines, or FFmpeg automation in the comments!&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>architecture</category>
      <category>llm</category>
    </item>
  </channel>
</rss>
