# siva010505/helio architecture

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

- Interactive diagram: https://gitdiagram.com/siva010505/helio
- Repository: https://github.com/siva010505/helio

## Overview

#### Purpose and entry points
This repository is an automated YouTube-content production pipeline. It coordinates research, script generation, visual planning, asset discovery, evaluation, and upload, with analytics feedback to improve future runs.

Primary execution paths:
- Daily end-to-end run: `scripts/run_daily_pipeline.py`
- Main pipeline module: `src/pipeline.py`
- Agent orchestration: `src/agents/orchestrator.py`
- Scheduled automation: `.github/workflows/daily_pipeline.yml`

#### Pipeline orchestration
`src/pipeline.py` is the top-level workflow boundary, while `src/agents/orchestrator.py` coordinates the specialized agent stages. The design separates content decisions into focused agents rather than embedding all logic in one workflow.

Core stages are implemented under `src/agents/`, including:
- Research and topic inputs: `src/agents/research_agent.py`
- Script and hook/punch refinement: `src/agents/script_agent.py`, `src/agents/punch_agent.py`
- Assembly of final content artifacts: `src/agents/assembly_agent.py`

#### Content planning and creative generation
The production path transforms researched material into a publishable long-form package:
- Narrative/content planning: `src/agents/script_agent.py`
- Voice-oriented output: `src/agents/voice_agent.py`
- Captions and discoverability metadata: `src/agents/caption_agent.py`, `src/agents/seo_agent.py`
- Thumbnail generation decisions: `src/agents/thumbnail_agent.py`

`shared/latest_long_form.json` appears to be a cross-stage artifact for the latest generated long-form content, creating a filesystem handoff between pipeline stages or operational scripts.

#### Visual workflow boundary
Visual production is explicitly divided into direction, planning, and external asset retrieval:
- Creative visual direction: `src/agents/visual_director_agent.py`
- Shot/visual plan construction: `src/agents/visual_planner_agent.py`
- Stock-media integration boundary: `src/services/stock_search.py`

This isolates third-party stock search from the agents that decide what visuals are needed.

#### Evaluation and feedback loop
Quality control and iterative optimization are first-class pipeline stages:
- Content evaluation: `src/agents/evaluation_agent.py`
- Scoring: `src/agents/scoring_agent.py`
- YouTube analytics ingestion and interpretation: `src/agents/analytics_agent.py`

Operational feedback entry points are `scripts/run_analytics_pull.py` and `scripts/run_analytics_feedback.py`. Historical visual decisions are persisted in `data/visual_history.json`, likely allowing future plans to avoid repetition or incorporate prior outcomes.

#### Persistence, configuration, and AI runtime
The repository uses a local database layer:
- Database access: `src/db/db.py`
- Schema/models: `src/db/models.py`
- Initialization: `src/db/init_db.py`
- Persisted database artifact: `data/agent.db`

Configuration is loaded through `src/config_loader.py` from `config.yaml`, with secrets/environment setup represented by `.env.example`. LLM-backed agent execution is centralized behind `src/llm_client.py`, keeping model-provider interaction separate from agent logic.

#### Publishing and external integrations
Publishing is isolated from content creation:
- Upload stage: `src/agents/upload_agent.py`
- YouTube OAuth/authentication: `src/youtube/oauth.py`
- Auth-only operational command: `scripts/auth_only.py`

The principal external services implied by the architecture are an LLM provider, YouTube OAuth/upload/analytics APIs, and a stock-media search provider. GitHub Actions provides scheduled runtime infrastructure through `.github/workflows/daily_pipeline.yml`.

Main entry points: [`src/agents/visual_planner_agent.py`](https://github.com/siva010505/helio/blob/master/src/agents/visual_planner_agent.py) (Shot planner), [`src/agents/orchestrator.py`](https://github.com/siva010505/helio/blob/master/src/agents/orchestrator.py) (Agent orchestrator), [`src/agents/script_agent.py`](https://github.com/siva010505/helio/blob/master/src/agents/script_agent.py) (Script & punch), [`src/agents/analytics_agent.py`](https://github.com/siva010505/helio/blob/master/src/agents/analytics_agent.py) (Analytics feedback)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Automation"]
  node_daily_workflow["Daily schedule<br/>GitHub Actions workflow<br/>[daily_pipeline.yml]"]
  node_daily_runner["Daily pipeline runner<br/>CLI entry point"]
  node_pipeline["Pipeline workflow<br/>top-level orchestration<br/>[pipeline.py]"]
end

subgraph group_agents["Agent pipeline"]
  node_orchestrator["Agent orchestrator<br/>stage coordinator<br/>[orchestrator.py]"]
  node_research["Research<br/>agent<br/>[research_agent.py]"]
  node_script["Script &amp; punch<br/>agent stage<br/>[script_agent.py]"]
  node_assembly["Content assembly<br/>agent<br/>[assembly_agent.py]"]
  node_voice_metadata["Voice, captions &amp; SEO<br/>agent stage<br/>[voice_agent.py]"]
  node_quality["Evaluation &amp; scoring<br/>agent stage"]
  node_upload["YouTube upload<br/>agent<br/>[upload_agent.py]"]
  node_analytics["Analytics feedback<br/>agent<br/>[analytics_agent.py]"]
end

subgraph group_visuals["Visual production"]
  node_visual_direction["Visual direction<br/>agent"]
  node_visual_plan["Shot planner<br/>agent"]
  node_stock_search{{"Stock search<br/>service adapter<br/>[stock_search.py]"}}
end

subgraph group_data["Data &amp; AI"]
  node_latest_content["Latest long-form package<br/>cross-stage artifact"]
  node_visual_history["Visual history<br/>history artifact"]
  node_database[("Agent database<br/>local persistence<br/>[agent.db]")]
  node_llm_client{{"LLM client<br/>provider boundary<br/>[llm_client.py]"}}
end

subgraph group_external["External services"]
  node_youtube(("YouTube APIs<br/>upload &amp; analytics service"))
  node_stock_provider(("Stock-media provider<br/>search service"))
end

node_daily_workflow -->|"scheduled run"| node_daily_runner
node_daily_runner -->|"starts"| node_pipeline
node_pipeline -->|"coordinates through"| node_orchestrator
node_orchestrator -->|"research stage"| node_research
node_research -->|"topic inputs"| node_script
node_script -->|"script"| node_voice_metadata
node_script -->|"creative brief"| node_visual_direction
node_visual_direction -->|"direction"| node_visual_plan
node_visual_plan -->|"asset queries"| node_stock_search
node_stock_search -->|"retrieves media"| node_stock_provider
node_visual_history -.->|"prior decisions"| node_visual_plan
node_voice_metadata -->|"production outputs"| node_assembly
node_visual_plan -->|"visual plan &amp; assets"| node_assembly
node_assembly -->|"writes package"| node_latest_content
node_latest_content -->|"evaluates"| node_quality
node_quality -->|"approved package"| node_upload
node_upload -->|"publishes via OAuth"| node_youtube
node_youtube -->|"performance data"| node_analytics
node_analytics -.->|"future topic feedback"| node_research
node_analytics -->|"persists insights"| node_database
node_orchestrator -->|"agent inference"| node_llm_client

click node_daily_workflow "https://github.com/siva010505/helio/blob/master/.github/workflows/daily_pipeline.yml"
click node_daily_runner "https://github.com/siva010505/helio/blob/master/scripts/run_daily_pipeline.py"
click node_pipeline "https://github.com/siva010505/helio/blob/master/src/pipeline.py"
click node_orchestrator "https://github.com/siva010505/helio/blob/master/src/agents/orchestrator.py"
click node_research "https://github.com/siva010505/helio/blob/master/src/agents/research_agent.py"
click node_script "https://github.com/siva010505/helio/blob/master/src/agents/script_agent.py"
click node_assembly "https://github.com/siva010505/helio/blob/master/src/agents/assembly_agent.py"
click node_voice_metadata "https://github.com/siva010505/helio/blob/master/src/agents/voice_agent.py"
click node_visual_direction "https://github.com/siva010505/helio/blob/master/src/agents/visual_director_agent.py"
click node_visual_plan "https://github.com/siva010505/helio/blob/master/src/agents/visual_planner_agent.py"
click node_stock_search "https://github.com/siva010505/helio/blob/master/src/services/stock_search.py"
click node_quality "https://github.com/siva010505/helio/blob/master/src/agents/evaluation_agent.py"
click node_upload "https://github.com/siva010505/helio/blob/master/src/agents/upload_agent.py"
click node_analytics "https://github.com/siva010505/helio/blob/master/src/agents/analytics_agent.py"
click node_latest_content "https://github.com/siva010505/helio/blob/master/shared/latest_long_form.json"
click node_visual_history "https://github.com/siva010505/helio/blob/master/data/visual_history.json"
click node_database "https://github.com/siva010505/helio/blob/master/data/agent.db"
click node_llm_client "https://github.com/siva010505/helio/blob/master/src/llm_client.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_daily_workflow,node_daily_runner,node_pipeline toneBlue
class node_orchestrator,node_research,node_script,node_assembly,node_voice_metadata,node_quality,node_upload,node_analytics toneAmber
class node_visual_direction,node_visual_plan,node_stock_search toneMint
class node_latest_content,node_visual_history,node_database,node_llm_client toneRose
class node_youtube,node_stock_provider toneIndigo
```

## Components

### Automation

- [Daily schedule](https://github.com/siva010505/helio/blob/master/.github/workflows/daily_pipeline.yml): GitHub Actions workflow · `.github/workflows/daily_pipeline.yml`
- [Daily pipeline runner](https://github.com/siva010505/helio/blob/master/scripts/run_daily_pipeline.py): CLI entry point · `scripts/run_daily_pipeline.py`
- [Pipeline workflow](https://github.com/siva010505/helio/blob/master/src/pipeline.py): top-level orchestration · `src/pipeline.py`

### Agent pipeline

- [Agent orchestrator](https://github.com/siva010505/helio/blob/master/src/agents/orchestrator.py): stage coordinator · `src/agents/orchestrator.py`
- [Research](https://github.com/siva010505/helio/blob/master/src/agents/research_agent.py): agent · `src/agents/research_agent.py`
- [Script & punch](https://github.com/siva010505/helio/blob/master/src/agents/script_agent.py): agent stage · Creates narrative and refines hooks. · `src/agents/script_agent.py`
- [Content assembly](https://github.com/siva010505/helio/blob/master/src/agents/assembly_agent.py): agent · Builds final content artifacts. · `src/agents/assembly_agent.py`
- [Voice, captions & SEO](https://github.com/siva010505/helio/blob/master/src/agents/voice_agent.py): agent stage · `src/agents/voice_agent.py`
- [Evaluation & scoring](https://github.com/siva010505/helio/blob/master/src/agents/evaluation_agent.py): agent stage · `src/agents/evaluation_agent.py`
- [YouTube upload](https://github.com/siva010505/helio/blob/master/src/agents/upload_agent.py): agent · `src/agents/upload_agent.py`
- [Analytics feedback](https://github.com/siva010505/helio/blob/master/src/agents/analytics_agent.py): agent · `src/agents/analytics_agent.py`

### Visual production

- [Visual direction](https://github.com/siva010505/helio/blob/master/src/agents/visual_director_agent.py): agent · `src/agents/visual_director_agent.py`
- [Shot planner](https://github.com/siva010505/helio/blob/master/src/agents/visual_planner_agent.py): agent · `src/agents/visual_planner_agent.py`
- [Stock search](https://github.com/siva010505/helio/blob/master/src/services/stock_search.py): service adapter · `src/services/stock_search.py`

### Data & AI

- [Latest long-form package](https://github.com/siva010505/helio/blob/master/shared/latest_long_form.json): cross-stage artifact · `shared/latest_long_form.json`
- [Visual history](https://github.com/siva010505/helio/blob/master/data/visual_history.json): history artifact · `data/visual_history.json`
- [Agent database](https://github.com/siva010505/helio/blob/master/data/agent.db): local persistence · `data/agent.db`
- [LLM client](https://github.com/siva010505/helio/blob/master/src/llm_client.py): provider boundary · `src/llm_client.py`

### External services

- **YouTube APIs**: upload & analytics service
- **Stock-media provider**: search service

## Connections

- Daily schedule → Daily pipeline runner: scheduled run
- Daily pipeline runner → Pipeline workflow: starts
- Pipeline workflow → Agent orchestrator: coordinates through
- Agent orchestrator → Research: research stage
- Research → Script & punch: topic inputs
- Script & punch → Voice, captions & SEO: script
- Script & punch → Visual direction: creative brief
- Visual direction → Shot planner: direction
- Shot planner → Stock search: asset queries
- Stock search → Stock-media provider: retrieves media
- Visual history → Shot planner: prior decisions
- Voice, captions & SEO → Content assembly: production outputs
- Shot planner → Content assembly: visual plan & assets
- Content assembly → Latest long-form package: writes package
- Latest long-form package → Evaluation & scoring: evaluates
- Evaluation & scoring → YouTube upload: approved package
- YouTube upload → YouTube APIs: publishes via OAuth
- YouTube APIs → Analytics feedback: performance data
- Analytics feedback → Research: future topic feedback
- Analytics feedback → Agent database: persists insights
- Agent orchestrator → LLM client: agent inference
