ExamplescriptIntermediateRunnableguided-flow
Sora prompting: turn a one-line idea into a detailed prompt, then render it
A director helper expands a one-line idea into a detailed Sora prompt; the script then renders a 4-second Sora 2 video from it and downloads it.
Key Facts
- Level
- Intermediate
- Runtime
- Python • OpenAI API
- Pattern
- Inspectable flow with visible system boundaries
- Interaction
- Live sandbox • Script
- Code last changed
- 7 October 2025
Navigate this example
Library
Browse examplesReopen the wider library to compare adjacent patterns and linked learning paths.Interaction
Run sandbox nowTry the interaction directly in this example’s guided sandbox surface.Source
Open full sourceRead the real implementation, highlighted checkpoints, and runtime requirements.MCP
Call via MCPUse the same resource inside agents, deterministic exports, and MCP setup flows.
Linked principles
4-sora-prompting.py
python
from utils.director import SoraDirector
from utils.downloader import download_sora_video
from openai import OpenAI
openai = OpenAI()
director = SoraDirector()
# --------------------------------------------------------------
# Generate a Sora prompt
# --------------------------------------------------------------
prompt = director.generate_sora_prompt(
"A YouTuber excitedly showing OpenAI's new Sora 2 API release to generate hyper-realistic videos with just a few lines of code."
)
print(prompt)
# --------------------------------------------------------------
# Generate a video
# --------------------------------------------------------------
video = openai.videos.create(
model="sora-2",
prompt=prompt,
size="720x1280",
seconds="4",
)
print("Video generation started:", video)
# --------------------------------------------------------------
# Download the video
# --------------------------------------------------------------
video = download_sora_video(video=video, output_folder="./output")
Related principles
- P4TrustApply progressive disclosure to system agencyProvide the minimum information necessary by default, while enabling users to inspect additional detail when confidence, understanding, or intervention is required.Open principle →
- P5DelegationReplace implied magic with clear mental modelsThe product should help users understand what the system can do, what it is currently doing, what it cannot do, and what conditions govern its behaviour.Open principle →
- P7TrustEstablish trust through inspectabilityUsers should be able to examine how a result was produced when confidence, accountability, or decision quality is important.Open principle →
- P9OrchestrationRepresent delegated work as a system, not merely as a conversationWhere work involves multiple steps, agents, dependencies, or concurrent activities, it should be represented as a structured system rather than solely as a message stream.Open principle →