# openx-inc/flow architecture

> Architecture diagram of the GitHub repository openx-inc/flow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/openx-inc/flow
- Repository: https://github.com/openx-inc/flow

## Overview

Flow is an autonomous video-production system: a topic becomes a scripted shot list, generated scene clips, an assembled video, and optionally a published post. It also exposes a project-based editing agent through an HTTP API and MCP, with registered tools operating on persisted timelines. The graph preserves generation, editing, speech, publishing, and GPU deployment capabilities. Some feature implementations are unsampled; those links are omitted or shown as documented relationships rather than inferred calls.

Main entry points: [`src/flow/pipeline.py`](https://github.com/openx-inc/flow/blob/main/src/flow/pipeline.py) (Pipeline orchestration), [`src/flow/store/store.py`](https://github.com/openx-inc/flow/blob/main/src/flow/store/store.py) (Project store), [`src/flow/api/app.py`](https://github.com/openx-inc/flow/blob/main/src/flow/api/app.py) (Agent HTTP API), [`src/flow/mcp_server/server.py`](https://github.com/openx-inc/flow/blob/main/src/flow/mcp_server/server.py) (MCP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_production["Video production"]
  node_scheduler["Schedule<br/>[scheduler.py]"]
  node_pipeline["Pipeline orchestration<br/>[pipeline.py]"]
  node_writer["Script and shot list<br/>[writer.py]"]
  node_schemas["Scene schemas<br/>[schemas.py]"]
end

subgraph group_gpu["GPU generation"]
  node_generator["Scene generation<br/>[generator.py]"]
  node_keyframes["Keyframe generation<br/>[keyframes.py]"]
  node_parallel["Parallel generation"]
  node_gpu_api["GPU backend API<br/>[server.py]"]
  node_gpu_models["GPU inference<br/>[modal_server.py]"]
  node_deployment["Backend deployment<br/>[modal_deploy.py]"]
end

subgraph group_editing["Agent editing"]
  node_agent_api["Agent HTTP API<br/>[app.py]"]
  node_mcp["MCP server<br/>[server.py]"]
  node_agent["Agent loop<br/>[loop.py]"]
  node_llm["LLM client<br/>[nvidia.py]"]
  node_tool_registry["Tool registry<br/>[registry.py]"]
  node_tool_catalog["Editing tools<br/>[all.py]"]
  node_dispatch["Tool dispatch<br/>[context.py]"]
  node_generation_service["Generation service<br/>[generation.py]"]
end

subgraph group_persistence["Project state"]
  node_project["Project timeline<br/>[project.py]"]
  node_store["Project store<br/>[store.py]"]
  node_database[("Database<br/>[db.py]")]
end

subgraph group_delivery["Speech and publishing"]
  node_postproduction["Video assembly<br/>[postproduction.py]"]
  node_tts["Narration providers<br/>[base.py]"]
  node_publisher["Platform publishing<br/>[publisher.py]"]
  node_youtube["YouTube publisher<br/>[youtube.py]"]
end

node_topic(("Topic input"))
node_actor(("Creator or MCP client"))
node_social(("Social platforms"))

node_topic -->|"starts production"| node_pipeline
node_scheduler -->|"schedules runs"| node_pipeline
node_pipeline -->|"requests script"| node_writer
node_pipeline -->|"generates scenes"| node_generator
node_pipeline -->|"generates keyframes"| node_keyframes
node_pipeline -->|"runs parallel pass"| node_parallel
node_pipeline -->|"assembles clips"| node_postproduction
node_pipeline -->|"optionally publishes"| node_publisher
node_generator -->|"posts generation jobs"| node_gpu_api
node_gpu_api -.->|"runs inference"| node_gpu_models
node_deployment -->|"deploys backend"| node_gpu_api
node_writer -.->|"produces shot list"| node_schemas
node_pipeline -->|"passes shot list"| node_schemas
node_postproduction -->|"uses speech provider"| node_tts
node_publisher -->|"delegates upload"| node_youtube
node_publisher -->|"publishes videos"| node_social
node_actor -->|"sends chat"| node_agent_api
node_actor -->|"calls MCP tools"| node_mcp
node_agent_api -->|"streams agent run"| node_agent
node_agent_api -->|"loads project"| node_store
node_agent -->|"requests completions"| node_llm
node_agent -->|"dispatches registered tools"| node_tool_registry
node_agent -->|"loads tool set"| node_tool_catalog
node_mcp -->|"exposes registered tools"| node_tool_registry
node_mcp -->|"dispatches tool calls"| node_dispatch
node_mcp -->|"resolves project"| node_store
node_agent_api -->|"creates generation service"| node_generation_service
node_tool_catalog -->|"registers tools"| node_tool_registry
node_dispatch -->|"looks up tool specs"| node_tool_registry
node_dispatch -->|"persists mutations"| node_store
node_dispatch -->|"snapshots and updates"| node_project
node_store -->|"uses database"| node_database
node_store -->|"loads and saves"| node_project

click node_scheduler "https://github.com/openx-inc/flow/blob/main/src/flow/scheduler.py"
click node_pipeline "https://github.com/openx-inc/flow/blob/main/src/flow/pipeline.py"
click node_writer "https://github.com/openx-inc/flow/blob/main/src/flow/writer.py"
click node_schemas "https://github.com/openx-inc/flow/blob/main/src/flow/schemas.py"
click node_generator "https://github.com/openx-inc/flow/blob/main/src/flow/generator.py"
click node_keyframes "https://github.com/openx-inc/flow/blob/main/src/flow/keyframes.py"
click node_parallel "https://github.com/openx-inc/flow/blob/main/src/flow/parallel_generator.py"
click node_gpu_api "https://github.com/openx-inc/flow/blob/main/src/gpu_backend/server.py"
click node_gpu_models "https://github.com/openx-inc/flow/blob/main/src/gpu_backend/modal_server.py"
click node_deployment "https://github.com/openx-inc/flow/blob/main/src/flow/deploy/modal_deploy.py"
click node_postproduction "https://github.com/openx-inc/flow/blob/main/src/flow/postproduction.py"
click node_tts "https://github.com/openx-inc/flow/blob/main/src/flow/tts/base.py"
click node_publisher "https://github.com/openx-inc/flow/blob/main/src/flow/publisher.py"
click node_youtube "https://github.com/openx-inc/flow/blob/main/src/flow/publishers/youtube.py"
click node_agent_api "https://github.com/openx-inc/flow/blob/main/src/flow/api/app.py"
click node_mcp "https://github.com/openx-inc/flow/blob/main/src/flow/mcp_server/server.py"
click node_agent "https://github.com/openx-inc/flow/blob/main/src/flow/agent/loop.py"
click node_llm "https://github.com/openx-inc/flow/blob/main/src/flow/agent/nvidia.py"
click node_tool_registry "https://github.com/openx-inc/flow/blob/main/src/flow/tools/registry.py"
click node_tool_catalog "https://github.com/openx-inc/flow/blob/main/src/flow/tools/all.py"
click node_dispatch "https://github.com/openx-inc/flow/blob/main/src/flow/tools/context.py"
click node_generation_service "https://github.com/openx-inc/flow/blob/main/src/flow/agent/generation.py"
click node_project "https://github.com/openx-inc/flow/blob/main/src/flow/store/project.py"
click node_store "https://github.com/openx-inc/flow/blob/main/src/flow/store/store.py"
click node_database "https://github.com/openx-inc/flow/blob/main/src/flow/store/db.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_scheduler,node_pipeline,node_writer,node_schemas,node_actor toneBlue
class node_generator,node_keyframes,node_parallel,node_gpu_api,node_gpu_models,node_deployment toneAmber
class node_agent_api,node_mcp,node_agent,node_llm,node_tool_registry,node_tool_catalog,node_dispatch,node_generation_service toneMint
class node_project,node_store,node_database toneRose
class node_postproduction,node_tts,node_publisher,node_youtube,node_topic,node_social toneIndigo
```

## Components

### Video production

- [Schedule](https://github.com/openx-inc/flow/blob/main/src/flow/scheduler.py): `src/flow/scheduler.py`
- [Pipeline orchestration](https://github.com/openx-inc/flow/blob/main/src/flow/pipeline.py): `src/flow/pipeline.py`
- [Script and shot list](https://github.com/openx-inc/flow/blob/main/src/flow/writer.py): `src/flow/writer.py`
- [Scene schemas](https://github.com/openx-inc/flow/blob/main/src/flow/schemas.py): `src/flow/schemas.py`

### GPU generation

- [Scene generation](https://github.com/openx-inc/flow/blob/main/src/flow/generator.py): `src/flow/generator.py`
- [Keyframe generation](https://github.com/openx-inc/flow/blob/main/src/flow/keyframes.py): `src/flow/keyframes.py`
- [Parallel generation](https://github.com/openx-inc/flow/blob/main/src/flow/parallel_generator.py): `src/flow/parallel_generator.py`
- [GPU backend API](https://github.com/openx-inc/flow/blob/main/src/gpu_backend/server.py): `src/gpu_backend/server.py`
- [GPU inference](https://github.com/openx-inc/flow/blob/main/src/gpu_backend/modal_server.py): `src/gpu_backend/modal_server.py`
- [Backend deployment](https://github.com/openx-inc/flow/blob/main/src/flow/deploy/modal_deploy.py): `src/flow/deploy/modal_deploy.py`

### Agent editing

- [Agent HTTP API](https://github.com/openx-inc/flow/blob/main/src/flow/api/app.py): `src/flow/api/app.py`
- [MCP server](https://github.com/openx-inc/flow/blob/main/src/flow/mcp_server/server.py): `src/flow/mcp_server/server.py`
- [Agent loop](https://github.com/openx-inc/flow/blob/main/src/flow/agent/loop.py): `src/flow/agent/loop.py`
- [LLM client](https://github.com/openx-inc/flow/blob/main/src/flow/agent/nvidia.py): `src/flow/agent/nvidia.py`
- [Tool registry](https://github.com/openx-inc/flow/blob/main/src/flow/tools/registry.py): `src/flow/tools/registry.py`
- [Editing tools](https://github.com/openx-inc/flow/blob/main/src/flow/tools/all.py): `src/flow/tools/all.py`
- [Tool dispatch](https://github.com/openx-inc/flow/blob/main/src/flow/tools/context.py): `src/flow/tools/context.py`
- [Generation service](https://github.com/openx-inc/flow/blob/main/src/flow/agent/generation.py): `src/flow/agent/generation.py`

### Project state

- [Project timeline](https://github.com/openx-inc/flow/blob/main/src/flow/store/project.py): `src/flow/store/project.py`
- [Project store](https://github.com/openx-inc/flow/blob/main/src/flow/store/store.py): `src/flow/store/store.py`
- [Database](https://github.com/openx-inc/flow/blob/main/src/flow/store/db.py): `src/flow/store/db.py`

### Speech and publishing

- [Video assembly](https://github.com/openx-inc/flow/blob/main/src/flow/postproduction.py): `src/flow/postproduction.py`
- [Narration providers](https://github.com/openx-inc/flow/blob/main/src/flow/tts/base.py): `src/flow/tts/base.py`
- [Platform publishing](https://github.com/openx-inc/flow/blob/main/src/flow/publisher.py): `src/flow/publisher.py`
- [YouTube publisher](https://github.com/openx-inc/flow/blob/main/src/flow/publishers/youtube.py): `src/flow/publishers/youtube.py`

### Other components

- **Topic input**
- **Creator or MCP client**
- **Social platforms**

## Connections

- Topic input → Pipeline orchestration: starts production
- Schedule → Pipeline orchestration: schedules runs
- Pipeline orchestration → Script and shot list: requests script (evidence: `src/flow/pipeline.py`)
- Pipeline orchestration → Scene generation: generates scenes (evidence: `src/flow/pipeline.py`)
- Pipeline orchestration → Keyframe generation: generates keyframes (evidence: `src/flow/pipeline.py`)
- Pipeline orchestration → Parallel generation: runs parallel pass (evidence: `src/flow/pipeline.py`)
- Pipeline orchestration → Video assembly: assembles clips (evidence: `src/flow/pipeline.py`)
- Pipeline orchestration → Platform publishing: optionally publishes (evidence: `src/flow/pipeline.py`)
- Scene generation → GPU backend API: posts generation jobs (evidence: `src/gpu_backend/server.py`)
- GPU backend API → GPU inference: runs inference
- Backend deployment → GPU backend API: deploys backend
- Script and shot list → Scene schemas: produces shot list
- Pipeline orchestration → Scene schemas: passes shot list (evidence: `src/flow/pipeline.py`)
- Video assembly → Narration providers: uses speech provider (evidence: `src/flow/postproduction.py`)
- Platform publishing → YouTube publisher: delegates upload (evidence: `src/flow/publisher.py`)
- Platform publishing → Social platforms: publishes videos
- Creator or MCP client → Agent HTTP API: sends chat (evidence: `src/flow/api/app.py`)
- Creator or MCP client → MCP server: calls MCP tools (evidence: `src/flow/mcp_server/server.py`)
- Agent HTTP API → Agent loop: streams agent run (evidence: `src/flow/api/app.py`)
- Agent HTTP API → Project store: loads project (evidence: `src/flow/api/app.py`)
- Agent loop → LLM client: requests completions (evidence: `src/flow/agent/loop.py`)
- Agent loop → Tool registry: dispatches registered tools (evidence: `src/flow/agent/loop.py`)
- Agent loop → Editing tools: loads tool set (evidence: `src/flow/agent/loop.py`)
- MCP server → Tool registry: exposes registered tools (evidence: `src/flow/mcp_server/server.py`)
- MCP server → Tool dispatch: dispatches tool calls (evidence: `src/flow/mcp_server/server.py`)
- MCP server → Project store: resolves project (evidence: `src/flow/mcp_server/server.py`)
- Agent HTTP API → Generation service: creates generation service (evidence: `src/flow/api/app.py`)
- Editing tools → Tool registry: registers tools (evidence: `src/flow/tools/all.py`)
- Tool dispatch → Tool registry: looks up tool specs (evidence: `src/flow/tools/context.py`)
- Tool dispatch → Project store: persists mutations (evidence: `src/flow/tools/context.py`)
- Tool dispatch → Project timeline: snapshots and updates (evidence: `src/flow/tools/context.py`)
- Project store → Database: uses database (evidence: `src/flow/store/store.py`)
- Project store → Project timeline: loads and saves (evidence: `src/flow/store/store.py`)
