# hassancs91/pyrunner architecture

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

- Interactive diagram: https://gitdiagram.com/hassancs91/pyrunner
- Repository: https://github.com/hassancs91/pyrunner

## Overview

PyRun is a self-hosted Python script automation platform. Its principal workflow is browser-based script management followed by manual or scheduled execution, with run history and logs for monitoring. Scheduling and background tasks dispatch execution; environments isolate dependencies. Separate capabilities include encrypted secrets, AI providers, notifications, plugins, data services, vector search, and backups. The graph uses README statements and the supplied source index/excerpts for relationships; unsampled components are included where the README documents them, but their internal calls are not inferred.

Main entry points: [`core/tasks.py`](https://github.com/hassancs91/pyrunner/blob/main/core/tasks.py) (Background tasks), [`core/executor.py`](https://github.com/hassancs91/pyrunner/blob/main/core/executor.py) (Script executor), [`core/services/schedule_service.py`](https://github.com/hassancs91/pyrunner/blob/main/core/services/schedule_service.py) (Schedule service), [`core/plugins/api.py`](https://github.com/hassancs91/pyrunner/blob/main/core/plugins/api.py) (Plugin SDK)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Control panel"]
  node_script_views["Script management<br/>[scripts.py]"]
  node_schedule_views["Schedule controls<br/>[tasks.py]"]
  node_service_views["Services console<br/>[services.py]"]
end

subgraph group_execution["Script execution"]
  node_script_models[("Scripts and runs<br/>[run.py]")]
  node_schedule_model[("Schedule records<br/>[schedule.py]")]
  node_schedule_service["Schedule service"]
  node_task_queue["Background tasks<br/>[tasks.py]"]
  node_executor["Script executor<br/>[executor.py]"]
end

subgraph group_platform["Platform services"]
  node_environments["Python environments"]
  node_logs["Run history and logs<br/>[logging.py]"]
  node_secrets["Encrypted secrets"]
  node_notifications["Notifications"]
end

subgraph group_extensions["Extensions and data"]
  node_ai["Script AI<br/>[pyrunner_ai.py]"]
  node_plugins["Plugin SDK<br/>[api.py]"]
  node_vectors["Vector service<br/>[service.py]"]
  node_vector_store[("Vector stores<br/>[local_store.py]")]
end

subgraph group_operations["Operations"]
  node_backup["Backup and restore<br/>[backup_service.py]"]
  node_backup_schedule["Backup scheduling"]
  node_object_storage[("S3-compatible storage<br/>[s3_service.py]")]
end

node_user(("Operator"))
node_browser(("Web browser"))

node_user -->|"uses"| node_browser
node_browser -->|"manages scripts"| node_script_views
node_browser -->|"sets schedules"| node_schedule_views
node_browser -->|"configures services"| node_service_views
node_script_views -.->|"manages"| node_script_models
node_schedule_views -.->|"configures"| node_schedule_service
node_schedule_service -->|"stores schedules"| node_schedule_model
node_schedule_service -->|"schedules tasks"| node_task_queue
node_task_queue -->|"dispatches execution"| node_executor
node_task_queue -->|"loads run data"| node_script_models
node_executor -.->|"uses environments"| node_environments
node_task_queue -->|"sends alerts"| node_notifications
node_executor -.->|"captures output"| node_logs
node_executor -.->|"uses secrets"| node_secrets
node_executor -.->|"calls script helpers"| node_ai
node_plugins -->|"queues runs"| node_task_queue
node_plugins -->|"exposes vectors"| node_vectors
node_vectors -->|"uses local backend"| node_vector_store
node_service_views -.->|"manages backups"| node_backup
node_backup_schedule -->|"schedules backups"| node_task_queue
node_backup -.->|"stores backups"| node_object_storage

click node_script_views "https://github.com/hassancs91/pyrunner/blob/main/core/views/scripts.py"
click node_schedule_views "https://github.com/hassancs91/pyrunner/blob/main/core/views/tasks.py"
click node_service_views "https://github.com/hassancs91/pyrunner/blob/main/core/views/services.py"
click node_script_models "https://github.com/hassancs91/pyrunner/blob/main/core/models/run.py"
click node_schedule_model "https://github.com/hassancs91/pyrunner/blob/main/core/models/schedule.py"
click node_schedule_service "https://github.com/hassancs91/pyrunner/blob/main/core/services/schedule_service.py"
click node_task_queue "https://github.com/hassancs91/pyrunner/blob/main/core/tasks.py"
click node_executor "https://github.com/hassancs91/pyrunner/blob/main/core/executor.py"
click node_environments "https://github.com/hassancs91/pyrunner/blob/main/core/services/environment_service.py"
click node_logs "https://github.com/hassancs91/pyrunner/blob/main/core/logging.py"
click node_secrets "https://github.com/hassancs91/pyrunner/blob/main/core/services/encryption_service.py"
click node_notifications "https://github.com/hassancs91/pyrunner/blob/main/core/services/notification_service.py"
click node_ai "https://github.com/hassancs91/pyrunner/blob/main/core/script_helpers/pyrunner_ai.py"
click node_plugins "https://github.com/hassancs91/pyrunner/blob/main/core/plugins/api.py"
click node_vectors "https://github.com/hassancs91/pyrunner/blob/main/core/vectors/service.py"
click node_vector_store "https://github.com/hassancs91/pyrunner/blob/main/core/vectors/local_store.py"
click node_backup "https://github.com/hassancs91/pyrunner/blob/main/core/services/backup_service.py"
click node_backup_schedule "https://github.com/hassancs91/pyrunner/blob/main/core/services/backup_schedule_service.py"
click node_object_storage "https://github.com/hassancs91/pyrunner/blob/main/core/services/s3_service.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_script_views,node_schedule_views,node_service_views,node_browser toneBlue
class node_script_models,node_schedule_model,node_schedule_service,node_task_queue,node_executor toneAmber
class node_environments,node_logs,node_secrets,node_notifications toneMint
class node_ai,node_plugins,node_vectors,node_vector_store toneRose
class node_backup,node_backup_schedule,node_object_storage,node_user toneIndigo
```

## Components

### Control panel

- [Script management](https://github.com/hassancs91/pyrunner/blob/main/core/views/scripts.py): `core/views/scripts.py`
- [Schedule controls](https://github.com/hassancs91/pyrunner/blob/main/core/views/tasks.py): `core/views/tasks.py`
- [Services console](https://github.com/hassancs91/pyrunner/blob/main/core/views/services.py): `core/views/services.py`

### Script execution

- [Scripts and runs](https://github.com/hassancs91/pyrunner/blob/main/core/models/run.py): `core/models/run.py`
- [Schedule records](https://github.com/hassancs91/pyrunner/blob/main/core/models/schedule.py): `core/models/schedule.py`
- [Schedule service](https://github.com/hassancs91/pyrunner/blob/main/core/services/schedule_service.py): `core/services/schedule_service.py`
- [Background tasks](https://github.com/hassancs91/pyrunner/blob/main/core/tasks.py): `core/tasks.py`
- [Script executor](https://github.com/hassancs91/pyrunner/blob/main/core/executor.py): `core/executor.py`

### Platform services

- [Python environments](https://github.com/hassancs91/pyrunner/blob/main/core/services/environment_service.py): `core/services/environment_service.py`
- [Run history and logs](https://github.com/hassancs91/pyrunner/blob/main/core/logging.py): `core/logging.py`
- [Encrypted secrets](https://github.com/hassancs91/pyrunner/blob/main/core/services/encryption_service.py): `core/services/encryption_service.py`
- [Notifications](https://github.com/hassancs91/pyrunner/blob/main/core/services/notification_service.py): `core/services/notification_service.py`

### Extensions and data

- [Script AI](https://github.com/hassancs91/pyrunner/blob/main/core/script_helpers/pyrunner_ai.py): `core/script_helpers/pyrunner_ai.py`
- [Plugin SDK](https://github.com/hassancs91/pyrunner/blob/main/core/plugins/api.py): `core/plugins/api.py`
- [Vector service](https://github.com/hassancs91/pyrunner/blob/main/core/vectors/service.py): `core/vectors/service.py`
- [Vector stores](https://github.com/hassancs91/pyrunner/blob/main/core/vectors/local_store.py): `core/vectors/local_store.py`

### Operations

- [Backup and restore](https://github.com/hassancs91/pyrunner/blob/main/core/services/backup_service.py): `core/services/backup_service.py`
- [Backup scheduling](https://github.com/hassancs91/pyrunner/blob/main/core/services/backup_schedule_service.py): `core/services/backup_schedule_service.py`
- [S3-compatible storage](https://github.com/hassancs91/pyrunner/blob/main/core/services/s3_service.py): `core/services/s3_service.py`

### Other components

- **Operator**
- **Web browser**

## Connections

- Operator → Web browser: uses (evidence: `README.md`)
- Web browser → Script management: manages scripts (evidence: `README.md`)
- Web browser → Schedule controls: sets schedules (evidence: `README.md`)
- Web browser → Services console: configures services (evidence: `README.md`)
- Script management → Scripts and runs: manages
- Schedule controls → Schedule service: configures
- Schedule service → Schedule records: stores schedules (evidence: `core/services/schedule_service.py`)
- Schedule service → Background tasks: schedules tasks (evidence: `core/tasks.py`)
- Background tasks → Script executor: dispatches execution (evidence: `core/tasks.py`)
- Background tasks → Scripts and runs: loads run data (evidence: `core/tasks.py`)
- Script executor → Python environments: uses environments
- Background tasks → Notifications: sends alerts (evidence: `core/tasks.py`)
- Script executor → Run history and logs: captures output
- Script executor → Encrypted secrets: uses secrets
- Script executor → Script AI: calls script helpers
- Plugin SDK → Background tasks: queues runs (evidence: `core/plugins/api.py`)
- Plugin SDK → Vector service: exposes vectors (evidence: `core/plugins/api.py`)
- Vector service → Vector stores: uses local backend (evidence: `core/vectors/service.py`)
- Services console → Backup and restore: manages backups
- Backup scheduling → Background tasks: schedules backups (evidence: `core/services/backup_schedule_service.py`)
- Backup and restore → S3-compatible storage: stores backups
