Skip to content
activeSystemsStarted: Aug 15, 2026

S.A.R.A. Task Control Plane & Telegram Relay

A resilient background orchestration plane managing asynchronous local tasks, health checks, cron triggers, and bidirectional Telegram alerts.

Technology Stack

PythonFastAPISQLiteTelegram Bot APIsystemdLinux

My Role

Solo Developer

System Architecture
  1. 1Telegram Long-Polling Listener
  2. 2State Machine & Auth Guard
  3. 3SQLite Priority Job Queue
  4. 4Local Worker Pool (Subprocess Sandbox)
  5. 5Health Monitor & Telemetry Heartbeat
  • 1Telegram Long-Polling Listener──▶2State Machine & Auth Guard
  • 2State Machine & Auth Guard──▶3SQLite Priority Job Queue
  • 3SQLite Priority Job Queue──▶4Local Worker Pool (Subprocess Sandbox)
  • 4Local Worker Pool (Subprocess Sandbox)──▶5Health Monitor & Telemetry Heartbeat

Overview

Managing homelab infrastructure, video rendering pipelines, and background database backups often requires immediate remote intervention without exposing SSH ports to the public internet.

S.A.R.A. (System Automation & Remote Agent) Control Plane is a self-hosted orchestration service. It turns an authenticated private Telegram chat into a secure, responsive remote command center for developer workstations and local servers.

Key Capabilities

  • Secure Telegram Remote Terminal: Authenticated via user ID cryptographic hash checking. Execute pre-approved operational runbooks (e.g., restart service, inspect journalctl logs, trigger database snapshot) without opening WAN ports.
  • Persistent Job Queue: If the host loses connectivity or reboots, in-flight jobs remain queued in an atomic SQLite database with WAL (Write-Ahead Logging) enabled.
  • Proactive Health Telemetry: Automatically notifies the administrator when disk space drops below 15%, memory exceeds 90%, or the local UPS switches to battery power during load shedding.
  • Resource Sandboxing: Shell scripts run under an unprivileged system user with strict timeout thresholds (max 120s) and cgroup memory limits.

Interactive Source Explorer & Live CLI Sandbox

Browse source implementation and execute in-browser sandbox simulation.

GitHub Repo
$python -m sara.daemon --poll-interval 1.0
Source Tree (1 Files)
orchestrator.pypython
import sqlite3
import asyncio

class TaskQueue:
    def __init__(self, db_path: str = "jobs.db"):
        self.conn = sqlite3.connect(db_path, isolation_level=None)
        self.conn.execute("PRAGMA journal_mode=WAL")
        self.conn.execute("CREATE TABLE IF NOT EXISTS jobs (id TEXT PRIMARY KEY, cmd TEXT, status TEXT)")

Project Changelog

Core Architecture

Engineered single-process event loop handling Telegram webhooks and job queuing.

Sandboxed Execution

Added permission tiers and resource limits to shell execution tasks.