TeX 93.9%
Python 6%
1% --- System architecture: layered tiers ---2\begin{figure}[htbp]3\centering4\begin{tikzpicture}[vqfont, node distance=0.95cm and 0.85cm]56% ---- Client tier ----7\node[vqteal, minimum width=5.2cm] (ui)8 {\textbf{Conversational UI}\\[1pt]\vqsmall single-page app; SSE client; figure / table renderers};910% ---- Server core ----11\node[vqblue, below=of ui, minimum width=5.2cm] (orch)12 {\textbf{Orchestration service}\\[1pt]\vqsmall system prompt $\cdot$ token budget $\cdot$ SSE parse};13\node[vqblue, below=of orch, minimum width=5.2cm] (loop)14 {\textbf{Recursive tool-calling loop}\\[1pt]\vqsmall batched execution $\cdot$ 5 / batch $\cdot$ 500\,ms};15\node[vqblue, right=1.0cm of loop, minimum width=2.7cm] (db)16 {\textbf{Persistence}\\[1pt]\vqsmall sessions $\cdot$ reports\\token ledger $\cdot$ analytics};1718% ---- Executor row ----19\node[vqblue, below left=1.15cm and -0.2cm of loop, minimum width=2.7cm] (fin)20 {\textbf{Financial tools}\\[1pt]\vqsmall 2 providers $\cdot$ 233 endpoints};21\node[vqblue, below=1.15cm of loop, minimum width=2.7cm] (py)22 {\textbf{Python sandbox}\\[1pt]\vqsmall 29 packages};23\node[vqblue, below right=1.15cm and -0.2cm of loop, minimum width=2.7cm] (web)24 {\textbf{Web research}\\[1pt]\vqsmall 3 services $\cdot$ 14 tools};2526% ---- External tier ----27\node[vqpurple, below=of fin, minimum width=2.7cm] (fmp)28 {\textbf{Market-data API}\\[1pt]\vqsmall live quotes, filings, macro};29\node[vqpurple, below=of py, minimum width=2.7cm] (quant)30 {\textbf{Numerical methods}\\[1pt]\vqsmall MC $\cdot$ BSM $\cdot$ GARCH $\cdot$ VaR; figures};31\node[vqpurple, below=of web, minimum width=2.7cm] (search)32 {\textbf{Scrape / search}\\[1pt]\vqsmall keyword $\cdot$ semantic};3334% ---- Document pipeline ----35\node[vqorange, below=1.1cm of quant, minimum width=8.6cm] (doc)36 {\textbf{Document pipeline} \;\vqsmall PDF $\cdot$ DOCX $\cdot$ Beamer slides $\cdot$ live-formula XLSX};3738% ---- Edges ----39\draw[vqdarr] (ui) -- node[right, vqsmall]{SSE stream} (orch);40\draw[vqarr] (orch) -- (loop);41\draw[vqdarr] (loop) -- (db);42\draw[vqdarr] (loop) -- node[left, vqsmall, pos=0.55]{call} (fin);43\draw[vqdarr] (loop) -- node[right, vqsmall, pos=0.55]{result} (py);44\draw[vqdarr] (loop) -- (web);45\draw[vqdarr] (fin) -- (fmp);46\draw[vqdarr] (py) -- (quant);47\draw[vqdarr] (web) -- (search);48\draw[vqarr] (quant) -- (doc);49% Export path routed along the right margin, clearing the Persistence box50\coordinate (far) at ([xshift=1.15cm]db.east);51\draw[vqflow] (doc.east) to[out=0,in=-90] (far)52 to[out=90,in=0] node[right, vqsmall, pos=0.5]{export} (ui.east);5354% ---- Tier bands (background) ----55\begin{scope}[on background layer]56 \node[vqband, fill=VQTeal!7, fit=(ui), inner sep=6pt] (bc) {};57 \node[vqband, fill=VQBlue!7, fit=(orch)(loop)(db)(fin)(web), inner sep=7pt] (bs) {};58 \node[vqband, fill=VQPurple!6, fit=(fmp)(search), inner sep=6pt] (be) {};59 \node[vqband, fill=VQOrange!8, fit=(doc), inner sep=6pt] (bd) {};60\end{scope}61\node[vqsmall, rotate=90, text=VQTeal!60!black] at ([xshift=-3pt]bc.west) {CLIENT};62\node[vqsmall, rotate=90, text=VQBlue!60!black] at ([xshift=-3pt]bs.west) {SERVER};63\node[vqsmall, rotate=90, text=VQPurple!55!black] at ([xshift=-3pt]be.west) {EXTERNAL};6465\end{tikzpicture}66\caption{\textbf{Layered system architecture.} The React \emph{client} streams over Server-Sent67Events. The \emph{server} runs the orchestration service and the recursive tool-calling loop,68which routes the model's calls---throttled to five per batch with a 500\,ms spacing---to three69executor families and persists every session. \emph{External} services supply live data,70deterministic numerical results, and web content. On request, the document pipeline renders the71final Markdown into four formats and the result is streamed back to the client. Double-headed72arrows carry a call and its result; the heavy teal arrow is the export path.}73\label{fig:architecture}74\end{figure}75