Data Flow¶
Orion's content creation pipeline is fully event-driven. Data flows from external trend sources through a series of autonomous processing stages to produce published video content.
End-to-End Pipeline¶
flowchart TD
A["External Sources\n(RSS, Google Trends, Twitter)"] -->|poll| B["Scout\nTrend Detection"]
B -->|"orion.trend.detected"| C["Director\nPipeline Orchestration"]
C -->|"LangGraph Pipeline"| D{"Strategist Node\nScript Generation"}
D --> E{"Creator Node\nVisual Prompts"}
E -->|"orion.content.created"| F["Media\nImage Generation"]
F -->|"orion.media.generated"| G["Editor\nVideo Rendering"]
G --> H["TTS + Captions + Stitch"]
H --> I{"Human Review"}
I -->|approved| J["Publisher\nSocial Platforms"]
I -->|rejected| C
J -->|"orion.content.published"| K["Pulse\nAnalytics"]
B & C & F & G & J -->|metrics| K
Trend Detection (Scout)¶
- Scout polls configured external sources (RSS feeds, Google Trends API, Twitter API)
- Raw signals are scored using niche-specific keyword matching
- Trends are deduplicated against existing records in PostgreSQL
- New trends are persisted with status
active - An
orion.trend.detectedevent is published to Redis
Event payload:
{
"trend_id": "550e8400-e29b-41d4-a716-446655440000",
"topic": "AI agents in production",
"source": "google_trends",
"score": 0.87,
"niche": "technology"
}
Content Generation (Director)¶
- Director subscribes to
orion.trend.detectedevents - A LangGraph
StateGraphis constructed with the following nodes: - Strategist -- Generates an H-V-C script (hook, visual body, CTA) and runs self-critique
- Creator -- Extracts visual prompts from the script
- Analyst (optional) -- Analyzes pipeline performance and suggests improvements
- Each node can have an HITL interrupt gate for human review
- State is checkpointed to PostgreSQL via
AsyncPostgresSaver - Vector memory (Milvus) provides context from previous content
- On completion,
orion.content.createdis published
Image Generation (Media)¶
- Media subscribes to
orion.content.createdevents - Visual prompts from the Director are sent to the image provider
- Provider chain: ComfyUI (local) with Fal.ai (cloud) fallback
- Generated images are stored as
media_assetsrecords orion.media.generatedevent is published
Video Rendering (Editor)¶
- Editor subscribes to
orion.media.generatedevents - Rendering pipeline:
- TTS -- Text-to-speech from script body (Ollama or cloud provider)
- Captions -- Whisper transcription of audio
- Stitch -- FFmpeg combines images + audio into video
- Subtitles -- Burn captions onto video
- Thumbnail -- Generate video thumbnail
- Validate -- Check output meets platform requirements
- Default output: 1080x1920 (vertical) for short-form platforms
Publishing (Publisher)¶
- User approves content via CLI or Dashboard
- Publisher distributes to configured platforms (Twitter/X, YouTube, TikTok, Instagram)
orion.content.publishedevent is emitted
Analytics (Pulse)¶
Pulse subscribes to all event channels and:
- Aggregates content performance metrics
- Tracks AI provider costs (token usage, API calls)
- Maintains pipeline execution history
- Runs daily cleanup (90-day retention)