Skip to content

About

Local-first FastAPI control plane for policy-governed transfer operations.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

Abstract TransferOps systems banner

TransferOps

Local-first operations control for policy-governed transfer queues.
Disk budgets, lifecycle obligations, manual approvals, audit trails, and agent-friendly APIs in one dashboard.

Python FastAPI SQLite Agent API

Features · Architecture · Quick Start · API ·


Overview

TransferOps is a finished local-first FastAPI application for running a small operations desk around queued transfers. It evaluates incoming candidates, enforces disk and retention policies, records every decision, and gives operators a dense authenticated dashboard for daily review.

TransferOps overview dashboard with budget meters and decision audit

It is intentionally boring where infrastructure should be boring:

  • local SQLite persistence by default
  • explicit dry-run mode for safe demos
  • runtime-editable settings with masked secrets
  • auditable admission decisions
  • separate automatic and manual lanes
  • agent API and MCP bridge for tool-assisted operations

Features

Policy Engine

Scores candidates against disk pressure, retention obligations, source confidence, historical learning, and lane-specific thresholds.

Operations Dashboard

Authenticated FastAPI/Jinja dashboard with live refresh, budget meters, runtime settings, health checks, audit tables, and manual request workflows.

Lifecycle Accounting

Tracks active items from candidate intake through managed retention, safe state, retirement eligibility, and error handling.

Agent-Ready API

Bearer-token protected endpoints plus an MCP bridge for local agents that need inspection, planning, and controlled execution tools.

Budget Guardrails

Separate automatic and manual budgets, high-water marks, free-disk checks, unresolved-work caps, and emergency posture reporting.

Adapter Boundary

Provider and executor integrations stay behind explicit service modules so the policy core remains inspectable and testable.

The operational view stays table-first on purpose: it is built for scanning state, score, retention posture, tags, and paths without opening a separate admin tool.

Managed transfers table with lifecycle state, score, tags, and save paths

Signals and learning buckets are visible alongside the main workflow, so the system's scoring behavior can be inspected instead of treated as a black box.

Wanted signals and learning buckets dashboard

Architecture

flowchart LR
  A["Source adapters"] --> B["Candidate normalizer"]
  B --> C["Policy scoring engine"]
  C --> D{"Admit?"}
  D -->|yes| E["Transfer executor"]
  D -->|no| F["Decision audit log"]
  E --> G["Lifecycle reconciler"]
  G --> H["Learning buckets"]
  G --> I["Dashboard state"]
  I --> J["Operator dashboard"]
  I --> K["Agent API / MCP tools"]
Loading

The codebase is organized around explicit boundaries:

app/
  main.py                 FastAPI routes, scheduler jobs, dashboard rendering
  config.py               typed runtime settings
  models.py               SQLAlchemy persistence models
  services/
    controller.py         admission, reconciliation, audit events
    scoring.py            policy score calculation
    lifecycle.py          managed-state transitions
    settings.py           runtime setting overrides and masking
    integrations.py       health checks and upstream API boundaries
    manual_requests.py    operator-initiated request workflow
scripts/
  transferops_mcp.py      local MCP bridge around the agent API
tests/
  test_api.py             API and workflow coverage
  test_controller.py      policy engine and lifecycle coverage

Quick Start

TransferOps uses uv for Python dependency management.

uv sync --python 3.12
Copy-Item .env.example .env
uv run uvicorn app.main:app --reload --host 127.0.0.1 --port 8000

Open the dashboard:

http://127.0.0.1:8000

Default demo credentials:

username: admin
password: change-me

The app starts in dry_run mode by default, so it is safe to inspect without connecting a real executor.

Configuration

Most settings can be changed from the dashboard and are persisted as runtime overrides. Secrets are masked in API responses and can be rotated without rewriting source files.

Runtime settings screen with executor, storage, and policy controls

Common .env values:

TRANSFEROPS_APP_NAME=TransferOps
TRANSFEROPS_ENV=development
TRANSFEROPS_DATABASE_URL=sqlite:///./transferops.db
TRANSFEROPS_DRY_RUN=true
TRANSFEROPS_DASHBOARD_USERNAME=admin
TRANSFEROPS_DASHBOARD_PASSWORD=change-me
TRANSFEROPS_AGENT_API_TOKEN=transferops-local-agent
TRANSFEROPS_QBIT_CATEGORY=transferops.managed
TRANSFEROPS_QBIT_TAG=transferops.managed
TRANSFEROPS_QBIT_SAVE_PATH=C:\TransferOps\managed
TRANSFEROPS_HOST_DISK_CHECK_PATH=C:\TransferOps\managed

API Surface

TransferOps exposes both dashboard endpoints and JSON APIs:

Area Endpoint
Dashboard GET /
Status GET /api/status
Decisions GET /api/decisions
Managed transfers GET /api/torrents
Runtime settings GET /api/settings, PUT /api/settings
Manual requests POST /api/agent/requests
Candidate planning GET /api/agent/requests/{id}/candidates
Controlled execution POST /api/agent/requests/{id}/select-candidate
Agent overview GET /api/agent/overview

Agent routes require:

Authorization: Bearer transferops-local-agent

Development

uv run pytest
uv run ruff check .

The test suite uses fake executor and integration clients so core policy behavior can be validated without external services.

License

MIT

About

Local-first FastAPI control plane for policy-governed transfer operations.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages