Files
myfileagent-pipeline/documentation/devopsProjectProposal.tex
2026-10-15 00:24:04 +00:00

162 lines
9.5 KiB
TeX

\chapter{Project Proposal}
\ChapterLabel{ProjectProposal}
\index{project proposal}
\index{DevSecOps pipeline}
\index{agentic LLM}
\index{Python}
\index{Grafana}
\section{Project Title}
\begin{center}
\Large\textbf{MyFileAgent Pipeline: One-Click DevSecOps Deployment for an Agentic LLM}
\end{center}
\section{Project Description and Primary Focus}
The primary product of this project is an automated, repeatable DevSecOps
pipeline that will install, configure, and demonstrate file-interaction tasks with an LLM. The pipeline will install required
packages, download a pinned small language model from the Hugging Face Hub,
build the containers, create the configuration, run security and functional
tests, deploy the services to a DigitalOcean Ubuntu Droplet, and perform
post-deployment health checks. A user will start the complete workflow through
one manual GitHub Actions button or one documented local command.
Once automatically configured for the specific environment it is deployed to, the LLM can be given a file name or expected text which it will use to locate a file on the system. It will also be given the new contents for that file and will perform a controlled text replacement. It will call a tool using Python libraries to perform the deterministic
file validation, backup, diff display, and write operation. The project
does not promise general desktop control, autonomous file discovery, open-ended
planning, or unrestricted shell access, and will focus on the installation and setup pipeline rather than the extending the LLM's capabilities.
The model will be downloaded from the Hugging Face Hub using its supported
download workflow \cite{HuggingFaceHubDownload}. A small quantized GGUF model
will run locally through \texttt{llama.cpp} \cite{LlamaCpp}. Pinning the model
revision and checksum will make repeated pipeline runs reproducible.
\section{Demonstration Task}
The pipeline's end-to-end acceptance test will demonstrate installation, configuration, deployment, and usage of the LLM model. Each step of this process will be clearly displayed using visual metrics from GitHub actions, DigitalOcean droplet system resource monitoring, and Grafana. Finally, the following task (implemented as a test case) will demonstrate that this process was successful:
\begin{quote}
``In the approved demonstration folder, open the file about \texttt{project status}, verify
that it contains \texttt{Status: Draft}, and replace that line with
\texttt{Status: Reviewed}.''
\end{quote}
The application will receive a description of the target file's name (not necessarily an exact path) and replacement values, confirm
that the file exists inside the allowed folder, create a backup, show a diff,
perform the replacement, verify the saved result, and append a JSON Lines audit
record. If validation fails, it will stop without modifying the file.
\section{One-Click Pipeline}
The pipeline will perform the following stages in order:
\begin{enumerate}[label=\arabic*.]
\item validate required secrets, variables, model identifiers, and target
Droplet information;
\item install or verify Docker, Docker Compose, Python dependencies, and
required monitoring components;
\item download the pinned model and verify its checksum;
\item lint and statically analyze the Python source;
\item run unit, integration, security, and minimal end-to-end tests;
\item build and scan versioned container images;
\item generate deployment configuration from protected variables;
\item deploy the application, inference, Prometheus, and Grafana services;
\item run health checks and the fixed file-replacement acceptance test; and
\item publish test (e.g., via the task outlined above), scan, deployment, and monitoring results.
\end{enumerate}
The workflow will fail immediately when a required stage fails. Deployment
will use pinned versions, health checks, restart policies, resource limits, and
a rollback target. Re-running the same workflow should be idempotent and should
not duplicate configuration or damage an existing deployment.
\section{Proposed Architecture and Tools}
\begin{longtable}{L{2.7cm}L{4.2cm}L{7.3cm}}
\caption{Proposed MyFileAgent pipeline}\label{Table:MyFileAgentPipeline}\\
\toprule
\textbf{Stage} & \textbf{Planned Tools} & \textbf{Purpose} \\
\midrule
\endfirsthead
\toprule
\textbf{Stage} & \textbf{Planned Tools} & \textbf{Purpose} \\
\midrule
\endhead
\bottomrule
\endlastfoot
Source control & Git and GitHub & Store pipeline definitions, Python source, tests, Docker files, configuration templates, issues, and version history. \\
One-click orchestration & GitHub Actions \texttt{workflow\_dispatch}, Bash, and a Makefile & Provide one manual action that validates, builds, tests, scans, deploys, and verifies the complete system \cite{GitHubActions}. \\
File operations & Python \texttt{pathlib}, \texttt{shutil}, \texttt{difflib}, and atomic replacement & Provide a tool the LLM Agent will call to enforce the approved folder, create a backup, generate a diff, perform the single text replacement, and verify the result \cite{PythonPathlib}. \\
Model acquisition & Hugging Face Hub & Download a selected small model and pin its revision and checksum. \\
Inference & \texttt{llama.cpp} with a quantized GGUF model & Run a resource-conscious local model for the demonstration. \\
Testing & \texttt{pytest}, mocks, and temporary directories & Test configuration, file safeguards, backup and replacement behavior, failure handling, and the deployed acceptance case \cite{PytestDocs}. \\
Security & Ruff & Check Python quality, static-analysis rules. \\
Packaging and deployment & Docker Compose and DigitalOcean & Build and deploy versioned application, inference, and monitoring services on the Ubuntu Droplet. \\
Application monitoring & Prometheus and Grafana & Collect pipeline and application metrics and display build, test, deployment, health, latency, token, and failure information in a dashboard \cite{PrometheusOverview,GrafanaPrometheus}. \\
Host monitoring & DigitalOcean Monitoring & Supplement Grafana with Droplet-level CPU, memory, disk, and availability graphs and alerts \cite{DigitalOceanMonitoring}. \\
Audit storage & JSON Lines files and retained CI artifacts & Preserve pipeline results and a small append-only record of demonstration runs without requiring a separate database service. \\
\end{longtable}
\section{DevSecOps and Testing Strategy}
Security and verification are pipeline gates rather than later manual tasks.
Pull requests will run formatting, linting, unit tests, dependency checks,
static analysis, and container scanning. Only an approved main-branch revision
may start deployment. The containers will run as non-root users, secrets will
come from protected variables, and the demonstration workspace will be the
only writable application mount.
The automated test suite will emphasize the delivery system:
\begin{itemize}
\item pipeline configuration tests for required variables, pinned versions,
repeatable installation, failure handling, and rollback information;
\item Python tool to be called by the LLM; unit tests for path boundaries, backups, diffs, atomic writes,
audit records, and rejection of invalid input;
\item integration tests using temporary folders and a mocked inference
response;
\item security gates for source, dependencies, secrets, and images; and
\item a post-deployment acceptance test that performs only the fixed sample
replacement and confirms the backup, result, audit entry, and health
status.
\end{itemize}
\section{Monitoring Dashboard}
Grafana will be the main operational dashboard. Prometheus will supply metrics
for pipeline duration, test pass or failure counts, deployment status,
container health, inference latency, limited token estimates, acceptance-test
results, and application errors. These measures show whether the automated
delivery pipeline is reliable and repeatable; token information is a supporting
metric rather than the project's main goal. DigitalOcean Monitoring may be used
in addition for host-level CPU, memory, disk, and availability information.
\section{Planned Deliverables and Milestones}
\begin{enumerate}[label=\arabic*.]
\item define the one-click pipeline stages, configuration contract, success
criteria, and rollback approach;
\item create the GitHub repository, Python demonstration service and LLM-callable tool, and automated tests;
\item Choose a small model, pin and download it, and confirm the single demonstration
task locally;
\item create the Docker Compose deployment and security gates;
\item automate installation, configuration, build, test, scan, deployment,
health checking, and acceptance testing through one trigger;
\item configure Prometheus and Grafana, with DigitalOcean host monitoring as
an optional additional source;
and
\item demonstrate a clean one-click run and document timing, test, security,
monitoring, failure, and rollback results.
\end{enumerate}
\section{Success Criteria and Unique Contribution}
The project succeeds when one authorized action can take a documented target
from prerequisites to a healthy, tested, monitored deployment. The run must
install or validate dependencies, retrieve the pinned model, build containers,
pass automated tests and security gates, deploy the services, complete health
checks, execute the fixed file-replacement acceptance test, and expose results
in Grafana. A repeated run must be safe and produce consistent results, while a
failed gate must prevent or stop deployment and provide useful logs.