694 lines
40 KiB
TeX
694 lines
40 KiB
TeX
% !TEX encoding = UTF-8 Unicode
|
|
% ============================================================================
|
|
% AISE502 -- AI in Software Engineering II
|
|
% Project presentation (kickoff, week 1), typeset with the official FHGR beamer theme
|
|
% (beamerthemeFHGR.sty, University of Applied Sciences of the Grisons).
|
|
% Slide content is unchanged; only the presentation layer is the FHGR template.
|
|
% ============================================================================
|
|
\documentclass[aspectratio=169]{beamer}
|
|
|
|
\usetheme[showsection, titlebg=pics/theme_pics/titlepage.png]{FHGR}
|
|
|
|
% ============================================
|
|
% PACKAGES
|
|
% The theme already loads tikz, graphicx, xcolor, tabularx, colortbl,
|
|
% listings, hyperref, environ and xparse -- only the extras are needed here.
|
|
% ============================================
|
|
\usepackage[british]{babel}
|
|
\usepackage{booktabs}
|
|
\usepackage{amsmath}
|
|
\usepackage{amssymb}
|
|
\usepackage{tcolorbox}
|
|
\usetikzlibrary{shapes.geometric, arrows.meta, positioning, fit, backgrounds, calc}
|
|
|
|
% ============================================
|
|
% SEMANTIC COLOURS, MAPPED ONTO THE FHGR PALETTE
|
|
% The names used throughout the slides are kept, so no slide text changes;
|
|
% they now resolve to the FHGR brand colours defined by the theme.
|
|
% ============================================
|
|
\colorlet{bankblue}{blue} % FHGR blue (4B92A4)
|
|
\colorlet{bankgreen}{green} % FHGR green (817E65)
|
|
\colorlet{bankred}{red} % FHGR red (C60219)
|
|
\colorlet{codegray}{gray} % FHGR gray (595959)
|
|
\colorlet{backcolour}{linen} % FHGR linen (E1D3B5)
|
|
\definecolor{aiviolet}{HTML}{6B4E71} % muted plum, kept distinct for the AI lens
|
|
|
|
% Attribution labels in English (theme default is German)
|
|
\renewcommand{\source}[1]{\par\hfill {\tiny\color{FHGRDeco} Source:\,\itshape #1}}
|
|
\renewcommand{\imagesource}[1]{\par\hfill {\tiny\color{FHGRDeco} Image source:\,\itshape #1}}
|
|
|
|
% ============================================
|
|
% CUSTOM TCOLORBOXES (same semantics as the script, FHGR colours)
|
|
% ============================================
|
|
\newtcolorbox{keypoint}{
|
|
colback=bankblue!7!white,
|
|
colframe=bankblue,
|
|
title=Key Concept,
|
|
fonttitle=\bfseries\small,
|
|
boxrule=0.8pt,
|
|
arc=2pt,
|
|
top=2pt, bottom=2pt, left=4pt, right=4pt
|
|
}
|
|
|
|
\newtcolorbox{examplebox}[1][]{
|
|
colback=bankgreen!10!white,
|
|
colframe=bankgreen,
|
|
title={Example: #1},
|
|
fonttitle=\bfseries\small,
|
|
boxrule=0.8pt,
|
|
arc=2pt,
|
|
top=2pt, bottom=2pt, left=4pt, right=4pt
|
|
}
|
|
|
|
\newtcolorbox{definitionbox}[1][]{
|
|
colback=linen!40!white,
|
|
colframe=camel!85!black,
|
|
title={Definition: #1},
|
|
fonttitle=\bfseries\small,
|
|
boxrule=0.8pt,
|
|
arc=2pt,
|
|
top=2pt, bottom=2pt, left=4pt, right=4pt
|
|
}
|
|
|
|
\newtcolorbox{thinkbox}{
|
|
colback=lightGray!35!white,
|
|
colframe=darkGray,
|
|
title=Discussion,
|
|
fonttitle=\bfseries\small,
|
|
boxrule=0.8pt,
|
|
arc=2pt,
|
|
top=2pt, bottom=2pt, left=4pt, right=4pt
|
|
}
|
|
|
|
\newtcolorbox{hinweisbox}{
|
|
colback=bankred!5!white,
|
|
colframe=bankred,
|
|
title=Important Note,
|
|
fonttitle=\bfseries\small,
|
|
boxrule=0.8pt,
|
|
arc=2pt,
|
|
top=2pt, bottom=2pt, left=4pt, right=4pt
|
|
}
|
|
|
|
\newtcolorbox{ailinse}[1][]{
|
|
colback=aiviolet!7!white,
|
|
colframe=aiviolet,
|
|
title={AI Lens: #1},
|
|
fonttitle=\bfseries\small,
|
|
boxrule=0.8pt,
|
|
arc=2pt,
|
|
top=2pt, bottom=2pt, left=4pt, right=4pt
|
|
}
|
|
|
|
\newtcolorbox{projektbox}{
|
|
colback=bankblue!4!white,
|
|
colframe=bankblue!70!black,
|
|
title=Project Link: Portfolio Intelligence Platform,
|
|
fonttitle=\bfseries\small,
|
|
boxrule=0.8pt,
|
|
arc=2pt,
|
|
top=2pt, bottom=2pt, left=4pt, right=4pt
|
|
}
|
|
|
|
% ============================================
|
|
% TITLE METADATA
|
|
% ============================================
|
|
\title[AI in Software Engineering II]{AISE502: AI in Software Engineering II}
|
|
\subtitle{The Project: AI-Augmented Portfolio Intelligence Platform\\[0.4ex]{\small Exercise sheet \texttt{project\_exercise.pdf} -- this deck is the map, the sheet is the territory: read it in full}}
|
|
\author{Dr.\ Florian Herzog}
|
|
\shortname{AISE502}
|
|
\fullname{Fachhochschule Graub\"unden, Chur -- Autumn Semester 2026}
|
|
|
|
\begin{document}
|
|
|
|
% ============================================
|
|
% TITLE SLIDE
|
|
% ============================================
|
|
\FHGRTitlePage
|
|
|
|
% ============================================
|
|
% AGENDA
|
|
% ============================================
|
|
\begin{frame}{Agenda}
|
|
\begin{enumerate}
|
|
\item The project in one page: goal, the single most important rule, what the platform does
|
|
\item What the users will see: seven sketches -- wireframes, not a specification
|
|
\item Functional requirements: six areas, one boundary between deterministic and non-deterministic
|
|
\item Architecture: from the ontology to services, the reference architecture
|
|
\item AI integration: anti-corruption layer and LLM gateway, guards, evaluation harness, building with AI tools
|
|
\item Mandatory vs.\ distinction; semester plan, milestones, and assessment
|
|
\item This week: read the exercise sheet, kick off milestone M1
|
|
\end{enumerate}
|
|
\end{frame}
|
|
|
|
% ============================================
|
|
% SECTION 1: THE PROJECT IN ONE PAGE
|
|
% ============================================
|
|
\section{The Project in One Page}
|
|
|
|
\begin{frame}{Why this project}
|
|
\emph{\textcolor{bankblue}{How do you structure a system so that it meets its quality attributes and stays maintainable while one part of it -- the news understanding -- is non-deterministic, fallible, and costly?}}
|
|
|
|
\vspace{0.2cm}
|
|
\small
|
|
\begin{itemize}\setlength\itemsep{2pt}
|
|
\item The goal: design, build, and operate a \textbf{modular, AI-augmented analysis platform for stock portfolios}
|
|
\item It ingests \textbf{structured} external data (market prices) and \textbf{unstructured} external data (company news and web reports), turns both into decision-relevant information, computes quantitative \textbf{risk, performance, and optimisation} figures, and exposes the results through a small set of cooperating services driven by an \textbf{orchestrated multi-agent layer}
|
|
\item Whether those services ship as one modular monolith or as several deployables is \emph{not prescribed}: it is the architecture decision you take in week 6 with the lecture's three-stage match and defend in week 14
|
|
\item This is a \textbf{Software Engineering II} project: the centre of gravity is \emph{architecture}
|
|
\item AI appears in two roles: as a \textbf{tool} you build the system \emph{with} (Axis A), and as a \textbf{component} that lives \emph{inside} the system (Axis B)
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\begin{frame}{The single most important rule}
|
|
\begin{keypoint}
|
|
\small The AI agents may only \textbf{obtain and interpret} quantitative values \emph{through the deterministic services} -- they must \textbf{never compute} a risk number, a return, or an allocation themselves. An agent that ``estimates'' a volatility is an \textbf{architecture defect}. This separation of deterministic from non-deterministic system parts is the core engineering lesson of the course, \textbf{and it is graded}.
|
|
\end{keypoint}
|
|
|
|
\vspace{0.25cm}
|
|
\textbf{Why build this?}
|
|
\small
|
|
\begin{itemize}\setlength\itemsep{2pt}
|
|
\item The project forces the full architecture-and-engineering arc: derive a service architecture from a domain ontology, design contracts between services, harden the system against unreliable external data, integrate non-deterministic AI behind stable interfaces, and evaluate, observe, and scale it
|
|
\item You will \emph{experience} first-hand why non-deterministic components demand discipline
|
|
\item You will use modern agentic development tools to build it -- while keeping a critical eye on what they produce
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\begin{frame}{What the platform does}
|
|
\begin{enumerate}\setlength\itemsep{3pt}
|
|
\item Ingest \textbf{market prices} from a live API (e.g.\ Yahoo Finance) with a \textbf{mandatory cache/snapshot fallback}
|
|
\item Ingest \textbf{company news / web reports} (unstructured text)
|
|
\item Use an \textbf{AI component} to turn news into structured insights (sentiment, affected tickers, event type) -- \textbf{validated against a domain ontology}
|
|
\item Compute \textbf{risk, performance, and optimisation} figures in deterministic services (formulae and test vectors are provided to you)
|
|
\item Provide an \textbf{orchestrated multi-agent advisor} that combines the above into portfolio insights and explanations
|
|
\item Expose everything \textbf{API-first}, with a thin dashboard (e.g.\ Streamlit) only for demonstration
|
|
\end{enumerate}
|
|
|
|
\vspace{0.2cm}
|
|
\textcolor{codegray}{\small Analysis and advisory only -- no trading, no real money. Language: Python 3.11+. Architecture-first.}
|
|
\end{frame}
|
|
|
|
% ============================================
|
|
% SECTION 2: WHAT THE USERS WILL SEE
|
|
% ============================================
|
|
\section{What the Users Will See}
|
|
|
|
\begin{frame}{Seven sketches -- wireframes, not a specification}
|
|
\small
|
|
The next frames show \textbf{low-fidelity sketches} of the platform from the user's side. They illustrate the requirements of the exercise sheet; they are \emph{not} a design you must copy.
|
|
\begin{itemize}\setlength\itemsep{2pt}
|
|
\item The dashboard is a \textbf{thin UI for demonstration}: it calls the HTTP/JSON API and contains \textbf{no business logic} (sheet, Section 2.6)
|
|
\item Every figure on a screen names the \textbf{deterministic service} that computed it; every AI statement names its \textbf{source and its guard verdict}
|
|
\item Each sketch carries numbered sticky notes that cite the section of the exercise sheet the element comes from
|
|
\item The screen set -- portfolio, market data, news and insights, advisor, optimisation, system status -- follows the six functional requirement areas
|
|
\end{itemize}
|
|
|
|
\vspace{0.15cm}
|
|
\begin{hinweisbox}
|
|
\footnotesize The sketches are Section 8 of the exercise sheet and, as HTML pages, in the course repository (\texttt{project\_exercise/ui\_sketches/}) -- open them in a browser; your own screens may look entirely different, as long as the requirements behind the notes are met.
|
|
\end{hinweisbox}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Three users, one system -- and one working day}
|
|
\begin{columns}[T]
|
|
\begin{column}{0.64\textwidth}
|
|
\includegraphics[width=\linewidth]{../project_exercise/ui_sketches/00_user_journey.png}
|
|
\end{column}
|
|
\begin{column}{0.35\textwidth}
|
|
\footnotesize
|
|
\begin{itemize}\setlength\itemsep{3pt}
|
|
\item \textbf{Analyst}: trusts the numbers, checks the explanations
|
|
\item \textbf{Compliance reviewer}: every claim traceable to news item, model, prompt version, computing service
|
|
\item \textbf{Developer/operator}: you -- budgets, breakers, eval gate
|
|
\item Steps 1, 2, 5 are deterministic and survive an LLM outage; 3 and 4 pause \emph{visibly}
|
|
\end{itemize}
|
|
\end{column}
|
|
\end{columns}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Sketch 1 -- portfolio overview}
|
|
\begin{columns}[T]
|
|
\begin{column}{0.64\textwidth}
|
|
\includegraphics[width=\linewidth]{../project_exercise/ui_sketches/01_portfolio_dashboard.png}
|
|
\end{column}
|
|
\begin{column}{0.35\textwidth}
|
|
\footnotesize
|
|
\begin{itemize}\setlength\itemsep{3pt}
|
|
\item Positions from \texttt{PortfolioService}; return and Sharpe from \texttt{PerformanceService}; volatility and VaR from \texttt{RiskService} (Sections 2.3, 2.4)
|
|
\item \textbf{Graceful degradation}: the LLM circuit is open -- insights and advisor paused, figures unaffected, and the UI says so (Section 4.2)
|
|
\item Freshness stamp: analysis as of the last completed ingestion
|
|
\end{itemize}
|
|
\end{column}
|
|
\end{columns}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Sketch 2 -- market data}
|
|
\begin{columns}[T]
|
|
\begin{column}{0.64\textwidth}
|
|
\includegraphics[width=\linewidth]{../project_exercise/ui_sketches/02_market_data.png}
|
|
\end{column}
|
|
\begin{column}{0.35\textwidth}
|
|
\footnotesize
|
|
\begin{itemize}\setlength\itemsep{3pt}
|
|
\item Configurable tickers, historical and recent prices; the live API is rate-limited, so the \textbf{mandatory cache/snapshot fallback} takes over and every figure is marked \emph{snapshot} (Section 2.1)
|
|
\item \texttt{MarketDataService}: a stable, versioned contract independent of the provider's format
|
|
\item Timeout, retry with backoff, circuit breaker, defined fallback -- on \emph{every} external call (Section 4.2)
|
|
\end{itemize}
|
|
\end{column}
|
|
\end{columns}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Sketch 3 -- news and insights}
|
|
\begin{columns}[T]
|
|
\begin{column}{0.64\textwidth}
|
|
\includegraphics[width=\linewidth]{../project_exercise/ui_sketches/03_news_insights.png}
|
|
\end{column}
|
|
\begin{column}{0.35\textwidth}
|
|
\footnotesize
|
|
\begin{itemize}\setlength\itemsep{3pt}
|
|
\item Raw news stored with provenance by \texttt{NewsIngestionService}; the \texttt{ResearchAgent} returns a strict, schema-validated \texttt{Insight} (Section 2.2)
|
|
\item The \textbf{ontology guard}: valid ticker, sector, event type? N-1017 is rejected, its raw text kept for audit
|
|
\item The rest of the system never sees raw model text (anti-corruption layer, Section 4.1); news text is untrusted input
|
|
\end{itemize}
|
|
\end{column}
|
|
\end{columns}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Sketch 4 -- the advisor}
|
|
\begin{columns}[T]
|
|
\begin{column}{0.64\textwidth}
|
|
\includegraphics[width=\linewidth]{../project_exercise/ui_sketches/04_advisor.png}
|
|
\end{column}
|
|
\begin{column}{0.35\textwidth}
|
|
\footnotesize
|
|
\begin{itemize}\setlength\itemsep{3pt}
|
|
\item \texttt{AdvisorAgent} orchestrates \texttt{ResearchAgent}, \texttt{RiskAgent}, \texttt{OptimizationAgent} through \textbf{service contracts only} (Section 2.5)
|
|
\item The answer is \textbf{explained and cited}: evidence from validated insights, numbers from the deterministic services, a proposal from \texttt{OptimizationService}, caveats
|
|
\item Cost and latency per request from the \textbf{LLM gateway}, against the budgets of your measurement contract
|
|
\end{itemize}
|
|
\end{column}
|
|
\end{columns}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Sketch 5 -- risk and optimisation}
|
|
\begin{columns}[T]
|
|
\begin{column}{0.64\textwidth}
|
|
\includegraphics[width=\linewidth]{../project_exercise/ui_sketches/05_optimisation.png}
|
|
\end{column}
|
|
\begin{column}{0.35\textwidth}
|
|
\footnotesize
|
|
\begin{itemize}\setlength\itemsep{3pt}
|
|
\item Mean--variance optimisation with constraints; the three analysis services are \textbf{pure and deterministic}: same input, same output (Section 2.3)
|
|
\item Pinned by \textbf{exact tests against the provided reference vectors} (Section 4.3)
|
|
\item The \texttt{OptimizationAgent} \emph{explains} the proposal; no number originates in the agent
|
|
\end{itemize}
|
|
\end{column}
|
|
\end{columns}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Sketch 6 -- system status: the measurement contract, live}
|
|
\begin{columns}[T]
|
|
\begin{column}{0.64\textwidth}
|
|
\includegraphics[width=\linewidth]{../project_exercise/ui_sketches/06_system_status.png}
|
|
\end{column}
|
|
\begin{column}{0.35\textwidth}
|
|
\footnotesize
|
|
\begin{itemize}\setlength\itemsep{3pt}
|
|
\item \textbf{Basic observability} of cost and latency per request is mandatory (Section 5); budgets, eval threshold, and module-boundary check are \textbf{CI gates} (M2, M5)
|
|
\item Circuit breakers on every external call; degraded mode announced in the UI
|
|
\item Eval harness reports accuracy and failure modes (Section 4.3); a failed gate rolls the prompt change back
|
|
\end{itemize}
|
|
\end{column}
|
|
\end{columns}
|
|
\end{frame}
|
|
|
|
% ============================================
|
|
% SECTION 3: FUNCTIONAL REQUIREMENTS
|
|
% ============================================
|
|
\section{Functional Requirements}
|
|
|
|
\begin{frame}{Six requirement areas -- and the boundary that runs through them}
|
|
\scriptsize
|
|
\renewcommand{\arraystretch}{0.85}
|
|
\vspace{-0.2cm}
|
|
\begin{center}
|
|
\begin{tabular}{@{}p{2.6cm}p{2.0cm}p{8.5cm}@{}}
|
|
\toprule
|
|
\textbf{Area (Section 2)} & \textbf{Nature} & \textbf{Services and responsibilities} \\
|
|
\midrule
|
|
2.1 Market data & deterministic & \texttt{MarketDataService}: retrieval, caching, normalisation of price series; live API with a \textbf{mandatory} cache/snapshot fallback; stable contract independent of the provider's format \\
|
|
2.2 News ingestion \& AI insight extraction & \textbf{non-deterministic} & \texttt{NewsIngestionService}: fetch and store raw news with provenance. \texttt{ResearchAgent}: LLM-based extraction returning a strict, schema-validated \texttt{Insight} -- an \textbf{anti-corruption layer}; every insight validated against the ontology \\
|
|
2.3 Quantitative analysis & deterministic & \texttt{PerformanceService} (returns, cumulative return, Sharpe), \texttt{RiskService} (volatility, Value-at-Risk), \texttt{OptimizationService} (mean--variance); \textbf{pure}: same input $\to$ same output; formulae and reference test vectors provided \\
|
|
2.4 Portfolio state & deterministic & \texttt{PortfolioService}: holdings, positions, transactions (in-memory or simple persistence suffices) \\
|
|
2.5 Multi-agent advisor & \textbf{non-deterministic} & \texttt{AdvisorAgent} (orchestrator), \texttt{ResearchAgent}, \texttt{RiskAgent} (calls \texttt{RiskService}), \texttt{OptimizationAgent} (calls \texttt{OptimizationService}); sub-agents communicate only through service contracts \\
|
|
2.6 Interface & -- & clean HTTP/JSON API as the primary product surface; thin dashboard (e.g.\ Streamlit) with \textbf{no business logic} \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
\end{center}
|
|
\vspace{0.05cm}
|
|
\footnotesize The exact class and module decomposition is part of \emph{your} architectural work -- the service names are guidance, not a prescription.
|
|
\end{frame}
|
|
|
|
\begin{frame}{Agents interpret and explain; services compute}
|
|
\small
|
|
\begin{columns}[T]
|
|
\begin{column}{0.5\textwidth}
|
|
\textcolor{bankblue}{\textbf{The multi-agent advisor (Section 2.5)}}
|
|
\begin{itemize}\setlength\itemsep{2pt}
|
|
\item an \texttt{AdvisorAgent} orchestrates specialised sub-agents to answer portfolio questions and produce \textbf{explained recommendations}
|
|
\item sub-agents communicate \textbf{only through service contracts}, never by sharing internal state
|
|
\item \texttt{RiskAgent} calls \texttt{RiskService} and interprets; \texttt{OptimizationAgent} calls \texttt{OptimizationService} and explains
|
|
\end{itemize}
|
|
\end{column}
|
|
\begin{column}{0.47\textwidth}
|
|
\textcolor{bankblue}{\textbf{Two vocabularies, one design}}
|
|
\begin{itemize}\setlength\itemsep{2pt}
|
|
\item the lecture script's worked example (Part V, Section 44.1) names the same roles: \emph{document analyst} $\approx$ \texttt{ResearchAgent}, \emph{portfolio quant} $\approx$ \texttt{RiskAgent}\,/\,\texttt{OptimizationAgent}, \emph{compliance checker} $\approx$ the ontology guard
|
|
\item mandatory part: \textbf{2--3 specialised sub-agents} behind the advisor (Section 5)
|
|
\end{itemize}
|
|
\end{column}
|
|
\end{columns}
|
|
|
|
\vspace{0.2cm}
|
|
\begin{keypoint}
|
|
\footnotesize \textbf{Agents interpret and explain numbers; services compute them.} The deterministic services are the ones your tests pin down exactly -- and the ones your AI is evaluated against.
|
|
\end{keypoint}
|
|
\end{frame}
|
|
|
|
% ============================================
|
|
% SECTION 4: ARCHITECTURE
|
|
% ============================================
|
|
\section{Architecture: From Ontology to Services}
|
|
|
|
\begin{frame}{The derivation chain}
|
|
\small Before implementing, derive your architecture from the domain -- the \emph{traceability chain} you practised conceptually in AISE501, now built for real:
|
|
\vspace{0.2cm}
|
|
\begin{center}
|
|
\resizebox{\textwidth}{!}{%
|
|
\begin{tikzpicture}[
|
|
stp/.style={rectangle, draw=bankblue, fill=bankblue!15, rounded corners=4pt, align=center, font=\small\sffamily, minimum height=1.0cm, inner sep=5pt},
|
|
aistp/.style={stp, draw=aiviolet, fill=aiviolet!15},
|
|
arr/.style={-{Stealth[length=2.5mm]}, thick, gray!60!black}
|
|
]
|
|
\node[stp] (a) {Domain\\understanding};
|
|
\node[stp, right=0.45cm of a] (b) {Domain\\model};
|
|
\node[stp, right=0.45cm of b, fill=camel!30, draw=camel!80!black] (c) {\textbf{Ontology}\\asset classes, sectors, rules};
|
|
\node[stp, right=0.45cm of c] (d) {\textbf{Bounded}\\\textbf{contexts}};
|
|
\node[stp, right=0.45cm of d] (e) {Services\\with contracts};
|
|
\node[aistp, right=0.45cm of e] (f) {AI agents behind\\anti-corruption layers};
|
|
\node[stp, right=0.45cm of f, fill=bankgreen!15, draw=bankgreen] (g) {Evaluation,\\observability,\\hardening};
|
|
\draw[arr] (a) -- (b); \draw[arr] (b) -- (c); \draw[arr] (c) -- (d); \draw[arr] (d) -- (e); \draw[arr] (e) -- (f); \draw[arr] (f) -- (g);
|
|
\end{tikzpicture}}
|
|
\end{center}
|
|
\vspace{0.2cm}
|
|
\begin{itemize}\setlength\itemsep{2pt}
|
|
\item \textbf{Ontology as a contract (build time):} it defines the bounded contexts and drives the service boundaries and data models
|
|
\item \textbf{Ontology as a guard (run time):} every AI-produced insight is validated against it before it is allowed into the system -- suppressing hallucinated tickers, sectors, or impossible events
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Reference architecture -- a logical split into services with contracts}
|
|
\begin{center}
|
|
\resizebox{!}{6.35cm}{%
|
|
\begin{tikzpicture}[
|
|
layer/.style={rectangle, draw=gray!60!black, rounded corners=5pt, minimum width=12.4cm, inner sep=0pt},
|
|
ltitle/.style={anchor=west, font=\scriptsize\sffamily\bfseries},
|
|
box/.style={rectangle, draw=bankgreen, fill=white, rounded corners=3pt, font=\scriptsize\sffamily, align=center, minimum width=3.8cm, minimum height=0.6cm, inner sep=2pt},
|
|
abox/.style={box, draw=aiviolet, minimum width=3.6cm},
|
|
arr/.style={-{Stealth[length=2mm]}, line width=0.8pt, gray!60!black},
|
|
lbl/.style={font=\scriptsize\sffamily, text=gray!60!black, anchor=west}
|
|
]
|
|
% UI layer
|
|
\node[layer, fill=gray!12, minimum height=0.5cm] (ui) at (0,0) {};
|
|
\node[font=\scriptsize\sffamily] at (0,0) {\textbf{Thin dashboard (e.g.\ Streamlit)} -- API-first, no business logic};
|
|
\draw[arr] (0,-0.25) -- (0,-0.65);
|
|
\node[lbl] at (0.15,-0.45) {stable HTTP/JSON API};
|
|
% Multi-agent layer
|
|
\node[layer, fill=aiviolet!8, minimum height=2.65cm] (ai) at (0,-1.975) {};
|
|
\node[ltitle, text=aiviolet] at (-6.05,-0.87) {Multi-agent layer -- non-deterministic};
|
|
\node[abox, minimum width=2.9cm, minimum height=0.75cm] (adv) at (-4.5,-2.15) {\textbf{AdvisorAgent}\\(orchestrator)};
|
|
\node[abox] (res) at (-0.2,-1.45) {\textbf{ResearchAgent}\\news $\to$ Insight};
|
|
\node[abox] (risk) at (-0.2,-2.15) {\textbf{RiskAgent}\\calls RiskService};
|
|
\node[abox] (opt) at (-0.2,-2.85) {\textbf{OptimizationAgent}\\calls OptimizationService};
|
|
\draw[line width=0.8pt, gray!60!black] (adv.east) -- (-2.6,-2.15);
|
|
\draw[line width=0.8pt, gray!60!black] (-2.6,-1.45) -- (-2.6,-2.85);
|
|
\draw[arr] (-2.6,-1.45) -- (res.west);
|
|
\draw[arr] (-2.6,-2.15) -- (risk.west);
|
|
\draw[arr] (-2.6,-2.85) -- (opt.west);
|
|
\node[abox, fill=aiviolet!15, minimum width=2.9cm, text width=2.7cm, minimum height=1.9cm] (gw) at (4.55,-2.15) {\textbf{LLM gateway}\\one port for every model call\\cost and latency per request\\fallback chain};
|
|
\draw[arr, dashed] (res.east) -- (gw.west |- res.east);
|
|
\draw[arr, dashed] (risk.east) -- (gw.west |- risk.east);
|
|
\draw[arr, dashed] (opt.east) -- (gw.west |- opt.east);
|
|
\draw[arr] (0,-3.3) -- (0,-3.7);
|
|
\node[lbl] at (0.15,-3.5) {reads the core only through its contracts};
|
|
% Deterministic layer
|
|
\node[layer, fill=bankgreen!8, minimum height=2.05cm] (det) at (0,-4.725) {};
|
|
\node[ltitle, text=bankgreen!70!black] at (-6.05,-3.92) {Deterministic services -- no LLM inside};
|
|
\node[box] at (-4.1,-4.45) {\textbf{MarketDataService}\\live API $+$ cache fallback};
|
|
\node[box] at (0,-4.45) {\textbf{NewsIngestionService}\\raw news $+$ provenance};
|
|
\node[box] at (4.1,-4.45) {\textbf{PerformanceService}\\returns, Sharpe ratio};
|
|
\node[box] at (-4.1,-5.2) {\textbf{RiskService}\\volatility, Value-at-Risk};
|
|
\node[box] at (0,-5.2) {\textbf{OptimizationService}\\mean--variance (Markowitz)};
|
|
\node[box] at (4.1,-5.2) {\textbf{PortfolioService}\\holdings, positions};
|
|
% Ontology layer
|
|
\node[layer, fill=camel!25, minimum height=0.5cm] at (0,-6.2) {};
|
|
\node[font=\scriptsize\sffamily] at (0,-6.2) {\textbf{Domain ontology} $=$ architecture contract $+$ guard rail};
|
|
\end{tikzpicture}}
|
|
\end{center}
|
|
\vspace{-0.15cm}
|
|
\footnotesize The deployment cut -- one modular monolith, several deployables, or a hybrid -- is the outcome of your match (week 6), not part of this picture.
|
|
\end{frame}
|
|
|
|
% ============================================
|
|
% SECTION 5: AI INTEGRATION
|
|
% ============================================
|
|
\section{AI Integration: Contracts, Guards, Evaluation}
|
|
|
|
\begin{frame}{Anti-corruption layer and the LLM gateway (Section 4.1)}
|
|
\small
|
|
\begin{itemize}\setlength\itemsep{3pt}
|
|
\item The LLM's \emph{extraction} is reached only through the \texttt{ResearchAgent}, which returns a strictly \textbf{schema-validated \texttt{Insight}}. No other code touches raw model output
|
|
\item Use structured output / schema validation; \textbf{reject or repair} non-conforming responses
|
|
\item Keep system prompts concise; separate persona, task, and data (AISE501)
|
|
\item \textbf{One LLM gateway}: every model call -- the extraction as well as the advisor's and sub-agents' calls -- goes through a single gateway behind a \textbf{port owned by the domain} (the lecture's ADR-011). Domain code never imports a provider SDK; the gateway records tokens, cost, and latency per request and holds the fallback chain
|
|
\item Every \texttt{Insight} carries a \textbf{provenance reference} to the stored news item, so that the advisor's answers can cite their sources
|
|
\end{itemize}
|
|
\vspace{0.15cm}
|
|
\begin{ailinse}[Axis B]
|
|
\footnotesize The gateway is the single \textbf{measurement point} of the AI component: what you cannot measure there, you cannot budget, gate, or defend.
|
|
\end{ailinse}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Guards against hallucination and failure (Section 4.2)}
|
|
\small
|
|
\begin{itemize}\setlength\itemsep{3pt}
|
|
\item Validate \textbf{every} insight against the ontology: valid ticker? valid sector? valid event type?
|
|
\item Apply resilience patterns to \textbf{every external call} (market API, news API, LLM API): \textbf{timeout}, \textbf{retry with backoff}, \textbf{circuit breaker}, and a \textbf{defined fallback}
|
|
\item The system must \textbf{degrade gracefully}: if the LLM or a data API is down, deterministic analysis must still work -- \emph{and the UI must say so}
|
|
\end{itemize}
|
|
\vspace{0.2cm}
|
|
\begin{hinweisbox}
|
|
\footnotesize \textbf{Common mistakes and pitfalls} (Section 4):
|
|
\begin{itemize}\setlength\itemsep{1pt}
|
|
\item \textbf{Never} let an agent compute or invent a numeric figure -- always route through the deterministic service
|
|
\item \textbf{Never} pass an unvalidated LLM response further into the system
|
|
\item Do not call external APIs without a timeout and a fallback -- they \emph{will} fail during your demo
|
|
\item Do not put business logic in the UI; it belongs in services
|
|
\item Treat news text as \textbf{untrusted input}: it is a prompt-injection vector
|
|
\item Never hardcode API keys -- environment variables / a \texttt{.env} file excluded from version control
|
|
\end{itemize}
|
|
\end{hinweisbox}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Evaluation harness (Section 4.3, mandatory)}
|
|
\small
|
|
\begin{itemize}\setlength\itemsep{3pt}
|
|
\item \textbf{Deterministic services}: pin them with \textbf{exact tests} against the provided reference test vectors
|
|
\item \textbf{Non-deterministic AI}: build an eval harness -- e.g.\ a small labelled set of news items with expected sentiment/tickers, plus regression checks against ontology axioms. Report \textbf{accuracy and failure modes}, not just ``it works''
|
|
\item In the implementation phase the harness becomes a \textbf{CI gate} (M5, week 13): every prompt or model change must clear the eval threshold of your measurement contract
|
|
\end{itemize}
|
|
\vspace{0.2cm}
|
|
\begin{keypoint}
|
|
\footnotesize The deterministic services are the ones your tests pin down exactly -- and the ones your AI is evaluated against.
|
|
\end{keypoint}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Building with AI tools (Section 4.4, Axis A)}
|
|
\small
|
|
\begin{itemize}\setlength\itemsep{2pt}
|
|
\item the repository carries an agent instruction file (\texttt{AGENTS.md} / \texttt{CLAUDE.md}) stating the architecture rules an agent must respect -- kept as current as code
|
|
\item every architecture decision is an ADR: agents may draft it, a \textbf{named team member signs} it
|
|
\item agent-generated changes reach the main branch \textbf{only through the CI gate}: module-boundary checks, the test suite, and -- for anything touching prompts or the gateway -- the eval harness
|
|
\item the project handbook contains a \textbf{one-page AI policy}: permitted tools, provenance labelling of generated code, review rules
|
|
\end{itemize}
|
|
\vspace{0.1cm}
|
|
\begin{keypoint}
|
|
\footnotesize The graded artefact is not the generated code but the \textbf{control system around it} -- and the M6 reflection on where AI helped and hurt \emph{in building} draws on exactly this.
|
|
\end{keypoint}
|
|
\end{frame}
|
|
|
|
% ============================================
|
|
% SECTION 6: MANDATORY, PLAN, ASSESSMENT
|
|
% ============================================
|
|
\section{Mandatory vs.\ Distinction, Semester Plan, Assessment}
|
|
|
|
\begin{frame}{Mandatory vs.\ distinction (Pflicht / K\"ur, Section 5)}
|
|
\vspace{-0.1cm}
|
|
\begin{columns}[T]
|
|
\begin{column}{0.5\textwidth}
|
|
\begin{block}{Mandatory -- required to pass}
|
|
\footnotesize
|
|
\begin{itemize}\setlength\itemsep{0pt}
|
|
\item Architecture derived from the ontology; \textbf{ADRs} and a \textbf{C4-style diagram}
|
|
\item Deterministic services with full, \textbf{exact tests} against the reference vectors
|
|
\item Orchestrated advisor with \textbf{2--3 specialised sub-agents}, contracts only
|
|
\item \textbf{Ontology guard} on all AI insights; resilience against external-data outages
|
|
\item Evaluation harness for the AI component; basic observability (cost, latency) through the single LLM gateway
|
|
\item The A2 \textbf{measurement contract} (module-boundary check, eval threshold, token-cost budget) wired into CI
|
|
\end{itemize}
|
|
\end{block}
|
|
\end{column}
|
|
\begin{column}{0.47\textwidth}
|
|
\begin{block}{Distinction -- for top grades}
|
|
\footnotesize
|
|
\begin{itemize}\setlength\itemsep{0pt}
|
|
\item \textbf{Autonomous planning}: the advisor decides itself which sub-agents/tools to call rather than following a fixed pipeline
|
|
\item \textbf{Self-repair loops}: e.g.\ ``news contradictory $\to$ fetch more sources'' before answering
|
|
\item \textbf{Model routing}: a small/cheap model for sentiment, a larger one for synthesis, with cost/latency reported
|
|
\item Deployment with CI/CD and richer observability (tracing)
|
|
\end{itemize}
|
|
\end{block}
|
|
\end{column}
|
|
\end{columns}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Two phases, fourteen weeks (Section 6)}
|
|
\footnotesize \textbf{Weeks 1--7, design phase}: the weekly two-lesson exercise slot produces the requirements, studies candidate architectures against the patterns of the lecture, and decides and documents your architecture. \textbf{Weeks 8--14, implementation phase}: one lesson standup/coaching; implementation mainly in self-study.
|
|
\vspace{0.1cm}
|
|
\scriptsize
|
|
\renewcommand{\arraystretch}{0.88}
|
|
\begin{center}
|
|
\begin{tabular}{@{}p{0.7cm}p{5.6cm}p{6.6cm}@{}}
|
|
\toprule
|
|
\textbf{Wk} & \textbf{Lecture (script)} & \textbf{Project work} \\
|
|
\midrule
|
|
1 & Part I: decision problem, framework & Kickoff: teams, tooling, domain model, ontology draft \\
|
|
2 & Part I: twelve dimensions; scenarios, utility tree & Quality attribute scenarios with response measures \\
|
|
3 & Part I: capability profiles, fit, mini-match, ADR & $R(\mathrm{platform})$ finalised $\to$ \textbf{Deliverable A1} \\
|
|
4 & Part II: layered, modular monolith, hexagonal & Architecture study I (Fineract, Cosmic Python) \\
|
|
5 & Part II: microservices, event-driven & Architecture study II: edges, contracts, resilience \\
|
|
6 & Part II: PF, SL; stepping back; class C10 & The match: three stages, decision, ADR draft \\
|
|
7 & Part IV: three cases, procedure, matrix; measurement contract & Solution design, design-review gate $\to$ \textbf{Deliverable A2} \\
|
|
8 & Part III: classes C1--C5 & Walking skeleton (start) \\
|
|
9 & Part III: classes C6--C9 & \textbf{Walking skeleton runs end-to-end} \\
|
|
10 & Part IV: hybrids, evolution, eight-step procedure & Deterministic services $+$ exact tests \\
|
|
11 & Part IV: measurement contract in depth & Resilience complete; \textbf{core fully tested} \\
|
|
12 & Part V: Axis A; Axis B (gateway, eval basics) & Advisor $+$ sub-agents behind the gateway \\
|
|
13 & Part V: Axis B (security, orchestration economics) & \textbf{Eval harness in CI}; hardening; distinction work \\
|
|
14 & Synthesis (1 lesson) & \textbf{Presentations, architecture defence, peer reviews} (A3) \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
\end{center}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Milestones and deliverables (1/2): the design phase}
|
|
\scriptsize
|
|
\renewcommand{\arraystretch}{0.9}
|
|
\begin{center}
|
|
\begin{tabular}{@{}p{2.9cm}p{1.0cm}p{5.9cm}p{2.9cm}@{}}
|
|
\toprule
|
|
\textbf{Milestone} & \textbf{Weeks} & \textbf{Content} & \textbf{Deliverable / check} \\
|
|
\midrule
|
|
M1 Requirements and ontology & 1--3 & domain model and ontology; quality attribute scenarios with response measures ($\geq 8$, $\geq 3$ for the AI components); utility tree; $R(\mathrm{platform})$ with weights, workload shape, hard constraints; repository, environment, agentic dev tools & \textbf{A1: requirements dossier} (end of week 3) \\
|
|
M2 Architecture decision and solution design & 4--7 & study the open-source reference systems; three-stage match; ADR with rationale; C4-style diagram; bounded contexts $\to$ services and contracts; measurement contract with numbers; walking-skeleton plan & \textbf{A2: architecture dossier $+$ design-review gate} (end of week 7); production code only after the gate \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
\end{center}
|
|
\vspace{0.15cm}
|
|
\footnotesize All design deliverables use the methods of the lecture script: quality attribute scenarios with response measures, a utility tree, the requirements profile $R(a)$, the three-stage match, an ADR with rationale, and a measurement contract.
|
|
\end{frame}
|
|
|
|
\begin{frame}{Milestones and deliverables (2/2): the implementation phase}
|
|
\scriptsize
|
|
\renewcommand{\arraystretch}{0.9}
|
|
\begin{center}
|
|
\begin{tabular}{@{}p{2.9cm}p{1.0cm}p{5.9cm}p{2.9cm}@{}}
|
|
\toprule
|
|
\textbf{Milestone} & \textbf{Weeks} & \textbf{Content} & \textbf{Deliverable / check} \\
|
|
\midrule
|
|
M3 Walking skeleton & 8--9 & end-to-end thin slice: \texttt{MarketDataService} delivers prices, a minimal \texttt{ResearchAgent} produces one validated \texttt{Insight}; stable API and placeholder UI & runs end-to-end (week 9) \\
|
|
M4 Deterministic core and resilience & 10--11 & \texttt{Performance}, \texttt{Risk}, \texttt{Optimization} services fully tested against the reference vectors; resilience on all external calls; graceful degradation verified & core fully tested $+$ resilient (week 11) \\
|
|
M5 Multi-agent orchestration, evaluation, hardening & 12--13 & advisor $+$ 2--3 sub-agents through contracts, all LLM calls via the gateway; ontology guard; eval harness as CI gate; cost/latency observability; threat model incl.\ prompt injection; topology ADR; optional distinction work & eval harness in CI $+$ guard $+$ cost observability (week 13) \\
|
|
M6 Presentation and architecture defence & 14 & present the system, defend the trade-offs, reflect on where AI helped and hurt (A and B); peer reviews; be ready to show one contract violation caught by CI & \textbf{A3: final presentation} \\
|
|
\bottomrule
|
|
\end{tabular}
|
|
\end{center}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Hints and tips (Section 6)}
|
|
\begin{itemize}\setlength\itemsep{3pt}
|
|
\item Build the \textbf{walking skeleton} first thing in the implementation phase (M3) -- a thin end-to-end slice de-risks everything that follows
|
|
\item Use the design phase fully: a decided architecture with contracts and a measurement contract makes the seven implementation weeks sufficient; an undecided one does not
|
|
\item Pin the deterministic services with tests \emph{before} you trust any agent output
|
|
\item Keep the deterministic core \textbf{free of LLM calls} -- this is the line that is graded
|
|
\item Use a \textbf{snapshot} of market/news data so your demo and grading are reproducible
|
|
\item Commit after each milestone; record decisions as ADRs as you go
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Assessment of the project (Section 7)}
|
|
\small The project counts \textbf{50\,\%} of the module grade.
|
|
\begin{itemize}\setlength\itemsep{3pt}
|
|
\item includes A1, A2, the implementation, and the final presentation with architecture defence
|
|
\item evaluation emphasises \textbf{architecture \& trade-offs} (quality of decomposition, contracts, deterministic/non-deterministic separation, ADRs), \textbf{robustness} (resilience, guards, graceful degradation), \textbf{quality} (tests for deterministic services, eval harness for AI), \textbf{AI integration} (correct anti-corruption layering and ontology guarding), and \textbf{operation} (observability of cost/latency)
|
|
\item distinction criteria for top marks: Section 5
|
|
\item the other 50\,\%: the written module examination (60 minutes, open book, closed internet)
|
|
\end{itemize}
|
|
\end{frame}
|
|
|
|
% ============================================
|
|
% SECTION 7: THIS WEEK
|
|
% ============================================
|
|
\section{This Week}
|
|
|
|
\begin{frame}{Read the document -- then kick off milestone M1}
|
|
\begin{projektbox}
|
|
\footnotesize \textbf{Read the exercise sheet in full before the kickoff}: \texttt{project\_exercise/project\_exercise.pdf} (sixteen pages). Suggested order: Section 1 (goal, the single most important rule) $\to$ 5 (mandatory vs.\ distinction) $\to$ 6 (plan, milestones) $\to$ 2--4 (requirements, architecture, AI integration) $\to$ 7 (assessment) $\to$ 8 (the sketches, also as HTML in \texttt{project\_exercise/ui\_sketches/}).
|
|
\end{projektbox}
|
|
|
|
\vspace{0.15cm}
|
|
\small
|
|
\textbf{This week's exercise (week 1, milestone M1 starts):}
|
|
\begin{itemize}\setlength\itemsep{2pt}
|
|
\item form teams; set up the repository, the environment, and the agentic development tools
|
|
\item build domain understanding; draft the domain model and a first \textbf{ontology} (asset classes, sectors, rules)
|
|
\item collect \emph{raw} stakeholder wishes -- next week they become quality attribute scenarios, in week 3 your requirements profile (deliverable A1)
|
|
\end{itemize}
|
|
|
|
\vspace{0.05cm}
|
|
\footnotesize\textcolor{codegray}{The exercise sheet is the normative document for what is graded; the lecture decks tell you when each method arrives -- and everything they teach you will apply to \emph{this} system and defend in week 14.}
|
|
\end{frame}
|
|
|
|
\begin{frame}{Summary}
|
|
\footnotesize
|
|
\begin{enumerate}\setlength\itemsep{3pt}
|
|
\item \textbf{One rule above all}: agents obtain and interpret numbers through the deterministic services and never compute them -- the separation is the core lesson, and it is graded
|
|
\item \textbf{Six requirement areas}: market data, news and AI insight extraction, quantitative analysis, portfolio state, multi-agent advisor, API-first interface -- with a boundary between deterministic and non-deterministic parts running through them
|
|
\item \textbf{Architecture from the ontology}: domain $\to$ ontology $\to$ bounded contexts $\to$ services with contracts $\to$ AI behind anti-corruption layers $\to$ evaluation, observability, hardening; the deployment cut is your week-6 decision
|
|
\item \textbf{AI integration}: schema-validated \texttt{Insight}s, one LLM gateway, ontology guard, resilience on every external call, graceful degradation, an eval harness that reports accuracy and failure modes -- and Axis-A rules for how you build
|
|
\item \textbf{The sketches} show what the users will see; the requirements behind their notes are what counts
|
|
\item \textbf{Fourteen weeks, six milestones, three deliverables}: A1 (week 3), A2 with the design-review gate (week 7), A3 with the architecture defence (week 14)
|
|
\end{enumerate}
|
|
\end{frame}
|
|
|
|
% ============================================
|
|
% END
|
|
% ============================================
|
|
\FHGRClosingPage[][{\color{white}\parbox{0.9\paperwidth}{\centering Thank you!\\[3ex]
|
|
{\normalsize\mdseries Dr.\ Florian Herzog\\[0.9ex]
|
|
Fachhochschule Graub\"unden, Chur\\[2.4ex]
|
|
{\small AISE502 -- AI in Software Engineering II}}}}]
|
|
|
|
\end{document}
|