Files
papers/hanzo-platform/sections/04-unified-resource-model.tex

67 lines
2.5 KiB
TeX

\section{Unified Resource Model}
\label{sec:resources}
\subsection{Resource Types}
Hanzo Platform provides seven first-class resource types:
\begin{table}[H]
\centering
\small
\begin{tabular}{llc}
\toprule
\textbf{Resource} & \textbf{Description} & \textbf{Provision Time} \\
\midrule
Compute (CPU) & Container instances & $<$ 30s \\
Compute (GPU) & GPU-accelerated instances & $<$ 120s \\
PostgreSQL & Managed relational DB & $<$ 60s \\
Redis & Managed cache/queue & $<$ 30s \\
Vector DB & pgvector or Qdrant & $<$ 60s \\
Object Storage & S3-compatible & $<$ 10s \\
LLM Gateway & Multi-provider LLM access & Instant \\
\bottomrule
\end{tabular}
\caption{Platform resource types and provisioning times.}
\label{tab:resources}
\end{table}
\subsection{Declarative Resource Binding}
Resources are bound to applications via environment variables and service mesh connections. The platform automatically injects connection strings, API keys, and service discovery information:
\begin{algorithm}[H]
\caption{Resource Binding}
\label{alg:binding}
\begin{algorithmic}[1]
\Require Application $A$, resource declarations $R$
\For{each resource $r \in R$}
\State $\text{instance} \gets \text{Provision}(r.\text{type}, r.\text{config})$
\State $\text{env} \gets \text{GenerateEnvVars}(\text{instance})$
\State Inject $\text{env}$ into application containers
\State Configure network policy: $A \leftrightarrow \text{instance}$
\EndFor
\State \Return bound application
\end{algorithmic}
\end{algorithm}
For example, declaring a \texttt{vector} resource automatically:
\begin{enumerate}[leftmargin=1.4em]
\item Provisions a pgvector instance with the specified dimensions.
\item Injects \texttt{VECTOR\_DB\_URL} into the application environment.
\item Creates a Kubernetes NetworkPolicy allowing direct access.
\item Configures backup and monitoring.
\end{enumerate}
\subsection{LLM Gateway Integration}
The LLM Gateway resource provides unified access to 100+ models via a single API endpoint:
\begin{itemize}[leftmargin=1.1em]
\item \textbf{Automatic routing}: Requests are routed to the optimal provider based on model, cost, and latency.
\item \textbf{Cost budgets}: Per-application monthly cost limits with alerts at 75\% and 90\%.
\item \textbf{Key management}: API keys are stored in encrypted vaults and injected at runtime. The application never sees raw provider keys.
\item \textbf{Usage analytics}: Per-model, per-request cost tracking with real-time dashboards.
\end{itemize}