Directs each story scene into 3–5 comic panels with prose, dialogue, narration beats, and pacing, and is used when the Scene Director converts anchors into playable scenes.
Turns each anchor into a cinematic motion-comic scene with clear emotional progression and clean panel pacing. Uses Gemini's interleaved output to generate narration text and panel illustrations together in a single API call.
The Scene Director is the primary agent that satisfies the hackathon's interleaved output requirement. It calls a Gemini image-capable model (gemini-3.1-flash-image-preview) with responseModalities: ['TEXT', 'IMAGE']. In a single API call, Gemini returns narration text and AI-generated panel illustrations alternating in the response parts:
# The Scene Director makes ONE Gemini call per scene that returns:
response.parts = [
Part(text="Panel 1 narration..."),
Part(inline_data=<panel 1 illustration>),
Part(text="Panel 2 narration..."),
Part(inline_data=<panel 2 illustration>),
# ... up to 5 panels
]
The backend parses these parts, separates text from images, and packages them into the typed scene JSON. The Visual Motion Director provides style/composition guidance as INPUT to this call (style bible, character descriptions), but the actual image generation happens here inside the Scene Director's Gemini call.
{
"scene_id": "scene_A3",
"anchor": "A3",
"panels": [
{
"panel_id": "p1",
"purpose": "arrival",
"visual_beat": "The courier stands in a hall of sealed letters that whisper his own thoughts.",
"motion_direction": "Letters on shelves subtly flutter and glow. Faint wisps of light drift between the shelves. Camera holds steady on the courier's silhouette.",
"dialogue": [],
"narration": "Some rooms do not echo. They answer.",
"emotion": "unease",
"estimated_duration_sec": 4
},
{
"panel_id": "p2",
"purpose": "revelation",
"visual_beat": "One letter opens by itself, showing the promise he once made to silence himself.",
"motion_direction": "The letter slowly unfolds, casting warm golden light across the courier's face. His eyes widen. Slow push-in on the letter.",
"dialogue": ["'You wrote the law you now obey.'"],
"narration": "The trap had not been built around him. It had been built from him.",
"emotion": "shock",
"estimated_duration_sec": 5
}
]
}