% --- System architecture: layered tiers --- \begin{figure}[htbp] \centering \begin{tikzpicture}[vqfont, node distance=0.95cm and 0.85cm] % ---- Client tier ---- \node[vqteal, minimum width=5.2cm] (ui) {\textbf{Conversational UI}\\[1pt]\vqsmall single-page app; SSE client; figure / table renderers}; % ---- Server core ---- \node[vqblue, below=of ui, minimum width=5.2cm] (orch) {\textbf{Orchestration service}\\[1pt]\vqsmall system prompt $\cdot$ token budget $\cdot$ SSE parse}; \node[vqblue, below=of orch, minimum width=5.2cm] (loop) {\textbf{Recursive tool-calling loop}\\[1pt]\vqsmall batched execution $\cdot$ 5 / batch $\cdot$ 500\,ms}; \node[vqblue, right=1.0cm of loop, minimum width=2.7cm] (db) {\textbf{Persistence}\\[1pt]\vqsmall sessions $\cdot$ reports\\token ledger $\cdot$ analytics}; % ---- Executor row ---- \node[vqblue, below left=1.15cm and -0.2cm of loop, minimum width=2.7cm] (fin) {\textbf{Financial tools}\\[1pt]\vqsmall 2 providers $\cdot$ 233 endpoints}; \node[vqblue, below=1.15cm of loop, minimum width=2.7cm] (py) {\textbf{Python sandbox}\\[1pt]\vqsmall 29 packages}; \node[vqblue, below right=1.15cm and -0.2cm of loop, minimum width=2.7cm] (web) {\textbf{Web research}\\[1pt]\vqsmall 3 services $\cdot$ 14 tools}; % ---- External tier ---- \node[vqpurple, below=of fin, minimum width=2.7cm] (fmp) {\textbf{Market-data API}\\[1pt]\vqsmall live quotes, filings, macro}; \node[vqpurple, below=of py, minimum width=2.7cm] (quant) {\textbf{Numerical methods}\\[1pt]\vqsmall MC $\cdot$ BSM $\cdot$ GARCH $\cdot$ VaR; figures}; \node[vqpurple, below=of web, minimum width=2.7cm] (search) {\textbf{Scrape / search}\\[1pt]\vqsmall keyword $\cdot$ semantic}; % ---- Document pipeline ---- \node[vqorange, below=1.1cm of quant, minimum width=8.6cm] (doc) {\textbf{Document pipeline} \;\vqsmall PDF $\cdot$ DOCX $\cdot$ Beamer slides $\cdot$ live-formula XLSX}; % ---- Edges ---- \draw[vqdarr] (ui) -- node[right, vqsmall]{SSE stream} (orch); \draw[vqarr] (orch) -- (loop); \draw[vqdarr] (loop) -- (db); \draw[vqdarr] (loop) -- node[left, vqsmall, pos=0.55]{call} (fin); \draw[vqdarr] (loop) -- node[right, vqsmall, pos=0.55]{result} (py); \draw[vqdarr] (loop) -- (web); \draw[vqdarr] (fin) -- (fmp); \draw[vqdarr] (py) -- (quant); \draw[vqdarr] (web) -- (search); \draw[vqarr] (quant) -- (doc); % Export path routed along the right margin, clearing the Persistence box \coordinate (far) at ([xshift=1.15cm]db.east); \draw[vqflow] (doc.east) to[out=0,in=-90] (far) to[out=90,in=0] node[right, vqsmall, pos=0.5]{export} (ui.east); % ---- Tier bands (background) ---- \begin{scope}[on background layer] \node[vqband, fill=VQTeal!7, fit=(ui), inner sep=6pt] (bc) {}; \node[vqband, fill=VQBlue!7, fit=(orch)(loop)(db)(fin)(web), inner sep=7pt] (bs) {}; \node[vqband, fill=VQPurple!6, fit=(fmp)(search), inner sep=6pt] (be) {}; \node[vqband, fill=VQOrange!8, fit=(doc), inner sep=6pt] (bd) {}; \end{scope} \node[vqsmall, rotate=90, text=VQTeal!60!black] at ([xshift=-3pt]bc.west) {CLIENT}; \node[vqsmall, rotate=90, text=VQBlue!60!black] at ([xshift=-3pt]bs.west) {SERVER}; \node[vqsmall, rotate=90, text=VQPurple!55!black] at ([xshift=-3pt]be.west) {EXTERNAL}; \end{tikzpicture} \caption{\textbf{Layered system architecture.} The React \emph{client} streams over Server-Sent Events. The \emph{server} runs the orchestration service and the recursive tool-calling loop, which routes the model's calls---throttled to five per batch with a 500\,ms spacing---to three executor families and persists every session. \emph{External} services supply live data, deterministic numerical results, and web content. On request, the document pipeline renders the final Markdown into four formats and the result is streamed back to the client. Double-headed arrows carry a call and its result; the heavy teal arrow is the export path.} \label{fig:architecture} \end{figure}