<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Iman Samizadeh, Ph.D. on Medium]]></title>
        <description><![CDATA[Stories by Iman Samizadeh, Ph.D. on Medium]]></description>
        <link>https://medium.com/@iman.samizadeh?source=rss-ef18e5079d06------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JJBC3zMVT-bcy32t6XSSoA.png</url>
            <title>Stories by Iman Samizadeh, Ph.D. on Medium</title>
            <link>https://medium.com/@iman.samizadeh?source=rss-ef18e5079d06------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 08:42:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@iman.samizadeh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[One option chain, twelve equations: the mathematics inside Option Desk]]></title>
            <link>https://medium.com/@iman.samizadeh/one-option-chain-twelve-equations-the-mathematics-inside-option-desk-3ac80fd84d2c?source=rss-ef18e5079d06------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ac80fd84d2c</guid>
            <dc:creator><![CDATA[Iman Samizadeh, Ph.D.]]></dc:creator>
            <pubDate>Tue, 10 Nov 2026 16:08:15 GMT</pubDate>
            <atom:updated>2026-11-10T16:08:15.677Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wDJojr_QsLXRbTRm3Po4uA.png" /><figcaption>Cover composite. The background comes from an AI image model and shows no real place, firm or person.</figcaption></figure><p><em>From Black-Scholes-Merton to a block bootstrap, with every number produced by the engine on synthetic data</em></p><p>In September I wrote about <a href="https://medium.com/p/bd27350d80e5">Option Desk</a>, the options desk I built for an AI agent to drive, and covered its architecture and why its three probability models stay apart. This piece goes underneath. I take one option chain through every model the engine implements, in the order a desk uses them, from pricing a contract to backtesting a structure. Each step gets the formula as the code computes it, a plain explanation, and the number the engine returned. Where the engine disagreed with my intuition, I say so.</p><p><em>How to read this: each section opens in plain words, then gives the formula as an equation card, then the number the engine returned. Skip the cards and the story still holds. Every figure is synthetic, and nothing here is advice. The full disclaimer is at the end.</em></p><p>The code is public at <a href="https://github.com/Iman/agent-driven-options-desk-and-skills">github.com/Iman/agent-driven-options-desk-and-skills</a>. The engine is pure Python with no numerical library underneath, so each formula below maps to a few dozen readable lines.</p><h3>The chain we will follow</h3><p>Picture an imaginary market stall that sells insurance on a share price. Each contract pays out if the price ends above (a call) or below (a put) a chosen level, the strike, on one date. A chain is the full price list of every strike and both kinds, each with a buying and a selling quote.</p><p>Every figure in this article is synthetic. The chain is the repository’s own teaching sample, examples/chain-synth.json, and the price history used later is one I generated with a fixed random seed. None of it describes a real market.</p><p>The sample has spot S = 100, 30 calendar days to expiry (T = 30/365 = 0.0822 years, the engine’s ACT/365 convention), a risk-free rate r = 4% and a dividend yield q = 1%. It lists 31 strikes from 70 to 130 in steps of 2, calls and puts, 62 contracts. Implied volatility was authored as a smooth smile, σ(K) = 0.26 − 0.0015(K − 100) + 0.000035(K − 100)², so the at-the-money volatility is 26% and the downside is dearer than the upside. Open interest peaks at the 94 put and the 104 call, the two levels that dominate the positioning section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7bOVmOUGfCoM8LIzrq61iw.png" /><figcaption>Figure 1. The synthetic smile, the two 25-delta wings the engine selected, and the one standard deviation range it computed.</figcaption></figure><h3>Pricing a contract with carry</h3><p>A price model says what this insurance is worth today if the share wanders randomly with a given volatility. Black, Scholes and Merton gave the answer in 1973 [1, 2]. The engine uses the version with a continuous dividend yield, because a share that pays dividends drifts less than one that does not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4UYgwApW9Z-uNbVRo_9IhQ.png" /><figcaption>Card 1. The pricing formula as implemented in bs_price.</figcaption></figure><p>As text: C = S·e^(−qT)·N(d₁) − K·e^(−rT)·N(d₂) and P = K·e^(−rT)·N(−d₂) − S·e^(−qT)·N(−d₁), with d₁ = [ln(S/K) + (r − q + σ²/2)T] / (σ√T) and d₂ = d₁ − σ√T. Here N is the standard normal cumulative distribution, φ (used below) is its density, σ is volatility per 1.00 (so 26% is 0.26) and T is in years.</p><p>At the money, with σ = 0.26, the engine prices the call at 3.0916 and the put at 2.8455. Put-call parity requires C − P = S·e^(−qT) − K·e^(−rT), and both sides come out at 0.246069 to within 7 × 10⁻¹⁵. Deep out of the money the two terms nearly cancel and floating point can return −4 × 10⁻¹⁵, so the engine floors the price at zero before it reaches elasticity or an artifact.</p><h3>Inverting a quote</h3><p>The market quotes prices, and traders talk in volatilities. Implied volatility is the σ that makes the model reproduce the quote. Price rises with volatility, so there is at most one answer, and Newton’s method finds it quickly when the slope, vega, is healthy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2vK4w1Rg4HyFIdyECjUPoA.png" /><figcaption>Card 2. The solver and its identification test, from implied_vol, _accept and _pinned.</figcaption></figure><p>As text: σₙ₊₁ = σₙ − (V(σₙ) − V_mkt) / 𝒱(σₙ), starting at σ₀ = 0.30, with bisection on [0.001, 5] if Newton stalls. A root σ* is accepted only if |V(σ<em>) − V_mkt| &lt; ε, vega 𝒱(σ</em>) ≥ ε/Δσ, and the price moves out of the tolerance band one step Δσ either side: V(σ* + Δσ) &gt; V_mkt + ε and V(σ* − Δσ) &lt; V_mkt − ε, with ε = 10⁻⁶ and Δσ = 0.005.</p><p>The September article explained why the solver refuses rather than guesses. This is where the floor comes from. To tell apart two volatilities half a point apart at a price tolerance of 10⁻⁶, the price must move by more than 10⁻⁶ over 0.005 of volatility, so vega must exceed 10⁻⁶ / 0.005 = 2 × 10⁻⁴. The two-sided check exists because vega is a slope at one point and the price is convex in volatility far from the money, so a slope can clear the floor while the price stays flat for a long stretch below it.</p><p>On our chain all 62 quotes were inverted and none was refused. The largest gap from the authored volatility, 0.000026, is on the 70 put, whose quote of 0.0001895 moves only 0.0093 per unit of volatility, so rounding the quote to six decimals shows up in the fifth decimal of σ. That vega, the smallest on the chain, is still 47 times the floor.</p><h3>The Greek ladder, to third order</h3><p>A Greek measures how much the option’s value moves when one input moves. Delta responds to the share price, gamma to how fast delta itself changes, vega to volatility. A desk hedging a large book needs the higher rungs too, because a hedge set at 100 drifts as price, volatility and the calendar move together. The engine computes sixteen Greeks analytically from the same d₁ and d₂.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tTb_deVxf3__WVQg5UrfoA.png" /><figcaption>Card 3. Selected rungs of the ladder from all_greeks.</figcaption></figure><p>As text: Δ_call = e^(−qT)·N(d₁); Γ = e^(−qT)·φ(d₁) / (Sσ√T); 𝒱 = S·e^(−qT)·φ(d₁)·√T. Vanna = −e^(−qT)·φ(d₁)·d₂/σ and vomma = 𝒱·d₁·d₂/σ. Speed = −(Γ/S)·(d₁/(σ√T) + 1), zomma = Γ·(d₁d₂ − 1)/σ, ultima = −(𝒱/σ²)·[d₁d₂(1 − d₁d₂) + d₁² + d₂²]. Theta, charm, veta and color are reported as the change over one calendar day passing: X_day = −(1/365)·∂X/∂T.</p><p>For the at-the-money call the engine returns delta 0.5276, gamma 0.05334, vega 11.40 per 1.00 of volatility (0.114 per volatility point), theta −0.0534 per day, vanna 0.00641, vomma −0.0129, speed −0.00104, zomma −0.205, color +0.000895 per day and ultima −0.788. Dual gamma, the second derivative with respect to strike, also comes out at 0.05334, because it equals Γ·S²/K² and K = S here. In words, if the share rises by 1 this call gains about 0.53, that sensitivity itself grows by about 0.05, and each day that passes costs about 0.05.</p><p>Across strikes (Figure 2), gamma peaks at the money, vanna and speed change sign near it, and zomma is most negative there and positive in the shoulders, so a rise in volatility flattens the gamma peak and spreads it outwards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jmYt1fhZO3er3pv25XE60A.png" /><figcaption>Figure 2. Gamma, vanna, speed and zomma across strikes for a call priced at 26% volatility and 30 days.</figcaption></figure><p>An analytic Greek that disagrees with the price it claims to differentiate is worse than none, so each rung is differenced numerically against bs_price itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q93XN-5j_548t8_B0u0Oww.png" /><figcaption>Card 4. The finite-difference stencils and tolerances used by the engine’s test suite.</figcaption></figure><p>As text: f′ ≈ [f(x+h) − f(x−h)] / 2h; f″ ≈ [f(x+h) − 2f(x) + f(x−h)] / h²; f‴ ≈ [f(x+2h) − 2f(x+h) + 2f(x−h) − f(x−2h)] / 2h³; steps h_S = 10⁻⁴·S, h_σ = 10⁻⁴, h_T = 3 × 10⁻⁴; pass if the relative error is at most τ, with τ between 10⁻⁶ and 10⁻³ depending on the order.</p><p>I ran the same stencils over the 22 contracts in the ladder’s default ±10% band, 15 rungs each. The worst relative error was 2.0 × 10⁻⁴, for speed at the 100 call, where the third-difference stencil is the less accurate side. Delta agreed to 7 × 10⁻⁷. This check is what caught veta and color shipping with the wrong sign earlier in the project, with the right magnitude and nothing else to give them away.</p><h3>Where dealer hedging sits</h3><p>When the public buys options, a market maker usually sells them and hedges by trading the share. Gamma says how much that hedge must change as the price moves. Dealers who are net long gamma sell into rallies and buy dips, which tends to calm the market. Net short, they chase it. Gamma exposure, GEX, estimates that flow strike by strike.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qMzVTMqk1JDLLCKbT9h_QA.png" /><figcaption>Card 5. Exposure, flip and max pain from chain_exposure and max_pain.</figcaption></figure><p>As text: GEX_i = s_i·Γ_i·OI_i·M·S²·0.01, with s = +1 for calls, −1 for puts and contract multiplier M = 100. The cumulative profile is C_j = Σ_{K_i ≤ K_j} GEX_i, and the flip is the linear interpolation K_j + (0 − C_j)(K_{j+1} − K_j)/(C_{j+1} − C_j) at the zero crossing nearest spot. Max pain is the listed strike that minimises M·[Σ_calls OI_i·(K − K_i)⁺ + Σ_puts OI_i·(K_i − K)⁺].</p><p>The factor Γ·S·0.01 is the change in delta, in shares, for a 1% move. Multiplying by S again turns shares into currency. Take the 104 call: gamma 0.04897, open interest 4,100, so 0.04897 × 4,100 × 100 × 10⁰² × 0.01 = 2,007,922 per 1% move. That is the largest call bar, the call wall. The put wall is at 94, at −1,445,782.</p><p>Summed over all strikes the net is +913,489, which the engine labels “dampening”. The cumulative profile is −1,640,820 at 102 and +140,354 at 104, so the flip sits at 102 + 2 × 1,640,820 / 1,781,174 = 103.84. Max pain is 100, where open contracts would pay out least, 12,816,800 in total.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M7mtspcZ6GDHQznm1s5qjw.png" /><figcaption>Figure 3. Gamma exposure by strike and its running sum. The flip is where the running sum crosses zero.</figcaption></figure><p>The engine prints two assumptions with these numbers. The sign convention takes dealers as long the calls and short the puts, which is often wrong for a single name. And the running sum starts at the lowest listed strike, so the flip depends on how far the listing extends. On this chain, keeping only strikes 90 to 110 moves the flip to 103.76, and dropping everything below 94 moves it to 103.34, so I read the flip as a region rather than a level.</p><p>The engine also reduces the smile to the four numbers a volatility trader quotes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qkLmAzVzVe2Qe0OhHWBGoA.png" /><figcaption>Card 6. Smile metrics from smile_metrics.</figcaption></figure><p>As text: RR₂₅ = σ_P,25 − σ_C,25 and BF₂₅ = ½(σ_P,25 + σ_C,25) − σ_ATM, where each wing must have |Δ| within 0.10 of 0.25; the slope is the ordinary least-squares coefficient of σ on x = 100·(K/S − 1) across calls; the expected move is EM = S·σ_ATM·√(D/365).</p><p>The engine picked the 96 put (delta −0.272, IV 26.66%) and the 106 call (delta 0.231, IV 25.23%). Risk reversal is +1.43 volatility points, with the downside bid. The skew slope is exactly −0.0015 per 1% of strike, the authored linear coefficient, because on a strike grid symmetric about spot the quadratic term is orthogonal to the linear one. The butterfly is slightly negative, −0.00059, on a convex smile, because the wings chosen by delta sit four points below spot and six above, and on a falling smile their average lands under the at-the-money level. The expected move is 100 × 0.26 × √(30/365) = 7.45, giving the range 92.55 to 107.45.</p><h3>Building and ranking structures</h3><p>A structure combines several contracts into one bet. An iron condor sells a put and a call near the edges of the expected range and buys cheaper ones further out to cap the loss, so it earns a small premium if the price stays inside and loses a capped amount if it breaks out.</p><p>The builder takes the listed strikes nearest the band edges, 92 and 108, as the shorts, and sets the wings half a band width beyond, (107.45 − 92.55) × 0.5 / 2 = 3.73, which rounds to the 88 put and the 112 call. At the chain’s mid prices the condor collects 0.7376, can lose at most 3.2624, and breaks even at 91.26 and 108.74. Net, it is short vega (−6.45 per 1.00) and earns +0.0279 a day in theta.</p><p>Probabilities and expectations come from a lognormal settlement law at one at-the-money volatility, and because the payoff is piecewise linear both have closed forms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XsqERdDX3Y29_qCIU_n5YQ.png" /><figcaption>Card 7. Closed-form probability and expectation from probability_of_profit and tail_metrics.</figcaption></figure><p>As text: ln S_T ~ 𝒩(m, s²) with m = ln S + (μ − σ²/2)T, s = σ√T and μ = 0. The partial expectation is E[S_T·1{S_T &lt; x}] = e^(m + s²/2)·N((ln x − m − s²)/s). With P/L = a_k·S_T + b_k on each interval (x_k, x_{k+1}) between strikes and breakevens, E[P/L] = Σ_k (a_k·E[S_T·1{x_k &lt; S_T &lt; x_{k+1}}] + b_k·P(x_k &lt; S_T &lt; x_{k+1})).</p><p>For the condor this gives a probability of profit of 0.760, an expected P/L of +0.0026 and a mean loss, given a loss, of −2.26. The friction model charges half of each leg’s half-spread on entry and again on exit, 0.0439 for the round trip or 5.9% of the premium, which the engine grades “ok” against a 10% threshold.</p><p>The comparison ranks 12 of the 15 single-expiry structures by expected P/L per unit of capital at risk. It excludes two butterflies whose round trip exceeds 25% of their premium and a ratio spread whose loss is unbounded. The leader is a bear put spread (long the 100 put, short the 94 put) at 0.079, and the condor is fourth at 0.0008. The engine’s own caveat says a positive expectation here mostly measures the smile, so I decomposed the leader’s expected P/L of 0.158.</p><p>The settlement law has zero drift, while the prices were made with a carry of r − q = 3% a year. Giving the law that drift drops the expectation to 0.086. Repricing both legs at the single 26% volatility as well leaves 0.0068, and that residual is exactly the flat-volatility debit of 2.0713 grown at the risk-free rate for 30 days, 2.0713 × (e^(0.04 × 30/365) − 1) = 0.0068. Under the pricing measure a premium earns the risk-free rate and nothing else, and the closed form reproduces that. Roughly half of the leader’s edge comes from the zero drift and half from the higher volatility of the short 94 put. For the plain long put all of it is drift, 0.128 at μ = 0 against 0.0094 with carry. Zero drift is a documented setting, and on this chain it tilts the ranking towards puts.</p><p>A second ranking puts four measured quantities on one axis, with the weights printed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l-XhRcTXr0S6HmxSNXuJEg.png" /><figcaption>Card 8. The composite score from score_row.</figcaption></figure><p>As text: score = 100·(0.30p + 0.30e + 0.25ρ + 0.15(1 − ξ)), where p is the probability of profit; e = ½(1 + clip₍₋₁,₁₎[(E[P/L] − c_rt) / max(|π|, 0.05)]) with c_rt the round-trip cost and π the premium; ρ = min(RR, 3)/3, or 1 when the gain is unbounded; ξ = min(|ES|/|W|, 1) with W the worst case. Then ±5 points for a stated volatility view, ×0.75 for thin friction, clamped to [0, 100].</p><p>The condor scores 100 × (0.30 × 0.760 + 0.30 × 0.472 + 0.25 × 0.075 + 0.15 × 0.307) = 43.4, eleventh of twelve. The straddle comes first at 59.4, mainly because an unbounded gain sets ρ = 1 outright, and the bear put spread that led on return on risk is eighth. The engine shows both rankings with their formulas and leaves the argument to the reader.</p><h3>Simulating the underlying with GARCH-t</h3><p>The lognormal law above uses one volatility forever. Real returns cluster, with large moves followed by more large moves, and extreme days come more often than a normal curve allows. A GARCH model lets today’s volatility depend on yesterday’s shock and yesterday’s volatility [3]. Student-t shocks [4] supply the heavy tails.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RHLwFynsB0ncn7Eb0_AfXQ.png" /><figcaption>Card 9. The model and its sampling coordinates from garch.py.</figcaption></figure><p>As text: r_t = μ + ε_t, ε_t = σ_t·z_t, where z_t is a Student-t draw with ν degrees of freedom scaled by √((ν − 2)/ν) to unit variance, and σ_t² = ω + α·ε²_{t−1} + β·σ²_{t−1}. The sampler works in θ = (μ, ln v̄, logit(α + β), logit(α/(α + β)), ln(ν − 2)), with the unconditional variance v̄ and ω = v̄·(1 − α − β). It proposes one coordinate at a time and accepts with probability min(1, e^(ℓ(θ′) − ℓ(θ))), where ℓ is the log posterior [5, 6].</p><p>Sampling ω directly makes a long thin ridge, because raising persistence while lowering ω leaves the variance path almost unchanged. The source records that sampling the unconditional variance instead raised the effective sample size on ω, α and β by a factor of 10 to 17. The logits keep α + β below 1 and ν above 2 for any real coordinates, so every proposal is a valid model.</p><p>To test it I generated 1,000 daily returns from a known GARCH-t process (seed 20261110, with μ = 0.0003, α = 0.08, β = 0.90, ν = 6, unconditional volatility 20% a year), scaled to finish at 100 on the chain’s valuation date. The realised volatility of that sample is 17.3%. The engine’s default fit (two chains of 3,000 draws after 1,000 burn-in) returned posterior medians α = 0.087 (90% interval 0.062 to 0.124), β = 0.897 (0.853 to 0.926), ν = 6.08 (4.80 to 8.19) and persistence α + β = 0.985 (0.967 to 0.994), against a truth of 0.98. The unconditional volatility is centred at 17.9%, close to what this sample realised. None of it is quoted unless the chains agree.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yaYeM-aze3rFUVUbX2i1vg.png" /><figcaption>Card 10. The convergence gate from _split_rhat, _ess and fit_garch_t.</figcaption></figure><p>As text: split R̂ = √(((n − 1)/n·W + B/n) / W), where each chain is halved into m groups of n draws, B = n/(m − 1)·Σ(θ̄<em>j − θ̄)² and W is the mean within-group variance [7, 8]. ESS = n / (1 + 2Σ</em>{k=1}^{K} ρ̂_k), stopping before the first autocorrelation below 0.05 or at min(n/2, 200) [9]. The fit counts as converged only if every parameter has R̂ &lt; 1.05 and ESS ≥ 100, and the post-burn acceptance rate is above zero.</p><p>The default run passed, with the largest R̂ 1.0065 (on ω), the smallest ESS 165 (on α) and a post-burn acceptance rate of 0.31. To watch the gate refuse, I reran with 150 draws after 50 burn-in. R̂ rose to 1.19, ESS fell to between 6 and 9, and the engine returned converged = false, which the simulation command writes as a degraded artifact with the reason attached.</p><p>Each simulated path draws its own parameter set from the posterior, so the fan carries parameter uncertainty as well as volatility. I simulated 21 trading days, about the chain’s 30 calendar days, with 20,000 paths. At day 21 the 5th, 50th and 95th percentiles are 94.40, 101.02 and 107.93.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f5PVqWESTLLlf23KqXaoGg.png" /><figcaption>Figure 4. Two chains agree on persistence around the true 0.98, and the predictive fan they produce over 21 trading days.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q1iNjpUH25TM3zdD7T1i3A.png" /><figcaption>Card 11. Tail risk from terminal_risk.</figcaption></figure><p>As text: sort the terminal returns R = S_H/S₀ − 1 as R₍₁₎ ≤ … ≤ R₍ₙ₎ and let i_c = max(1, ⌊(1 − c)n⌋). Then VaR_c = −R₍ᵢ꜀₎ and ES_c = −(1/i_c)·Σ_{i ≤ i_c} R₍ᵢ₎, both reported as positive losses [10, 11].</p><p>With 20,000 paths the 95% tail holds 1,000 of them. Over 21 days the engine reports a 95% VaR of 5.60% and an expected shortfall of 7.79%. At 99% they are 9.14% and 11.34%.</p><p>The same paths can settle the condor. Under the lognormal law at the chain’s 26% implied volatility, its probability of profit was 0.760. Under the GARCH-t paths it is 0.951, with a mean P/L of +0.61 instead of +0.003. I built that gap in. The history was generated at 20% volatility, the posterior median of the next day’s conditional volatility is 13.7% a year, and the chain was authored at 26%. Options priced above the volatility the share has been showing make a short-volatility structure look excellent, which is the variance risk premium [12]. The engine prints both probabilities side by side as a disagreement between models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lieq6m74cyOs_lcrCvSMfQ.png" /><figcaption>Figure 5. The same four legs under two settlement laws. Most of the GARCH-t mass sits inside the breakevens.</figcaption></figure><h3>Backtesting with overlapping trades</h3><p>A backtest replays a rule over history. Here the rule opens a condor every five trading days, holds it 30, settles it at the close, and records the profit as a fraction of the capital at risk. The engine has no history of option quotes, so it prices each entry’s chain with the same model at the trailing 60-day realised volatility. The test therefore measures the condor’s payoff geometry against the path and cannot see any premium the market might pay.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Us9LXitK5YpYDr4fD_IzQ.png" /><figcaption>Card 12. Accounting and inference from performance_stats, permutation_p_value and bootstrap_mean_interval.</figcaption></figure><p>As text: x_i = P/L_i / L_i, where L_i is capital at risk; the equity curve is E_k = Σ_{i ≤ k} x_i, summed and never compounded, so it is measured in units of one trade’s risk; the drawdown is MDD = max_k (max(0, max_{j ≤ k} E_j) − E_k). The block length is b = ⌈H/E⌉ for holding period H and entry spacing E. The p-value is (1 + #{|mean(ε ⊙ x)| ≥ |mean(x)|}) / (N + 1), where ε assigns one random sign to each block of b consecutive trades, and the 90% interval comes from a moving-block bootstrap [13] with blocks of b trades and N = 2,000.</p><p>On my synthetic history the rule entered 183 condors and skipped none. It won 65.6% of the time and still lost on average, with a mean return on risk of −0.092 per trade, the median +0.252, the mean win +0.275 against a mean loss of −0.792, and the worst trade lost its full risk. Summed, the curve ended at −16.9 units with a maximum drawdown of 20.9. Buying the share over the same windows returned +1.7% on average. Many small wins and a few large losses is the shape a short-volatility structure takes when nothing pays it for the risk.</p><p>Thirty-day holds opened every five days share up to 25 days with their neighbours, so consecutive returns are correlated, 0.61 at lag one, 0.34 at lag two, 0.19 at lag three, and close to zero from lag four. The engine takes b = ⌈30/5⌉ = 6. Treating the 183 trades as independent gives a p-value of 0.022 and a 90% interval for the mean of −0.157 to −0.027, which excludes zero and would be reported as a significant loss. With blocks of 6 the p-value is 0.180 and the interval −0.210 to +0.007, which includes zero. Counted with their overlap, the same returns do not support the conclusion the naive test reaches.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dL5LKnfxpGzhjTEXi2VajQ.png" /><figcaption>Figure 6. The condor’s summed equity curve on the synthetic history, and why the inference works in blocks of six trades.</figcaption></figure><h3>How a tool call from ChatGPT or Claude reaches the server</h3><p>The hosted edition at optiondesk.avidquant.com runs the chain, Greek, positioning and structure tools for browser agents. Simulation and backtests stay local because the server holds no price history. I traced a request through the hosted service’s source.</p><p>When you ask ChatGPT or Claude to show the gamma walls for a chain you attached, the model chooses the option_positioning tool and fills in its arguments, including your chain as JSON. Your browser does not contact the server. The AI platform&#39;s own servers send one HTTPS request to https://optiondesk.avidquant.com/mcp, carrying a JSON-RPC message in the format the Model Context Protocol specifies for Streamable HTTP [14]. It passes a CDN edge and an nginx reverse proxy to the Python application. The endpoint has no login, so the server never learns an account name. I sent the same request, with our chain attached, to the hosted application&#39;s code running locally. Here it is with the answer trimmed.</p><pre>POST /mcp<br>{&quot;jsonrpc&quot;: &quot;2.0&quot;, &quot;id&quot;: 1, &quot;method&quot;: &quot;tools/call&quot;,<br> &quot;params&quot;: {&quot;name&quot;: &quot;option_positioning&quot;,<br>            &quot;arguments&quot;: {&quot;symbol&quot;: &quot;SYNTH&quot;,<br>                          &quot;source_data&quot;: {&quot;spot&quot;: 100.0, &quot;contracts&quot;: [... 62 ...]},<br>                          &quot;data_source&quot;: &quot;Synthetic teaching sample&quot;,<br>                          &quot;rights_confirmed&quot;: true}}}</pre><pre>{&quot;jsonrpc&quot;: &quot;2.0&quot;, &quot;id&quot;: 1,<br> &quot;result&quot;: {&quot;isError&quot;: false,<br>            &quot;structuredContent&quot;: {&quot;regime&quot;: &quot;dampening&quot;,<br>                                  &quot;gamma_flip&quot;: 103.8424,<br>                                  &quot;call_wall&quot;: {&quot;strike&quot;: 104.0, &quot;gex&quot;: 2007921.80},<br>                                  &quot;put_wall&quot;: {&quot;strike&quot;: 94.0, &quot;gex&quot;: -1445781.98},<br>                                  &quot;max_pain&quot;: 100.0, &quot;atm_iv&quot;: 0.26,<br>                                  &quot;risk_reversal_25d&quot;: 0.0143,<br>                                  &quot;expected_move&quot;: 7.454,<br>                                  &quot;assumption&quot;: &quot;Signs assume dealers are long calls and short puts ...&quot;,<br>                                  &quot;warning&quot;: &quot;USER-SUPPLIED DATA. Private research only. ...&quot;}}}</pre><p>The figures match the local run to the last digit, because the hosted service installs the same engine. Inside the server the MCP layer runs stateless, so no session survives the request. The tool runs in a worker thread inside a fresh temporary directory with owner-only permissions. The same chain, Greek and exposure commands write their JSON there, the summary is read back, and the directory is deleted before the answer leaves. I listed the temporary directories before and after the call and found none either time.</p><p>From an ordinary tool call the server keeps nothing. Uvicorn runs with access logging switched off and nginx has access_log off with errors logged only at the critical level. The MCP library prints one line per request naming its type, &quot;Processing request of type CallToolRequest&quot;, with no arguments. A rate limiter counts requests per caller for 60 seconds in memory, keyed by a hash of the address under a random key that changes whenever the service restarts, and that address belongs to the AI platform rather than to you.</p><p>The one exception is opt-in. The private dashboard tool runs only when the call carries retention_confirmed: true. It then writes the artifacts under a random 256-bit token, returns a private URL that anyone holding it can open, and deletes the directory once it is an hour old, through a sweep that runs every minute. The delete tool removes it sooner. The AI platform keeps your conversation, including the chain you attached, under its own terms.</p><p>The chain, Greek, positioning and comparison numbers in this article come from four commands on a clone of the repository: optiondesk chain SYNTH --from-file examples/chain-synth.json --accept-data-rights, then optiondesk greeks, optiondesk exposure and optiondesk compare, each reading the artifact the previous one wrote.</p><h3>The results in one table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yAC-Ppqul5l6IcVybZYoYg.png" /><figcaption>Table 1. Each step, its model and its result on the synthetic chain.</figcaption></figure><h3>How to use the MCP server</h3><p>MCP, the Model Context Protocol, is the plug that lets an AI assistant call outside tools. You connect the server once, and from then on you ask in plain English and the assistant picks the tool. There are two ways in. The hosted server needs no install and no account. The local install runs everything on your own machine, which is the better place for any data you care about. Menu names below are as I found them in November 2026, and the custom-connector options depend on your plan and workspace.</p><ul><li><strong>ChatGPT.</strong> Find Option Desk in the app directory. Or, with developer mode on, open Settings, then Apps, then Create, enter the name Option Desk and the URL https://optiondesk.avidquant.com/mcp, select Scan Tools and then Create.</li><li><strong>Claude (web or desktop).</strong> Open Customize, then Connectors, select +, then Add custom connector, and enter the same name and URL. Enable the connector in the conversation.</li><li><strong>Claude Code, hosted.</strong> Run /plugin marketplace add Iman/agent-driven-options-desk-and-skills, then /plugin install option-desk-hosted@option-desk.</li><li><strong>Claude Code or Codex, local.</strong> Install the local tools from the repository’s INSTALL guide, then run claude mcp add optiondesk -- optiondesk-mcp or codex mcp add optiondesk -- optiondesk-mcp. The local server has 12 tools, including simulation and backtests.</li></ul><p>Then ask. Three prompts to start with:</p><ul><li>“Check Option Desk status, then show the dealer positioning for the synthetic SYNTH chain.”</li><li>“Show the Greek ladder for the at-the-money SYNTH call and explain vanna in one paragraph.”</li><li>“Here is my own option chain as JSON. I have the right to share it. Validate it first, then show the gamma walls.”</li></ul><p>The server ships only the synthetic SYNTH sample. For anything else you bring your own chain, and the tool asks you to confirm that you have the right to send it. Ask the assistant for the snapshot schema first and it will tell you the exact format.</p><h3>References</h3><p>[1] F. Black and M. Scholes, “The Pricing of Options and Corporate Liabilities,” <em>Journal of Political Economy</em>, vol. 81, no. 3, pp. 637–654, 1973. doi:10.1086/260062</p><p>[2] R. C. Merton, “Theory of Rational Option Pricing,” <em>The Bell Journal of Economics and Management Science</em>, vol. 4, no. 1, pp. 141–183, 1973. doi:10.2307/3003143</p><p>[3] T. Bollerslev, “Generalized Autoregressive Conditional Heteroskedasticity,” <em>Journal of Econometrics</em>, vol. 31, no. 3, pp. 307–327, 1986. doi:10.1016/0304–4076(86)90063–1</p><p>[4] T. Bollerslev, “A Conditionally Heteroskedastic Time Series Model for Speculative Prices and Rates of Return,” <em>The Review of Economics and Statistics</em>, vol. 69, no. 3, pp. 542–547, 1987. doi:10.2307/1925546</p><p>[5] N. Metropolis, A. W. Rosenbluth, M. N. Rosenbluth, A. H. Teller and E. Teller, “Equation of State Calculations by Fast Computing Machines,” <em>The Journal of Chemical Physics</em>, vol. 21, no. 6, pp. 1087–1092, 1953. doi:10.1063/1.1699114</p><p>[6] W. K. Hastings, “Monte Carlo Sampling Methods Using Markov Chains and Their Applications,” <em>Biometrika</em>, vol. 57, no. 1, pp. 97–109, 1970. doi:10.1093/biomet/57.1.97</p><p>[7] A. Gelman and D. B. Rubin, “Inference from Iterative Simulation Using Multiple Sequences,” <em>Statistical Science</em>, vol. 7, no. 4, pp. 457–472, 1992. doi:10.1214/ss/1177011136</p><p>[8] A. Vehtari, A. Gelman, D. Simpson, B. Carpenter and P.-C. Bürkner, “Rank-Normalization, Folding, and Localization: An Improved R̂ for Assessing Convergence of MCMC,” <em>Bayesian Analysis</em>, vol. 16, no. 2, pp. 667–718, 2021. doi:10.1214/20-BA1221</p><p>[9] C. J. Geyer, “Practical Markov Chain Monte Carlo,” <em>Statistical Science</em>, vol. 7, no. 4, pp. 473–483, 1992. doi:10.1214/ss/1177011137</p><p>[10] P. Artzner, F. Delbaen, J.-M. Eber and D. Heath, “Coherent Measures of Risk,” <em>Mathematical Finance</em>, vol. 9, no. 3, pp. 203–228, 1999. doi:10.1111/1467–9965.00068</p><p>[11] C. Acerbi and D. Tasche, “On the Coherence of Expected Shortfall,” <em>Journal of Banking &amp; Finance</em>, vol. 26, no. 7, pp. 1487–1503, 2002. doi:10.1016/S0378–4266(02)00283–2</p><p>[12] P. Carr and L. Wu, “Variance Risk Premiums,” <em>The Review of Financial Studies</em>, vol. 22, no. 3, pp. 1311–1341, 2009. doi:10.1093/rfs/hhn038</p><p>[13] H. R. Künsch, “The Jackknife and the Bootstrap for General Stationary Observations,” <em>The Annals of Statistics</em>, vol. 17, no. 3, pp. 1217–1241, 1989. doi:10.1214/aos/1176347265</p><p>[14] Model Context Protocol, “Specification 2025–06–18: Transports (Streamable HTTP).” <a href="https://modelcontextprotocol.io/specification/2025-06-18/basic/transports">https://modelcontextprotocol.io/specification/2025-06-18/basic/transports</a></p><h3>Disclaimer</h3><ul><li><strong>Personal and educational.</strong> I wrote this article in a personal capacity, for education only. It is not connected with any employer or client, uses none of their information, and does not represent their views.</li><li><strong>Not advice and not an offer.</strong> Nothing here is investment, financial, legal, tax or accounting advice, a recommendation, a financial promotion, or an offer or solicitation to buy or sell any instrument, in any jurisdiction. No regulated service is provided.</li><li><strong>Synthetic data.</strong> Every price, position, portfolio and result in this article is synthetic, generated for illustration with a fixed random seed. None of it describes a real market, book, client or counterparty.</li><li><strong>Software as is.</strong> The software is provided as is, without warranty of any kind, under its published licence (PolyForm Noncommercial 1.0.0). To the fullest extent the law allows, I accept no liability for any loss that arises from its use or from reliance on this article. Check every output independently before you rely on it.</li><li><strong>Data handling.</strong> The hosted server keeps no access logs and writes no request data to its logs. Tool calls are computed and returned, and nothing from them is kept. A private dashboard is created only when you ask for one, and it is deleted after one hour by a sweep that runs every minute. The AI platform you connect through keeps your conversation under its own terms.</li><li><strong>Names.</strong> OpenAI, ChatGPT, Anthropic, Claude and all other names belong to their owners. None of them sponsors or endorses this article, and a directory listing is not an endorsement.</li></ul><h3>Stay in touch</h3><p>If this was useful, connect with me on <a href="https://www.linkedin.com/in/samizadeh">LinkedIn</a>. The code for both desks is on <a href="https://github.com/Iman">GitHub</a>, as <a href="https://github.com/Iman/agent-driven-options-desk-and-skills">Option Desk</a> and <a href="https://github.com/Iman/agent-driven-risk-desk-and-skills">Risk Desk</a>. Questions, corrections and issues are welcome there.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ac80fd84d2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[One synthetic book through a risk desk an agent can drive]]></title>
            <link>https://medium.com/@iman.samizadeh/one-synthetic-book-through-a-risk-desk-an-agent-can-drive-68ee6e28eb7c?source=rss-ef18e5079d06------2</link>
            <guid isPermaLink="false">https://medium.com/p/68ee6e28eb7c</guid>
            <dc:creator><![CDATA[Iman Samizadeh, Ph.D.]]></dc:creator>
            <pubDate>Tue, 10 Nov 2026 16:07:42 GMT</pubDate>
            <atom:updated>2026-11-10T16:07:42.707Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-5llobY9XCCXg1hyfbBz9w.png" /><figcaption>Cover composite. The background comes from an AI image model and shows no real place, firm or person.</figcaption></figure><p><em>The mathematics inside Risk Desk, from historical VaR to the FRTB P&amp;L attribution test, with every figure computed by the engine on synthetic data</em></p><p>In September I wrote about Option Desk, the options research server that ChatGPT and Claude can call as a tool (<a href="https://medium.com/p/bd27350d80e5">I built an options desk an agent can drive</a>). Risk Desk is its sibling for portfolio risk, an MCP server with 30 tools on a local install and 29 on the hosted service at riskdesk.avidquant.com. It has been submitted to OpenAI’s app directory (under review) and to Anthropic, and the source is public at github.com/Iman/agent-driven-risk-desk-and-skills.</p><p>Here I follow one synthetic portfolio through the models the code implements: historical, parametric and tail-model VaR and expected shortfall, four backtests, Euler attribution, stress and reverse stress, SA-CCR, credit VaR and two pieces of the Basel FRTB internal models approach. Each section gives the idea in plain words, then the formula as the code computes it, then the number the engine returned. The last part explains what happens when a chatbot calls the hosted server and what the server keeps.</p><p><em>How to read this: each section opens in plain words, then gives the formula as an equation card, then the number the engine returned. Skip the cards and the story still holds. Every figure is synthetic, and nothing here is advice. The full disclaimer is at the end.</em></p><h3>The book</h3><p>Picture an imaginary multi-asset fund with USD 100 million of capital. It holds USD 60 million of an equity index and has sold USD 20 million of index futures against it. It also holds USD 40 million of a 10-year government bond, USD 25 million of an investment-grade credit index and USD 10 million of crude oil futures. The engine reports gross exposure of USD 155 million and net exposure of USD 115 million, leverage of 1.55 and 1.15.</p><p><strong>Every figure in this article is synthetic.</strong> A script with a fixed random seed (20261110) drew 1,000 daily returns for the four assets, with Student-t shocks (5 degrees of freedom), a shared GARCH(1,1) volatility and a fixed correlation matrix. Two stress episodes are written in. Episode A is 40 days of severe falls in the first half, in which the book loses USD 11.7 million. Episode B is a milder 20-day fall about 100 days before the end. The last 20 days are turbulent too, with a daily P&amp;L standard deviation of USD 1.03 million against USD 0.49 million over the whole history.</p><h3>How much could the book lose tomorrow?</h3><p>Value at Risk (VaR) answers a narrow question. Rank the last 1,000 days of P&amp;L from worst to best and read off the loss that only 1% of days were worse than. Expected shortfall (ES) is the average loss on those worst 1% of days. VaR tells you where the tail starts, and ES tells you how heavy it is. The Basel trading book rules measure capital with ES at 97.5% [16].</p><p>Write the losses Lᵢ = −P&amp;Lᵢ in descending order L₍₁₎ ≥ L₍₂₎ ≥ …, with n observations and confidence level q. The tail holds m = n(1 − q) observations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5VO5CMtwsLoiwOZEK_00nw.png" /></figure><p>As text: m = n(1 − q); VaR_q = L₍⌈m⌉₎; ES_q = (1/m)[ ∑ᵢ₌₁^⌊m⌋ L₍ᵢ₎ + (m − ⌊m⌋) L₍⌊m⌋₊₁₎ ]</p><p>The code delegates both to skfolio. When m is not a whole number, the last observation enters the ES with a fractional weight, the definition of Acerbi and Tasche [1]. When m is an exact integer, binary rounding can make skfolio pick the next order statistic, so the adapter moves q one floating-point step towards 1 at that boundary only.</p><p>For our book at 99% over one day the engine returns a VaR of USD 1.25 million and an ES of USD 1.79 million. At 97.5% the figures are USD 0.98 million and USD 1.36 million. The 99% result carries a degraded flag, because only 10 observations sit in the tail and the code flags anything under 20. The calculation still runs, and the flag tells the reader, and the agent, that the estimate rests on ten days.</p><h3>Seven answers to one question</h3><p>Historical simulation assumes tomorrow looks like a random day from the last four years. A parametric model fits a curve to the same data and reads the tail from the curve. A conditional model also asks how turbulent the market is today. Risk Desk’s tail-model tool runs seven methods on one P&amp;L series and puts them side by side.</p><p>The normal model fits a mean μ and standard deviation σ by maximum likelihood. Here φ and Φ are the standard normal density and distribution function, and z_q = Φ⁻¹(q). The Student-t model fits a location m, a scale s and ν degrees of freedom. Here g_ν is the standard t density.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i30oHbmakrIkd9i04eejWw.png" /></figure><p>As text: VaR_q = μ + σ z_q, ES_q = μ + σ φ(z_q)/(1 − q); Student-t: VaR_q = m + s x, ES_q = m + s g_ν(x)/(1 − q) · (ν + x²)/(ν − 1), x = t_ν⁻¹(q)</p><p>Extreme value theory looks only at the largest losses. Following McNeil and Frey [2], the code takes the k = ⌊0.1n⌋ largest losses, sets the threshold u at the (k+1)th largest, and fits a generalised Pareto distribution with shape ξ and scale β to the excesses over u. A positive ξ means a tail heavier than the normal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*po0Bnc_7oKNEwSvdWfmZkQ.png" /></figure><p>As text: k = ⌊0.10 n⌋, u = L₍ₖ₊₁₎; VaR_q = u + (β/ξ)[((1 − q)/(k/n))^(−ξ) − 1]; ES_q = (VaR_q + β − ξu)/(1 − ξ)</p><p>The three conditional columns start from a GARCH(1,1) model with Student-t errors [3], fitted by Option Desk’s Bayesian sampler. Tomorrow’s variance is a weighted sum of a constant ω, yesterday’s squared surprise and yesterday’s variance. Dividing each past return by its own volatility gives standardised residuals zₜ. Filtered historical simulation rescales them by tomorrow’s forecast volatility σ_{T+1}, GARCH-EVT fits the tail of zₜ, and the Monte Carlo column simulates one day ahead with one posterior parameter set per path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WyTbCKODtkhpqFlhQbq17Q.png" /></figure><p>As text: σ²ₜ₊₁ = ω + α(rₜ − μ)² + β σ²ₜ; zₜ = (rₜ − μ)/σₜ; filtered P&amp;Lₜ = (μ + σ_{T+1} zₜ)·PV; GARCH-EVT VaR = (−μ + σ_{T+1} VaR_q of z)·PV</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hGueJ7freUC7yrxHpsu_VA.png" /><figcaption>Figure 1. One-day 99% VaR and ES of the synthetic book under seven models, USD million. The starred columns use a GARCH posterior that did not pass the engine’s convergence gate.</figcaption></figure><p>The four unconditional models agree to within USD 0.16 million on VaR: 1.19 (normal), 1.25 (historical), 1.28 (EVT) and 1.35 (Student-t). The normal model has the lowest ES, USD 1.35 million, because the fitted Student-t has 3.86 degrees of freedom and the EVT shape is ξ = 0.23, so both see a heavier tail than the bell curve. The conditional columns roughly double the VaR, to USD 2.23 to 2.67 million, because tomorrow’s forecast volatility of 1.02% of NAV reflects the turbulent last month.</p><p>The engine also says how far to trust those three columns. The GARCH posterior has an effective sample size of 98 for α against a gate of 100, so the result is flagged degraded: &quot;GARCH-t posterior did not converge&quot;. An agent that reports the GARCH figures without that sentence is misreporting the tool.</p><h3>Was yesterday’s VaR right?</h3><p>A VaR model makes a forecast every day, so it can be scored every day. At 99% we expect a loss larger than VaR on about 2.5 days in 250. Too many such exceptions means the model understates risk, and exceptions that bunch together mean it reacts too slowly.</p><p>To create a forecast series, I re-estimated one-day 99% historical VaR and ES for each of the last 250 days from the 500 days before it, with the same engine function. Let x be the number of exceptions in n days, p = 1 − q the expected rate, and n_{ij} the number of days in state j that follow a day in state i, where state 1 is an exception.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fjcTuoW1PnAp2KdWwO9DcQ.png" /></figure><p>As text: LR_pof = −2 ln[(1 − p)^(n−x) p^x / ((1 − p̂)^(n−x) p̂^x)] ~ χ²₁; LR_ind compares one exception rate π with the Markov rates π₀ = n₀₁/(n₀₀ + n₀₁), π₁ = n₁₁/(n₁₀ + n₁₁) ~ χ²₁; LR_cc compares p with the Markov rates ~ χ²₂</p><p>Kupiec’s proportion-of-failures test asks whether x/n is consistent with p [4]. Christoffersen’s tests ask whether an exception today makes one tomorrow more likely, and whether coverage and independence hold together [5]. The Basel traffic light colours the 250-day count at 99% by the binomial probability F(x) of seeing that many or fewer from a correct model [6]. The Acerbi and Szekely Z₂ statistic tests ES directly [7]. Here Xₜ is the day’s P&amp;L and Iₜ marks an exception. For a correct model Z₂ is near zero, and a negative value means losses beyond VaR were larger than the ES forecast.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oANy04YBJ6OgtZ-ifkwt1g.png" /></figure><p>As text: F(x) = ∑_{i≤x} C(n,i) 0.01ⁱ 0.99^(n−i): green F &lt; 0.95, amber 0.95 ≤ F &lt; 0.9999, red F ≥ 0.9999. Z₂ = ∑ₜ Xₜ Iₜ /(T α ESₜ) + 1, Iₜ = 1{Xₜ + VaRₜ &lt; 0}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*egAHCyNoyV0srZFyg8cVhA.png" /><figcaption>Figure 2. Daily P&amp;L of the last 250 days against minus the rolling 99% historical VaR. Red points are exceptions. The VaR line steps down while the days of episode A leave the 500-day window.</figcaption></figure><p>The forecasts fail three of the four tests. There were 10 exceptions where 2.5 were expected, and Kupiec’s statistic is 12.96 (p = 0.0003). Independence is not rejected (LR 0.85, p = 0.36). The exception rate was 3.75% after a quiet day and 11.1% after an exception, but only nine days followed an exception. Conditional coverage is rejected (LR 13.87, p = 0.001). Ten exceptions put the model in the Basel red zone, which starts at 10 for 250 days. Z₂ is −3.43, and none of 10,000 values simulated under the engine’s normal null was as low, so the reported p-value is the floor of 1/10,001.</p><p>Figure 2 shows the cause. Historical VaR remembers a crash for exactly 500 days. As the days of episode A leave the window (days 800 to 839), the VaR falls from USD 1.57 million to USD 0.93 million, shortly before episode B and the volatile final month arrive.</p><h3>Who owns the risk?</h3><p>A risk number for the whole book helps little when someone has to cut it. Euler allocation splits the total into contributions that add back up exactly, so you can say which position carries how much, and a hedge shows up as a negative number.</p><p>Both versions need a view of how the assets move together. The sample covariance weights every day equally. The exponentially weighted (EWMA) estimate of RiskMetrics gives day t the weight λ^(T−t), so with λ = 0.94 the last month dominates [8]. Ledoit-Wolf shrinks the sample matrix S towards a multiple of the identity, which keeps it well conditioned when assets are many and days few [9].</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S_QJUb8nDUqjV9pkQjboyA.png" /></figure><p>As text: Σ̂_EWMA = ∑ₜ wₜ rₜ rₜᵀ, wₜ = λ^(T−t)/∑ₛ λ^(T−s); Σ̂_LW = (1 − δ)S + δ μ̄ I, μ̄ = tr(S)/N</p><p>For our book the sample estimate puts daily equity volatility at 0.94% and the equity-bond correlation at −0.38. The EWMA estimate says 2.22% and −0.67. Ledoit-Wolf picks a shrinkage weight δ of 0.023, because 1,000 days of four assets already give a stable matrix.</p><p>For a linear book with exposure vector w, VaR is homogeneous of degree one in the positions, so by Euler’s theorem the contributions vᵢ ∂VaR/∂vᵢ sum to the total [10]. The historical version gives each position its own average loss over the same tail days that define the portfolio ES.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WkGQNQCsLW6M4U6_p9Ss-Q.png" /></figure><p>As text: σ_P = √(wᵀΣw), VaR = z_q σ_P, ES = φ(z_q)/(1 − q) σ_P; VaRᵢ = vᵢ z_q (Σw)ₐ₍ᵢ₎/σ_P, ∑ VaRᵢ = VaR; historical ESᵢ = (1/m) ∑ₖ ωₖ L_{i,(k)}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jA4JXhBbyCFHTJdtbEgaNA.png" /><figcaption>Figure 3. Contributions of each position to one-day parametric VaR at 99% (EWMA covariance) and to historical ES at 97.5% over 1,000 days, USD million.</figcaption></figure><p>With the EWMA covariance the parametric VaR is USD 2.34 million and the risk is spread out. The bond contributes 33%, oil 30%, the long equity 29%, credit 17% and the futures hedge −10%. Historical ES at 97.5% is USD 1.36 million, and there the long equity carries 85%, the hedge −28% and the bond 6%. The EWMA figure describes the last month, in which the bond was unusually volatile. The historical figure describes the 25 worst days in four years (six in episode A, seven in the last month), on which the long equity lost most.</p><h3>Stress, replay and reverse stress</h3><p>A stress test drops probabilities and asks what a named event would cost. Risk Desk revalues the book under shocks written by hand, shocks replayed from a historical window, and shocks found by working backwards from a loss.</p><p>The hand scenario (equity −15%, bond +2%, credit −4%, oil −20%) costs USD 8.2 million, after the futures hedge earns back USD 3.0 million and the bond USD 0.8 million. Replaying synthetic episode A from its first to its last price gives equity −20.5%, credit −7.7%, oil −10.3% and bond −0.3%, a loss of USD 11.2 million on today’s positions (the 11.7 million quoted earlier sums daily P&amp;L on a constant book). The tool also lists three dated crisis windows with sources, but ships no prices for them.</p><p>Reverse stress asks which move loses exactly L, and which of those moves is the least far-fetched. The code measures that with the Mahalanobis distance, the size of a shock vector s in units of the covariance. Minimising sᵀΣ⁻¹s over the shocks that lose L has a closed form. Breuer and co-authors search for the worst loss within a plausibility region in the same spirit [11].</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fJsu6Z1Psmdm9-fwfm_JBA.png" /></figure><p>As text: min sᵀΣ⁻¹s subject to wᵀs = −L ⇒ s* = −L Σw/(wᵀΣw), d* = L/√(wᵀΣw)</p><p>I asked for a 10-day loss of USD 5 million, with a covariance the engine estimated from 100 non-overlapping 10-day returns. The 10-day P&amp;L standard deviation is USD 1.40 million, so the most plausible shock sits at distance 3.58: equity −7.7%, credit −2.7%, oil −10.6% and bond −0.4%. The engine adds that a normal model would give such a loss a probability of 0.017%, and labels it a reference figure because returns are neither normal nor unbounded. The scaling tool says the hand scenario reaches the same loss at 0.61 times its size, and my script measured that scaled scenario at distance 3.84. The hand scenario has the bond rallying 1.2%, while under this covariance a loss of this kind comes with a small bond fall.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M-yMqyF2_kDdGPxUhpoZZA.png" /><figcaption>Figure 4. Two shock vectors that each cost the book USD 5 million over 10 days: the minimum-distance reverse stress and the hand scenario scaled by 0.61.</figcaption></figure><h3>The dealer on the other side</h3><p>The fund hedges with three trades facing one dealer: a 10-year USD swap paying fixed on USD 30 million, a bought six-month index put on USD 20 million and a one-year oil swap selling USD 5 million. If the dealer failed, the fund would have to replace them. The Basel standardised approach for counterparty credit risk, SA-CCR, prescribes how to size that exposure [12].</p><p>Exposure at default (EAD) is 1.4 times the replacement cost (RC) plus the potential future exposure (PFE). V is the trades’ net value, C the collateral held, TH the threshold, MTA the minimum transfer amount and NICA the independent collateral. The add-on is built from each trade’s effective notional Dᵢ: an adjusted notional dᵢ (for rates, the notional times the supervisory duration SDᵢ between start Sᵢ and end Eᵢ), times a maturity factor MFᵢ and a supervisory delta δᵢ.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jm129V052IpuripGXu_5Sw.png" /></figure><p>As text: EAD = 1.4 (RC + PFE); RC = max(V − C, TH + MTA − NICA, 0); PFE = min{1, 0.05 + 0.95 exp((V − C)/(2·0.95·AddOn))}·AddOn; Dᵢ = dᵢ·MFᵢ·δᵢ; MF = 1.5√(MPOR/250) when margined; SDᵢ = (e^(−0.05 Sᵢ) − e^(−0.05 Eᵢ))/0.05</p><p>The netting set is margined daily with a 10-day margin period of risk, so every maturity factor is 1.5√(10/250) = 0.3. The swap’s supervisory duration is 7.87 and its add-on USD 354,000. The put’s supervisory delta, at the prescribed 75% volatility, is −0.32, giving an equity add-on of USD 386,000. The oil swap adds USD 270,000. V is USD 0.8 million against USD 0.7 million of collateral, so the margin terms set the replacement cost at USD 0.25 million and the multiplier is 1. EAD comes to USD 1.76 million, against USD 4.33 million for the same trades unmargined.</p><p>The repository’s tests reproduce the five worked examples in Basel CRE99, as transcribed from bis.org. Basel publishes no FX or equity example, so the equity add-on is labelled partially verified.</p><h3>When borrowers default</h3><p>Underneath, the credit index is a basket of 20 bonds of USD 1.25 million each: six with a one-year default probability (PD) of 0.1%, eight at 0.3%, four at 1% and two at 3%. Each loses 45% of its value on default (the LGD). Single defaults are rare, so the question is how likely several are together, and that depends on how strongly the issuers share one economic cycle.</p><p>Both credit models put that cycle into one standard normal factor Z. Vasicek’s asymptotic single risk factor model assumes an infinitely granular portfolio, so given Z the loss is known and its q-quantile has a closed form [13, 14], the formula behind the Basel IRB risk weights. The Gaussian copula draws Z and an idiosyncratic shock εᵢ per issuer and counts defaults [15]. Here ρᵢ is the asset correlation and aᵢ = √ρᵢ the factor loading.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y25JACwZMYHDOIa9jQjkeA.png" /></figure><p>As text: VaR_q = ∑ᵢ EADᵢ LGDᵢ Φ((Φ⁻¹(PDᵢ) + √ρᵢ Φ⁻¹(q))/√(1 − ρᵢ)); obligor i defaults when aᵢZ + √(1 − aᵢ²) εᵢ &lt; Φ⁻¹(PDᵢ)</p><p>With ρ = 0.20, one year and q = 99.9%, the expected loss is USD 73,125 and the Vasicek credit VaR USD 1.03 million. The copula, over 500,000 seeded scenarios, gives USD 1.69 million, an ES of USD 2.15 million and a simulated expected loss of USD 73,414. The gap is granularity. One default costs USD 562,500, so the copula’s 99.9% loss is exactly three defaults, while Vasicek spreads the loss over infinitely many small names.</p><h3>FRTB: expected shortfall with liquidity horizons</h3><p>The Basel market risk rules (FRTB) measure trading book risk with a 97.5% ES over 10 days, with two twists [16]. A position that takes longer to sell carries more risk, so risk factors are grouped by liquidity horizon and the slower groups are scaled up. And the ES must reflect stress, so it is calibrated on the worst 12 months of history.</p><p>ES_T(P, j) is the 10-day ES when only risk factors with liquidity horizon at least LH_j move. The stressed ES uses a reduced set R of factors over the stress period S, scaled by the ratio of full-set (F) to reduced-set ES in the current period C, floored at 1. The capital charge IMCC averages the whole portfolio’s ES and the sum of the ES of each risk class Cᵢ, with weight ρ = 0.5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v6pmWVyRTfVHdDAUwE84gg.png" /></figure><p>As text: ES = √(ES_T(P)² + ∑<em>{j≥2} (ES_T(P,j) √((LH_j − LH</em>{j−1})/T))²), LH = (10, 20, 40, 60, 120), T = 10; ES* = ES_R,S · max(1, ES_F,C/ES_R,C); IMCC = ρ IMCC(C) + (1 − ρ) ∑ IMCC(Cᵢ), ρ = 0.5</p><p>Under the Basel table the equity index and the bond have a 10-day horizon, oil 20 days and investment-grade credit spreads 40 days. With four risk factors there is nothing to drop, so the reduced set is the full set and the ratio is 1. The engine takes these ES values as inputs. My script computed each with the engine’s own ES function on overlapping 10-day P&amp;L, and picked as the stress period the 250-day window with the largest ES, the one containing episode A.</p><p>The current 10-day ES is USD 4.46 million, and 4.95 million after the liquidity cascade. The stressed values are 5.78 and 6.33 million. The four risk classes summed separately give USD 8.86 million, since a sum ignores diversification, and the IMCC is the average of 6.33 and 8.86, USD 7.60 million. Each of these ES values carries a degraded flag, because 241 overlapping windows at 97.5% leave six observations in the tail.</p><h3>FRTB: does the risk model explain the P&amp;L?</h3><p>A bank may use its own model for a trading desk only if the model’s view of the desk’s P&amp;L tracks the P&amp;L the desk makes. The P&amp;L attribution test compares two daily series over 250 days: the risk-theoretical P&amp;L (RTPL), which revalues positions with only the risk model’s factors, and the hypothetical P&amp;L (HPL) from full front-office pricing. The Spearman rank correlation r_S checks that they move together, and the Kolmogorov-Smirnov distance KS checks that their distributions have the same shape [17].</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gb50cuwbZ8sIEATFROKdiQ.png" /></figure><p>As text: r_S = corr(rank RTPL, rank HPL); KS = sup_x |F_RTPL(x) − F_HPL(x)|; green: r_S &gt; 0.80 and KS &lt; 0.09; red: r_S &lt; 0.70 or KS &gt; 0.12; amber otherwise</p><p>I gave our desk’s risk model no credit spread factor. It maps the credit index onto equity and the bond through the engine’s factor regression (betas 0.24 and 0.44, R² of 0.47), so 53% of the credit index’s variance goes unexplained. The desk still lands in the green zone, with Spearman 0.992 and KS 0.028, because credit is a small part of its P&amp;L. Remove the oil factor as well and the desk drops to amber. Spearman stays at 0.930, but KS rises to 0.096, past the 0.09 limit, because the model now misses a whole source of daily variance and its P&amp;L distribution is too narrow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4redhqH6dgfumy1DblwMCQ.png" /><figcaption>Figure 5. RTPL against HPL over the last 250 days for two versions of the desk’s risk model. Each point is one day, and the line is RTPL = HPL.</figcaption></figure><h3>What happens when ChatGPT or Claude calls the server</h3><p>You type a question in ChatGPT or Claude with the Risk Desk connector enabled. The model decides a tool would answer it and writes the arguments, and one HTTPS POST request goes to riskdesk.avidquant.com/mcp, carrying a JSON-RPC message in the Model Context Protocol’s Streamable HTTP transport [18]. In ChatGPT and claude.ai the request comes from the platform’s servers. A coding agent on your own computer, such as Claude Code, sends it from there. The positions and numbers in it come from your conversation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MB9UjpPvB_xju2AwqbA3-A.png" /><figcaption>Figure 6. The path of one tool call to the hosted server and back.</figcaption></figure><p>An nginx reverse proxy terminates TLS and passes the request to a container running a FastMCP server in stateless mode, which keeps no session between calls. Pydantic validates the request against the same contract the local tools use and names the field and rule of anything malformed. The calculation runs in a worker thread and the answer returns as one JSON document. Here is a trimmed copy of the real exchange, run in-process against the hosted application with this book. The request shows one of five positions and one of four covariance rows.</p><pre>{&quot;jsonrpc&quot;: &quot;2.0&quot;, &quot;id&quot;: 1, &quot;method&quot;: &quot;tools/call&quot;,<br> &quot;params&quot;: {&quot;name&quot;: &quot;risk_var_attribution&quot;,<br>  &quot;arguments&quot;: {&quot;rights_confirmed&quot;: true, &quot;request&quot;: {<br>   &quot;as_of&quot;: &quot;2026-11-06&quot;, &quot;currency&quot;: &quot;USD&quot;, &quot;data_mode&quot;: &quot;synthetic&quot;,<br>   &quot;source&quot;: &quot;synthetic: build_evidence.py, seed 20261110&quot;,<br>   &quot;nav&quot;: 100000000, &quot;confidence&quot;: 0.99, &quot;horizon_days&quot;: 1,<br>   &quot;positions&quot;: [{&quot;id&quot;: &quot;eq_cash&quot;, &quot;asset&quot;: &quot;EQ_INDEX&quot;,<br>                  &quot;market_value&quot;: 60000000, &quot;instrument_type&quot;: &quot;linear&quot;}],<br>   &quot;assets&quot;: [&quot;EQ_INDEX&quot;, &quot;GOVT_10Y&quot;, &quot;CREDIT_IG&quot;, &quot;CRUDE_OIL&quot;],<br>   &quot;covariance&quot;: [[0.000492, -0.000242, -0.0000715, -0.000335]]}}}}</pre><pre>{&quot;var&quot;: 2338184.67, &quot;expected_shortfall&quot;: 2678775.22,<br> &quot;portfolio_std&quot;: 1005088.15, &quot;z&quot;: 2.3263, &quot;degraded&quot;: false,<br> &quot;positions&quot;: [{&quot;id&quot;: &quot;eq_cash&quot;, &quot;component_var&quot;: 671793.39,<br>                &quot;percentage_var&quot;: 0.2873, &quot;incremental_var&quot;: -1112007.53}],<br> &quot;data_origin&quot;: &quot;caller_supplied&quot;}</pre><p>The answer matches the local engine’s output for the same input. Without rights_confirmed the server refused the same call and asked the caller to confirm permission to send the data.</p><p>The code sets out what the server keeps. Uvicorn runs with access logging off, nginx has access_log off and logs errors only at the critical level, and the container log is capped at 1 MB in one file. Tool calls are computed and returned with no state kept. The rate limiter holds a keyed hash of the client address for 60 seconds, under a key regenerated each time the process starts. A call without a request runs a shipped synthetic example, and those demo results are cached.</p><p>There is one opt-in exception. On the website, not through a tool call, you can upload a book as JSON and get a private risk report after three confirmations: rights to the data, one-hour retention and the terms. The rendered report is held in server memory for up to one hour behind a random 43-character link, then discarded. A timer sweeps expired reports every minute, and you can delete yours sooner. Nothing uploaded is written to disk or logged. The AI platform you connect through keeps your conversation, including any numbers you typed, under its own terms.</p><h3>The results in one table</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*67pz5ezN_1CO-0ois8yEqQ.png" /><figcaption>Table 1. Each question, its model and its result on the synthetic book.</figcaption></figure><h3>How to use the MCP server</h3><p>MCP, the Model Context Protocol, is the plug that lets an AI assistant call outside tools. You connect the server once, and from then on you ask in plain English and the assistant picks the tool. There are two ways in. The hosted server needs no install and no login. The local install computes on your own machine, which is the better place for real positions. Menu names below are as I found them in November 2026, and the custom-connector options depend on your plan and workspace.</p><ul><li><strong>ChatGPT.</strong> With developer mode on, open Settings, then Apps, then Create, enter the name Risk Desk and the URL https://riskdesk.avidquant.com/mcp, and choose no authentication.</li><li><strong>Claude (web or desktop).</strong> Open Customize, then Connectors, select +, then Add custom connector, and enter the same name and URL. Enable the connector in the conversation.</li><li><strong>Codex, hosted.</strong> Run codex mcp add riskdesk-hosted --url <a href="https://riskdesk.avidquant.com/mcp.">https://riskdesk.avidquant.com/mcp.</a></li><li><strong>Claude Code, local.</strong> Install the package from the repository’s README, then run /plugin marketplace add Iman/agent-driven-risk-desk-and-skills and /plugin install risk-desk@risk-desk. The local server has 30 tools, the hosted one 29.</li></ul><p>Then ask. Three prompts to start with:</p><ul><li>“Check Risk Desk status, then explain the synthetic energy book’s tail risk. State the currency, horizon, loss signs and degraded status first.”</li><li>“Run the VaR backtest on the synthetic example and tell me which tests it fails and why.”</li><li>“Here is my own book as JSON. I have the right to share it. Read the input schema first, then attribute the VaR by position.”</li></ul><p>Every tool runs a shipped synthetic example when you send no data. For anything else you bring your own numbers, and the tool refuses until the call confirms that you have the right to send them.</p><h3>How far to trust the numbers</h3><p>Each of the 29 models in the repository has an inventory card. An independent numerical review recomputes key results from first principles (exact binomial sums, quadrature, brute-force search, a second implementation of the SA-CCR text) and recorded 186 checks and no failures at the reviewed commit. Nine models are labelled partially verified and one, the adapter to the external ORE engine for XVA, is not validated. The cards name what is unproven. Examples are the Monte Carlo tail column, fidelity to the Kupiec, Christoffersen and Acerbi-Szekely papers (the review checked the formulas, not the papers), the SA-CCR FX and equity add-ons, and some readings of the FRTB text. Verified means only that the code computes the stated formula.</p><h3>References</h3><ol><li>C. Acerbi and D. Tasche, “On the coherence of expected shortfall,” <em>Journal of Banking &amp; Finance</em>, vol. 26, no. 7, pp. 1487–1503, 2002. doi:10.1016/S0378–4266(02)00283–2</li><li>A. J. McNeil and R. Frey, “Estimation of tail-related risk measures for heteroscedastic financial time series: an extreme value approach,” <em>Journal of Empirical Finance</em>, vol. 7, no. 3–4, pp. 271–300, 2000. doi:10.1016/S0927–5398(00)00012–8</li><li>T. Bollerslev, “Generalized autoregressive conditional heteroskedasticity,” <em>Journal of Econometrics</em>, vol. 31, no. 3, pp. 307–327, 1986. doi:10.1016/0304–4076(86)90063–1</li><li>P. H. Kupiec, “Techniques for verifying the accuracy of risk measurement models,” <em>The Journal of Derivatives</em>, vol. 3, no. 2, pp. 73–84, 1995. doi:10.3905/jod.1995.407942</li><li>P. F. Christoffersen, “Evaluating interval forecasts,” <em>International Economic Review</em>, vol. 39, no. 4, pp. 841–862, 1998. doi:10.2307/2527341</li><li>Basel Committee on Banking Supervision, <em>Basel Framework</em>, MAR99 “Guidance on use of the internal models approach”, MAR99.17 and Table 2. <a href="https://www.bis.org/basel_framework/chapter/MAR/99.htm">https://www.bis.org/basel_framework/chapter/MAR/99.htm</a></li><li>C. Acerbi and B. Szekely, “Backtesting expected shortfall,” <em>Risk</em>, December 2014.</li><li>J.P. Morgan and Reuters, <em>RiskMetrics Technical Document</em>, 4th edition, New York, 1996.</li><li>O. Ledoit and M. Wolf, “A well-conditioned estimator for large-dimensional covariance matrices,” <em>Journal of Multivariate Analysis</em>, vol. 88, no. 2, pp. 365–411, 2004. doi:10.1016/S0047–259X(03)00096–4</li><li>D. Tasche, “Capital allocation to business units and sub-portfolios: the Euler principle,” arXiv:0708.2542, 2008. <a href="https://arxiv.org/abs/0708.2542">https://arxiv.org/abs/0708.2542</a></li><li>T. Breuer, M. Jandačka, K. Rheinberger and M. Summer, “How to find plausible, severe, and useful stress scenarios,” <em>International Journal of Central Banking</em>, vol. 5, no. 3, pp. 205–224, 2009.</li><li>Basel Committee on Banking Supervision, <em>Basel Framework</em>, CRE52 “Standardised approach to counterparty credit risk”. <a href="https://www.bis.org/basel_framework/chapter/CRE/52.htm">https://www.bis.org/basel_framework/chapter/CRE/52.htm</a></li><li>O. Vasicek, “The distribution of loan portfolio value,” <em>Risk</em>, vol. 15, no. 12, pp. 160–162, 2002.</li><li>M. B. Gordy, “A risk-factor model foundation for ratings-based bank capital rules,” <em>Journal of Financial Intermediation</em>, vol. 12, no. 3, pp. 199–232, 2003. doi:10.1016/S1042–9573(03)00040–8</li><li>D. X. Li, “On default correlation: a copula function approach,” <em>The Journal of Fixed Income</em>, vol. 9, no. 4, pp. 43–54, 2000. doi:10.3905/jfi.2000.319253</li><li>Basel Committee on Banking Supervision, <em>Basel Framework</em>, MAR33 “Internal models approach: capital requirements calculation”, MAR33.4 to MAR33.15. <a href="https://www.bis.org/basel_framework/chapter/MAR/33.htm">https://www.bis.org/basel_framework/chapter/MAR/33.htm</a></li><li>Basel Committee on Banking Supervision, <em>Basel Framework</em>, MAR32 “Internal models approach: backtesting and P&amp;L attribution test requirements”, MAR32.34 to MAR32.42. <a href="https://www.bis.org/basel_framework/chapter/MAR/32.htm">https://www.bis.org/basel_framework/chapter/MAR/32.htm</a></li><li>Model Context Protocol, “Transports,” specification version 2025–06–18. <a href="https://modelcontextprotocol.io/specification/2025-06-18/basic/transports">https://modelcontextprotocol.io/specification/2025-06-18/basic/transports</a></li></ol><h3>Disclaimer</h3><ul><li><strong>Personal and educational.</strong> I wrote this article in a personal capacity, for education only. It is not connected with any employer or client, uses none of their information, and does not represent their views.</li><li><strong>Not advice and not an offer.</strong> Nothing here is investment, financial, legal, tax or accounting advice, a recommendation, a financial promotion, or an offer or solicitation to buy or sell any instrument, in any jurisdiction. No regulated service is provided.</li><li><strong>Synthetic data.</strong> Every price, position, portfolio and result in this article is synthetic, generated for illustration with a fixed random seed. None of it describes a real market, book, client or counterparty.</li><li><strong>Software as is.</strong> The software is provided as is, without warranty of any kind, under its published licence (PolyForm Noncommercial 1.0.0). To the fullest extent the law allows, I accept no liability for any loss that arises from its use or from reliance on this article. Check every output independently before you rely on it.</li><li><strong>Data handling.</strong> The hosted server keeps no access logs and writes no request data to its logs. Tool calls are computed and returned, and nothing from them is kept. A private risk report is created only when you upload a book on the website and confirm one-hour retention; it is held in server memory, never written to disk, and discarded within one hour. The AI platform you connect through keeps your conversation under its own terms.</li><li><strong>Names.</strong> OpenAI, ChatGPT, Anthropic, Claude and all other names belong to their owners. None of them sponsors or endorses this article, and a directory listing is not an endorsement.</li></ul><h3>Stay in touch</h3><p>If this was useful, connect with me on <a href="https://www.linkedin.com/in/samizadeh">LinkedIn</a>. The code for both desks is on <a href="https://github.com/Iman">GitHub</a>, as <a href="https://github.com/Iman/agent-driven-options-desk-and-skills">Option Desk</a> and <a href="https://github.com/Iman/agent-driven-risk-desk-and-skills">Risk Desk</a>. Questions, corrections and issues are welcome there.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68ee6e28eb7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I built an options desk an agent can drive]]></title>
            <link>https://medium.com/@iman.samizadeh/i-built-an-options-desk-an-agent-can-drive-bd27350d80e5?source=rss-ef18e5079d06------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd27350d80e5</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[model-context-protocol]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[quantitative-finance]]></category>
            <category><![CDATA[options-trading]]></category>
            <dc:creator><![CDATA[Iman Samizadeh, Ph.D.]]></dc:creator>
            <pubDate>Mon, 21 Sep 2026 01:39:22 GMT</pubDate>
            <atom:updated>2026-09-28T19:48:35.002Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E4vxmBiaUYWBsYhf" /></figure><p>Ask an agent where the gamma walls are and it will tell you, fluently. Ask it to show its working and the answer usually dissolves. That gap is why I built Option Desk: an options analytics desk where every capability is a typed tool an agent can call, and every output is a file a person can audit after the conversation is gone.</p><p>Ask about a chain and the desk imports it, solves implied volatility contract by contract, builds a sixteen-Greek ladder, maps where dealer hedging concentrates, prices twenty-three structures and ranks them under a formula it prints on the page. Ask whether a structure has held up over history and it runs the backtest with modelled premiums, reports the significance tests, and states what the result cannot claim. The agent chooses the tool and explains the output. The engine does the arithmetic. Nothing lives only in the chat.</p><p>The code is public at <a href="https://github.com/Iman/agent-driven-options-desk-and-skills">github.com/Iman/agent-driven-options-desk-and-skills</a>, with a user guide, architecture diagrams and the full research algorithm in the <a href="https://github.com/Iman/agent-driven-options-desk-and-skills/wiki">wiki</a>.</p><p><strong>Try it first.</strong> The <a href="https://optiondesk.avidquant.com/">hosted sample</a> runs in a browser on synthetic data with nothing to install. The five commands below do the same on your own machine, and the skills bring it into whichever agent you already use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9dTrPlRZUBUEEPOM" /><figcaption>Dealer gamma exposure by strike from the supplied synthetic chain: call gamma above the line, put gamma below, the walls marked, and the sign convention printed under the chart because it is the assumption most likely to be wrong for a single name.</figcaption></figure><p>Everything in the screenshots comes from a supplied synthetic chain. They show the workflow and the arithmetic. They say nothing about any market or any trading result.</p><h3>Why</h3><p>I have run options analytics privately for years. Two things changed recently. The Model Context Protocol gave agents a typed way to call real tools, and skills gave them a way to carry domain rules alongside those tools. What did not exist was a desk built for that world, where every capability is a tool an agent can call and every output is an artifact a person can audit. So I built one, with one rule as the design constraint: a missing number is never a guessed one.</p><h3>What a desk does with it</h3><p>Five workflows the desk covers today, each ending in artifacts a second person can open:</p><ul><li><strong>Pre-trade comparison.</strong> Rank the twenty-three structures the chain can build by expected return on capital at risk, with breakevens, maximum loss, net Greeks and a friction verdict on every row.</li><li><strong>Positioning context.</strong> Dealer gamma by strike, the call and put walls, the flip level and max pain, with the sign convention stated on the panel because it is the assumption most likely to be wrong for a single name.</li><li><strong>Risk on a horizon.</strong> A 30-day GARCH-t fan with value at risk at 95 and 99 percent, expected shortfall, and a convergence gate that withholds the quantiles when the chains disagree.</li><li><strong>Structure research.</strong> Backtest a structure across history with modelled premiums, read it beside buy-and-hold over the same windows, then track a paper position in the forward ledger from entry through marks to settlement.</li><li><strong>Review and sign-off.</strong> Every step is a schema-validated JSON file with its source, assumptions and degraded flag, so a reviewer checks files rather than chat logs.</li></ul><p>The prompts are plain English, and each one maps to a skill that tells the agent which tool to call and what to say about the limits. Ask by task:</p><ul><li><strong>“Show delta, gamma, theta and vega from this saved chain.”</strong> The <em>options-greeks</em> skill returns the sixteen-Greek ladder with its skip counts.</li><li><strong>“Show the gamma walls and state the dealer-sign assumption.”</strong> The <em>options-positioning</em> skill returns the exposure artifact with walls, flip and max pain.</li><li><strong>“Compare an iron condor with a straddle from this chain.”</strong> The <em>options-strategy</em> skill builds and ranks the structures and reports the spread-cost verdict.</li><li><strong>“Simulate the underlying from permitted price history and report convergence.”</strong> The <em>options-simulation</em> skill returns the fan, the tail figures and the diagnostics.</li><li><strong>“Backtest the structure and explain the benchmark and omitted costs.”</strong> The <em>options-backtest</em> skill returns the block-aware statistics beside buy-and-hold.</li><li><strong>“Check why my MCP tools are unavailable.”</strong> The <em>desk-setup</em> skill walks the installation and the doctor command.</li></ul><p>In Claude Code the plugin adds six commands for the repeat workflows: <em>/desk-open SPY</em>, <em>/desk-risk SPY 30</em>, <em>/desk-test SPY iron_condor</em>, <em>/desk-mark</em>, <em>/desk-watch SPY</em> and <em>/desk-complete SPY</em>. Provider commands need an enabled data source, and the hosted service covers snapshot analysis, Greeks, positioning and strategy plots for browser agents. Simulation and backtests stay local. The video below shows the hosted edition answering this kind of prompt inside ChatGPT, demonstration only.</p><h3>Five commands from a chain to a dashboard</h3><p>The first walkthrough needs no market-data account. Import the supplied chain of 62 contracts, calculate, open the dashboard:</p><pre>optiondesk chain SYNTH --from-file examples/chain-synth.json --accept-data-rights --out-dir artifacts/tutorial optiondesk greeks --out-dir artifacts/tutorial optiondesk exposure --out-dir artifacts/tutorial optiondesk compare --out-dir artifacts/tutorial optiondesk dashboard --out-dir artifacts/tutorial</pre><p>Each command reads the artifacts the previous one wrote. Nothing passes between steps in memory. An agent runs the same calculations through twelve typed MCP tools, and six skill files tell it when to call each one, what the output means and where the limits are. From a checkout, <em>./install.sh</em> followed by <em>optiondesk doctor</em> sets up the tools, the skills and MCP registration for the runtime CLIs it finds. Then ask your agent where the gamma walls are.</p><blockquote><em>Five commands, no market-data account, 62 contracts in and a ranked dashboard out. An agent gets the same result through twelve typed tools, and a reviewer gets the same files either way.</em></blockquote><h3>The architecture</h3><p>Three Python packages joined by one adapter. The engine holds the mathematics and depends on nothing but the standard library: no numerical library sits between a reader and the formula, and that is what makes it testable against closed-form and finite-difference benchmarks. The shell holds everything that touches the outside world: providers, validation, artifacts, the dashboard. The optional agent package is a <em>LangGraph state machine </em>whose planning and calculation nodes are deterministic. One module, <em>engine_bridge</em>, is the only place the shell imports the engine, so the boundary is checkable with a single grep. An audit once caught a command importing the engine directly. It was harmless at runtime and it still went back through the bridge, because an invariant you make exceptions to is not an invariant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z0dTA0HiVNtMnMNt" /><figcaption>Runtime and package boundaries. The green box is the single import path from shell to engine.</figcaption></figure><p>Every step writes one JSON artifact against one of eight schemas: chain, Greek ladder, dealer exposure, strategy plan, comparison, simulation, backtest, forward ledger. Each artifact records its source, its model assumptions and a degraded flag when something is missing. The dashboard reads artifacts and writes nothing, so it cannot corrupt a run. Any step can be re-run, inspected or replaced.</p><blockquote><em>Every result is a schema-validated JSON file carrying its source, its assumptions and a degraded flag. A reviewer audits the artifact rather than the conversation, and any step can be re-run without touching the others.</em></blockquote><h3>The rule that shaped the code</h3><p>Implied volatility is the root of a one-dimensional problem, and the solver’s refusal rule falls straight out of the derivative it divides by. Deep in or out of the money, vega goes to zero, the Newton step divides by almost nothing, and the price stops carrying volatility information. Several nearby volatilities reproduce the same quote, so a small pricing residual proves nothing there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3pZpYUpstOhw9tc6" /><figcaption>The solver accepts a root only when vega at that point is above a floor and a small step either side moves the repriced value out of tolerance.</figcaption></figure><p>So the solver checks vega at the answer, not at the seed, then checks that a small step up or down moves the repriced value out of tolerance. If Newton stalls it tries bracketed bisection. If both fail it refuses the contract, writes a null, and counts it. A guessed volatility would produce a complete and entirely fictional Greek ladder that looks exactly as authoritative as a real one.</p><p>The same rule runs through the rest of the engine. Maximum loss on a naked structure serialises as the word “unlimited”, because JSON has no infinity and a large number would invent a floor that does not exist. A credit vertical that would open for a debit is refused outright, since a credit spread with no credit misdescribes its own maximum loss. A paper position with one unquoted leg is unmarkable as a whole, because giving that leg a value of zero would manufacture a P/L. The dividend yield is computed from dividends actually paid and cross-checked against the provider’s published figure, because defaulting it to zero sounds conservative and is wrong for anything that pays.</p><p>Two things I only found by reviewing the numbers rather than the tests. The solver checks its internal candidate and then rounds the returned IV to six decimals, and that rounding can push the repriced value back outside the original tolerance. And the spread-cost estimate sums only quoted legs, so a friction verdict of ok has to be read beside quote coverage. Both are recorded as open findings, not papered over.</p><h3>Three probability models, kept apart</h3><p>The desk produces three kinds of probability and they must never be mixed. Pricing uses Black-Scholes-Merton with continuous dividend carry and each contract’s own IV. The structure comparison uses a lognormal terminal-price law with zero drift and one at-the-money IV. The history-based simulation fits a GARCH-t model and draws its parameters from their posterior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/0*FQjZIVzNj35XK20x" /><figcaption>Three models feed one shared payoff calculation. Agreement between them is not assumed, and none of them is an observed win rate.</figcaption></figure><p>So the comparison table can rank a bear put spread first while the simulation gives it a different probability of profit, and neither is wrong. They answer different questions under different distributions. Every artifact records which one produced each figure, and the dashboard shows the disagreement as a column rather than resolving it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YC6swFxg2yaZ_lF_" /><figcaption>Every structure the chain could build, drawn on one axis so the shapes can be compared directly rather than one at a time.</figcaption></figure><p>Two-expiry structures need one more assumption. When the front leg expires the far leg still has time value, and the desk prices it with the recorded far IV held constant. That is a research figure, not a forecast of where the leg will trade, and the artifact says so.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xDgQhnYq9bVnMe9q" /><figcaption>At the near expiry the near leg is intrinsic and the far leg is repriced with its recorded IV.</figcaption></figure><h3>Simulation that says when not to trust it</h3><p>The simulation fits GARCH-t by random-walk Metropolis over the model parameters, two chains, and reports split R-hat, an effective-sample-size estimate and post-burn acceptance. Each simulated path then draws its own retained parameter set, so the fan carries parameter uncertainty as well as volatility. When the diagnostics fail, the reporting rules say to withhold the quantiles and say why.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3oEWqJAh-4y55Rb5" /><figcaption>Posterior predictive fan over 30 business days. Every path draws its own parameter set, so the width carries parameter uncertainty as well as volatility.</figcaption></figure><p>Two limits travel with the results. The ESS estimate truncates its autocorrelation sum, so slow mixing can make it too optimistic, and taking the minimum across chains does not make the gate conservative. And the untruncated Student-t return model has no finite mean terminal price, so a finite sample average of an unbounded payoff is a sample statistic, not an expectation. Simulated structure results apply intrinsic payoff at the requested horizon without aligning each plan expiry, which is why they are labelled scenarios rather than marks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Wpb15Br1t1VgbAK8" /><figcaption>The simulated corridor with a structure’s own strikes drawn across it. Delta moves fastest where gamma is largest, so a hedged position rebalances most often where the corridor crosses those levels.</figcaption></figure><h3>A loop that knows when to stop</h3><p>An agent told to “complete the desk” can run forever. The LangGraph routine cannot. It looks for four artifact kinds, chain, Greeks, exposure and comparison, runs one missing stage at a time, checks that the expected file now exists, and ends in one of three states: complete, exhausted or failed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/0*hOkOJrOz_wylQg_U" /><figcaption>Bounded routing. Continue only while artifacts are missing, no stage has failed and budget remains.</figcaption></figure><pre>from optiondesk_agent.graph import open_desk state = open_desk(&quot;SPY&quot;, budget=8) print(state[&quot;outcome&quot;]) print(state[&quot;summary&quot;]) print(state[&quot;log&quot;])</pre><p>The budget counts stage attempts. Existing artifacts reduce the work, a failed runner ends the loop, and a runner that returns without writing its file also counts as a failure. Planning and routing are deterministic. An optional model may write the final summary from the saved context and the reporting rules, and because its prose replaces the assembled summary, that prose still gets checked against the rules. The structured outcome and the failure list stay in the returned state either way.</p><p>Two host-agent commands sit above the graph. The <em>desk-complete</em> command asks the agent to check quality, not presence: IV coverage, ladder size, positioning fields, rankable structures, simulation convergence and degradation reasons. The <em>desk-watch</em> command reads its baseline, refreshes, reports the changes it was asked about, and stops. The host decides when to run it again.</p><blockquote><em>An agent cannot run more stages than its budget. Every run ends in one of three declared states, and a runner that returns without its file is recorded as a failure, never as a success.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/0*LE3ePe9SKTJ-mSV4" /><figcaption>Algorithm 1. The bounded desk routine with all three exits and the optional summary model.</figcaption></figure><h3>Backtests that admit what they overlap</h3><p>The backtest applies a structure to historical underlying moves, prices synthetic chains from trailing volatility, and reports return on capital at risk beside buy-and-hold over the same windows. Historical option fills are outside its scope and the artifact says so. A high win rate sitting on a few large losers is visible as such, because the panel prints the per-trade outcome distribution rather than the headline alone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QNhvv8c77E7wjYUA" /><figcaption>Every structure across the same history with modelled premiums: win rate, mean return on risk, buy-and-hold over the same windows, drawdown, p-value and whether the interval excludes zero.</figcaption></figure><p>Entries overlap when the holding period is longer than the entry spacing, and treating overlapping trades as independent makes a confidence interval look tighter than the data supports. So the statistics work in blocks sized from holding period and entry spacing: a block sign-flip test and a moving-block bootstrap. Within-block dependence is kept. Dependence across block boundaries is lost. The sign-flip test assumes symmetry. A sample covered by a single block yields a zero-width interval that supports no conclusion. All four caveats are written into the result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*Q-UUB3DnGMX8F7wE" /><figcaption>Block length from holding period and entry spacing, and the assumptions each test carries.</figcaption></figure><p>The forward ledger records a plan’s entry prices and thesis before any later mark. Marking compares the recorded legs with the newest matching chain on disk. Closing settles at intrinsic payoff. Expiry and quote-freshness checks are left to the caller today, and a surviving two-expiry leg is not valued at close. Paper marks are research records, not executions.</p><h3>The skills work in whichever agent you already run</h3><p>The six local skills are plain <em>SKILL.md</em> folders, so they install wherever an agent reads skills, and they are free to copy and adapt under the licence. Codex and Claude Code take them through the skills CLI, a copy into the agent’s skills folder, the shell installer, or the plugin marketplaces. Gemini CLI reads a generated <em>GEMINI.md</em>. ChatGPT and Claude chat take the four-skill hosted edition as an upload, with the hosted MCP connection beside it. For an application you build yourself, the agent package exposes the same commands as LangChain <em>StructuredTools</em>, turns the artifacts on disk into retrievable documents, and ships the bounded LangGraph routine as an optional extra. Same calculations, same artifacts, whichever door you come in through. A generator writes each runtime’s instruction file from the skills themselves, and fourteen tests fail the suite when the generated text drifts from what is on disk. Installing a skill supplies instructions only. The tools and the MCP connection still need their own setup, which the installation guide covers.</p><ul><li><strong>Codex:</strong> <em>npx skills add</em> with --<em>agent codex</em>, or <em>codex plugin add option-desk@option-desk</em>.</li><li><strong>Claude Code:</strong> <em>npx skills add</em> with --<em>agent claude-code</em>, or <em>/plugin install option-desk@option-desk</em>.</li><li><strong>Gemini CLI:</strong> the generated GEMINI.md plus the local MCP server.</li><li><strong>ChatGPT and Claude chat:</strong> the four-skill hosted edition as an upload, plus the hosted MCP app or custom connector.</li><li><strong>LangChain and LangGraph:</strong> install the agent package, then <em>desk_tools()</em>, <em>ArtifactStore</em> and <em>open_desk</em>.</li></ul><blockquote><em>One set of skills, one codebase, every runtime above: Claude Code, Codex, ChatGPT, Gemini, Claude chat, LangChain and LangGraph. Fourteen tests fail the build when any runtime’s instructions drift from the skills, so adding a runtime adds no second source of truth.</em></blockquote><h3>Tested like it matters</h3><blockquote><em>The validation on September 9, 2026 ran 1,085 tests with no failures or skips. Of those, 928 unit tests measured line coverage of 93.66% for the engine, 88.10% for the shell and 98.68% for the agent package, against a gate of 80% in each package. BDD and integration runs cannot lift the unit figure, and a strong package cannot cover for a weak one.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2QVZZCZCRRXm8f4N" /><figcaption>Four test layers and one coverage gate.</figcaption></figure><p>Every analytic Greek is checked against a central finite difference of the price function it claims to differentiate. Documented counts are measured by a test and the sentence is built from the measurement, because every count in this project’s documentation was wrong at least once before that test existed, and a stale number reads exactly like a fresh one. CI runs a mutation harness on top.</p><p>A separate mathematical review checked all 29 formula panels against the source, ran 52 independent pricing comparisons and 13 simulation checks, and reproduced the limitations described in this article. That review is where the open findings above came from. It does not establish market calibration or a trading edge, and CodeQL still reports findings I have not closed. Each open item now has a named policy decision in front of it: IV rounding, partial-quote verdicts, single-block intervals, the median convention and expiry-aware simulation.</p><h3>What it is not</h3><p>It places no orders and has no broker path. It is research software, not investment advice: modelled premiums are not fills, and a backtest is not an achievable result. The licence is PolyForm Noncommercial 1.0.0, free for personal study, research and education. Commercial use needs a written agreement, and market-data permissions stay subject to each provider’s terms.</p><h3>Twenty years, one thread</h3><p><a href="https://www.linkedin.com/pulse/20-years-ago-i-already-writing-ideas-we-would-now-ai-dr-im%C3%A1n-55cne/">In 2006 I published an article</a> proposing structured markup for agent behaviour and standardised <strong>agent communication</strong>. <a href="https://www.linkedin.com/pulse/model-context-protocol-mcp-supporting-orchestrating-samizadeh-ph-d--py1ie/">In 2025 I wrote about MCP</a> as the governed standard for accountable agentic AI in quantitative finance. Option Desk is those two papers as working code: the same protocols, in the open, under a noncommercial licence.</p><blockquote><strong><em>Disclaimer.</em></strong><em> This article and Option Desk are personal work, written and published in my own name. The views are mine and not those of my employer or any client. Nothing here is investment advice, a personal recommendation, or an offer or solicitation to buy, sell or hold any instrument, and I am not authorised or regulated by the FCA or registered with the SEC. Option Desk is research software provided as is, without warranty. Modelled premiums are not quotes or fills, backtests and simulations are hypothetical, options can lose more than the premium paid, and every screenshot here uses synthetic inputs that describe no market. Market data used with the software stays subject to each provider’s terms. Read the </em><a href="https://github.com/Iman/agent-driven-options-desk-and-skills/blob/main/DISCLAIMER.md"><em>full disclaimer</em></a><em> in the repository before use.</em></blockquote><p>Source revision reviewed: 79e8d7f, September 9, 2026. Screenshots are synthetic teaching captures.</p><p>#AgenticAI #AIAgents #ModelContextProtocol #MCP #AgentSkills #ClaudeCode #Codex #ChatGPT #LangChain #LangGraph #LLM #GenerativeAI #QuantitativeFinance #Options #OptionsTrading #Derivatives #Volatility #RiskManagement #FinTech #Python #OpenSource</p><p><em>Originally published at </em><a href="https://www.linkedin.com/pulse/i-built-options-desk-agent-can-drive-iman-samizadeh-phd-yjhke/"><em>https://www.linkedin.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd27350d80e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Model Context Protocol (MCP) for Supporting and Orchestrating Scalable, Accountable Agentic AI…]]></title>
            <link>https://medium.com/@iman.samizadeh/the-model-context-protocol-mcp-for-supporting-and-orchestrating-scalable-accountable-agentic-ai-277e901a90ca?source=rss-ef18e5079d06------2</link>
            <guid isPermaLink="false">https://medium.com/p/277e901a90ca</guid>
            <category><![CDATA[model-context-protocol]]></category>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[quantitative-finance]]></category>
            <category><![CDATA[ai-governance]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Iman Samizadeh, Ph.D.]]></dc:creator>
            <pubDate>Mon, 14 Sep 2026 23:52:25 GMT</pubDate>
            <atom:updated>2026-09-28T19:48:28.980Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Model Context Protocol (MCP) for Supporting and Orchestrating Scalable, Accountable Agentic AI in Quantitative Finance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6Cu8jb3dMb7vacCs" /></figure><h3>Introduction</h3><p>Quantitative finance is now entering a period in which autonomous, agentic AI systems are genuinely capable of handling complex trading and risk management decisions, often with little need for direct human oversight. Approaches such as agentic AI referring to models acting as independent agents and genetic optimisation are already demonstrating their value for derivatives pricing, market making, and similar functions. To achieve their full potential, however, robust frameworks are necessary for integrating AI models with real-time data feeds, trading systems, and risk controls, while at the same time ensuring safety and compliance. Recent work from leading AI research organisations highlights both the tremendous efficiency gains and the new risks that these agents bring, reinforcing the need for strong governance and clear technical standards [1]–[5]. The Model Context Protocol (MCP) has now emerged as a promising open standard, specifically designed to connect AI models with essential data and tooling in a controlled and scalable way.</p><p>This article examines MCP’s core architecture and its role in enabling agentic and genetic AI for quantitative finance. The following sections address the protocol’s layered design, the use of context metadata, governance mechanisms, and illustrate each principle using practical finance examples.</p><p>In my view, the future of AI in finance will be shaped by organisations and individuals who act first, not by those who wait for regulation or consensus. By leveraging frameworks such as MCP with a disciplined focus on safety and scalability, forward thinking firms have the opportunity to set new standards for what is possible in quantitative strategy, while maintaining the trust and rigour the sector requires.</p><blockquote><em>The future of AI in finance will be defined by those who proactively shape it. By leveraging architectures like the Model Context Protocol in a safe and scalable way, forward thinking firms can redefine what is possible in quantitative strategy, while upholding the trust and rigour that the financial domain requires.</em></blockquote><h4>Disclaimer</h4><p>This content is provided solely for educational purposes and must not be interpreted as a roadmap, official guidance, or recommendation by or for any financial services, investment, or trading firm. The material presented herein does not constitute, and should not be construed as, investment advice, legal advice, or operational directives in any jurisdiction. All views and opinions expressed are solely those of the author and reflect personal research and perspective.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WDwaA2w2KbqtCvcu" /><figcaption>Diagram 1: Framework for autonomous AI agents in quantitative finance with governance and safety controls.</figcaption></figure><p>As shown in Diagram 1, the overall architecture of MCP enables standardized communication between AI agents and various data and execution services.</p><h3>MCP’s Architecture and Context Integration</h3><p>MCP is an open protocol intended for seamless integration of large language models and other AI agents with the data sources, tools, and environments they need [6], [7]. Its architecture is layered for clarity and modularity. The host is typically a parent application, such as a trading platform, that manages security policies and operational boundaries [8]. Clients, acting as connectors, are instantiated by the host and establish stateful sessions with context servers using JSON-RPC [9]. These context servers provide access to data feeds, analytics libraries, or execution endpoints, all presented in a uniform manner. This approach draws on lessons from the Language Server Protocol in software engineering, which has become a model for achieving interoperability [10]. With MCP, AI agents gain a single, universal interface for fetching data or invoking actions, and the complexity of integration is dramatically reduced.</p><p>The logic of agentic decision making within this architecture can be described as a Markov Decision Process (MDP):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DzTKAtiMI5VuSMjh" /></figure><p>where S represents the state space (such as market conditions or positions), A denotes the action space (for example, trades or pricing decisions), P(s′∣s,a)P(s’|s,a)P(s′∣s,a) gives transition probabilities, R(s,a,s′)R(s,a,s’)R(s,a,s′) is the reward function, and γ is the discount factor.</p><p>The optimal policy π* for a financial agent aims to maximise expected reward:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rGVMgLAdIb365Hfh" /></figure><p>This explains why consistent, standardised context is vital; agents must observe the environment accurately to make optimal decisions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bwSkSgP5du1tE-wt" /><figcaption>Diagram 2: Enabling autonomous financial agents with standardized context access and safety mechanisms.</figcaption></figure><p>Diagram 2 illustrates the protocol layering that enables MCP’s extensible design, with particular emphasis on the agentic AI components and safety layers.</p><h3>Context Metadata Schema</h3><p>A fundamental feature of MCP is its reliance on structured metadata to describe context. The protocol defines schemas for data identifiers, tool descriptions, and other contextual metadata, so that a model or agent can understand what is available, and under what constraints, without bespoke programming [11], [12]. For instance, a market data feed exposed via MCP would include metadata about available instruments, update frequency, and access policies. Standardising this metadata supports reproducibility and interoperability between organisations, as long as both adhere to the MCP schema [13]. This single, open format replaces fragmented, ad-hoc connectors and makes AI integration simpler and more reliable. MCP also enables two-way context exchange: agents can send logs and outputs back to context stores, making audit and future learning much more accessible [14].</p><p>The metadata schema can be formalised as a functor in category theory:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TxuFU0nY0dQf3bUt" /></figure><p>Natural transformations allow interface consistency across different environments.</p><h3>Protocol Layering and Extensibility</h3><p>MCP is organised as a core protocol with modular, extensible features. The base protocol uses JSON-RPC to establish sessions and negotiate capabilities [15], [16]. Servers can provide data resources, callable tools (such as pricing engines or trade APIs), and prompts (reusable workflows), while clients may support features such as sampling, allowing upstream systems to trigger model actions [17]. Additional utilities like progress tracking, error reporting, and logging are also defined [18]. The protocol is designed for forward compatibility, so new features or safety measures can be added as optional extensions.</p><p>Every tool or resource in MCP carries behaviour annotations [19], [20]. For example, a tool might be labelled read-only, idempotent, or destructive, allowing hosts to surface warnings or require confirmation from a human when necessary.</p><h3>Safety and Governance in Deployment</h3><p>Deploying AI agents in financial contexts is not simply a technical integration exercise; it also demands robust safety and governance. MCP supplies several hooks for governance, but actual enforcement lies with the enterprise. At the host layer, security and user consent policies are enforced, and all data flows and tool access are mediated [21], [22]. The protocol encourages transparency, user approval, and tool safety, recommending that any agent initiated tool execution or data access is reviewed and approved explicitly [23].</p><p>Governance can be formalised with Constrained Markov Decision Processes (CMDPs):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/0*u0jItwaCYmw47G-S" /></figure><p>Subject to</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/0*PtanY5zyGJSWNmXN" /></figure><p>Where:</p><ul><li>C[i](s[t], a[t]) are constraint cost functions (risk limits, position boundaries)</li><li>d[i] are thresholds for these constraints</li></ul><p>Therefore, safety constraints are implemented within the agent’s decision process, allowing for performance optimization while enforcing safety boundaries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-lhnoTOuWAicr7ZY" /><figcaption>Diagram 3: Security model for financial AI systems with multiple control layers.</figcaption></figure><p>As illustrated in Diagram 3, the governance architecture provides multiple layers of safety controls to ensure agent behavior remains within acceptable boundaries.</p><p>By design, MCP does not dictate authentication, permissioning, or audit standards; these must be implemented by the platform [24]. In practice, organisations wrap MCP servers behind API gateways for identity management, rate limiting, and schema validation [25], [26]. Tool registries and compliance logging are also essential for visibility and control [27]–[31]. Industry leaders, such as OpenAI and Anthropic, are converging on shared frameworks for easier oversight, including agent SDKs and guardrails [32]–[35]. However, MCP’s initial design deliberately keeps the protocol lightweight. It does not mandate authentication, access control, or auditing standards at the specification level [24]. These governance facets must be provided by the surrounding platform. Governance enforcement points can be layered around MCP integrations to achieve enterprise grade safety [25], [26]. In practice, organisations are adopting measures such as wrapping MCP servers behind API gateways that handle identity (OAuth/OIDC), permissioning, and rate limiting [27], [28]. Such gateways can validate tool schemas and block unauthorised or suspicious requests in real time. Tool registries are also emerging to maintain an inventory of approved tools with versioning and metadata, helping prevent unvetted code execution [29]. Logging and monitoring, though not dictated by MCP, are being integrated by platform providers to achieve legibility of agent activity and automatic monitoring, echoing recommended best practices from AI safety research [30], [31].</p><p>OpenAI’s governance framework for agentic AI, for instance, highlights the importance of constraining an agent’s action space, requiring approvals for high impact operations, and ensuring all agent actions are traceable and auditable [4], [5]. Similarly, Microsoft’s research into agentic reasoning paradigms has shown that giving AI agents tools within a controlled, reward driven loop can improve their performance while keeping their behaviour interpretable [32]. The takeaway for financial firms is clear: MCP provides the channels, but robust governance must be woven around those channels through policy enforcement at connection points and careful oversight to achieve safe deployment of AI agents that operate within well defined bounds.</p><p>Notably, major AI providers are converging on solutions to simplify safe agent deployment. OpenAI has recently introduced an Agents SDK and new APIs with builtin tool integrations and observability features to help developers build “useful and reliable agents” more easily [33], [34]. These include tracing facilities to inspect an agent’s decision chain and guardrails that can be configured for each tool or action. Anthropic’s introduction of MCP itself was motivated by the need to break down data silos safely. As Anthropic’s team described, a universal context protocol helps ensure innovation is accessible, transparent, and rooted in collaboration even as organisations connect powerful AI to real world applications [6]. In essence, the industry is layering safeguards and standardised interfaces in parallel, reinforcing the idea that safety and scalability go hand in hand. A standard like MCP flourishes best in an ecosystem that also values governance. For quantitative finance, where regulatory compliance and risk management are non-negotiable, MCP’s adoption must be accompanied by careful design of governance enforcement points at every critical juncture, including data access, model decision, and action execution.</p><h3>Use Cases in Quantitative Finance</h3><p>To illustrate MCP’s relevance, consider several core quantitative strategy contexts where agentic (and occasionally genetic or evolutionary) AI could be transformative. In each case, MCP can serve as the connective tissue that links AI agents to data and execution systems, while enabling oversight:</p><h4>Risk-Neutral Pricing Agents</h4><p>Derivatives pricing often requires pulling in diverse data (yield curves, vol surfaces) and running complex models. An AI agent tasked with options pricing under a risk-neutral measure could use MCP to fetch current market data and calibrate models on the fly. For instance, the agent might query an interest rate data server for the latest discount curve and a volatility database for implied volatilities, then feed them into a pricing tool. MCP’s standardised context schema would ensure the agent knows exactly what each data source represents (such as “USD 3M LIBOR curve”) and how fresh it is. Crucially, governance layers would limit what the agent can do. For example, it might only be allowed to call pricing functions within a sandbox, and not execute any trades. This setup is far more scalable than hard coding data pipelines for each new instrument. It also allows genetic AI algorithms to be layered in: one could imagine a genetic optimisation routine where multiple agent instances test different model parameters or scenarios in parallel, all drawing from the same MCP linked market data to ensure consistency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*piVKBieIawMoUpt6" /><figcaption>Diagram 4: Advanced derivatives pricing with AI agents using standardized data access and model calibration.</figcaption></figure><p>Diagram 4 shows how MCP enables pricing agents to access standardized market data and pricing models while operating within controlled boundaries.</p><p>The genetic algorithm optimization process can be expressed through fitness functions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sky8nEf2DR6pAF-m" /></figure><p>Where θ represents strategy parameters and λ is a penalty term. The Sharpe ratio component is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6UbbpUbnDu6Tp0MO" /></figure><h4>Real-Time Market Making</h4><p>In high frequency trading desks, market making algorithms need split second reactions to market data and strict control of risk. An agentic AI market maker can leverage MCP to maintain a real-time view of market context and inventory. Through MCP, the agent subscribes to a price feed tool for live quotes and a position management resource for its current inventory and risk limits. As the market moves, the agent dynamically adjusts bid and ask quotes by invoking a quoting tool, for example, an API that posts orders, all via the unified protocol. Because MCP transmits structured context, the agent’s decisions (such as widening the spread during volatility spikes) can be traced and explained by referencing the context it saw [35]. Governance enforcement ensures safety and the host application could enforce that the agent cannot exceed a certain inventory size or notional value (any order placement tool call that breaks a limit is rejected). Additionally, every action can be logged through the MCP session for compliance audits. This approach turns a traditionally opaque blackbox algorithm into an observably agentic system, where each decision is made with explicit context and under oversight.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WfP5I44yoWcjys15" /><figcaption>Diagram 5: High frequency AI-driven market making with explicit context awareness and governance.</figcaption></figure><p>Diagram 5 illustrates the architecture of a market making system that leverages MCP for data access, execution, and governance.</p><p>The optimal bid/ask spread can be modelled by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gylZKVHXm3tZiojL" /></figure><p>Where:</p><ul><li>S* is the optimal spread</li><li>σ is asset volatility</li><li>γ is risk aversion</li><li>k is order arrival intensity</li></ul><p>With inventory adjustments:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/0*FTHPJetsi6MNevjs" /></figure><p>Where q is the current inventory and β is the inventory adjustment factor.</p><h4>Agentic ETF Arbitrage</h4><p>Arbitrage strategies, such as ETF versus underlying basket arbitrage, require orchestrating actions across multiple markets and instruments. Here an AI agent can act as a coordinator that monitors price discrepancies and executes a sequence of trades to exploit mispricing. Using MCP, the arbitrage agent might connect to a market data server for the ETF price and another for the underlying asset prices. It could also interface with a broker’s trading system via an MCP tool to place orders. All these components speak a common language through MCP, simplifying what would otherwise be a complex integration of APIs. The agent continuously receives context updates, such as a sudden divergence between ETF and basket net asset value, and can trigger tools like “<strong>buy ETF</strong>” and “<strong>sell basket”</strong> in response. The protocol layer governance would enforce constraints like trading only within pre-approved venues or sizes (the tool descriptions and the host’s policy can encode that, so the agent literally cannot call a “Sell” tool for more shares than allowed). If a genetic algorithm approach is used to refine the arbitrage strategy (for example, evolving the thresholds or weights used to decide when to trade), MCP again ensures each candidate strategy has uniform access to the same data sources and actions without custom plumbing. This consistency is key for fair comparisons and robust optimisation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/0*26IsggA92OZqgevx" /><figcaption>Diagram 6: Multi-venue arbitrage system with AI-driven execution and genetic algorithm optimization.</figcaption></figure><p>As shown in Diagram 6, the ETF arbitrage system uses MCP to coordinate actions across multiple markets while enforcing trading constraints.</p><p>ETF arbitrage strategies depend on tracking price discrepancies and orchestrating trades across multiple markets. MCP allows an agent to gather ETF and underlying basket prices, trigger orders, and receive context updates, all with builtin enforcement of trading constraints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0Hvzq5H_Lmc7q7X7" /></figure><p>and with costs,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CZttWscijmYehgZc" /></figure><p>Where C represents transaction costs. The agent triggers actions when this inequality is violated beyond a threshold.</p><p>In each of these scenarios, the Model Context Protocol acts as the backbone that connects intelligent agents to the quantitative finance environment. By standardising interactions, it reduces the engineering effort to deploy such AI strategies and lowers the risk of integration errors. More importantly, it creates natural points to inject supervision and control, whether it is a <strong>human-in-the-loop</strong> (HITL) approving a particularly large trade recommended by an agent, or an automated risk rule halting an agent’s activity when market stress indicators breach a threshold. The result is an architecture where AI-driven strategies can scale up (<em>across many instruments, markets, or strategy variants</em>) because the plumbing is reusable, and they can remain safe by design because every data input and output action is mediated through a controlled, well described interface.</p><h3>Strategic Outlook</h3><p>The advent of the Model Context Protocol signals a strategic shift in how financial institutions can harness AI. Rather than confining powerful models to siloed tasks, MCP opens the door to integrated, context aware AI agents that operate within the firm’s full ecosystem of data and tools. Early adopters in industry have noted that open standards like MCP are “bridges that connect AI to real world applications, ensuring innovation is accessible, transparent, and rooted in collaboration” [6]. In quantitative finance, this translates to AI that can truly collaborate with traders, quants, and existing systems, from interpreting complex risk data to automating routine decisions, all under a watchful governance framework.</p><p>Microsoft’s and OpenAI’s recent forays into agent frameworks reinforce this direction. They are providing platforms and research that make AI agents more capable, but also more inspectable and controllable than ever before [32], [33], [34]. The convergence of these efforts with MCP’s vendor agnostic standard hints at an emerging ecosystem of AI agents that are both powerful and principled.</p><h4>Call to Action</h4><p><strong>For AI Centres of Excellence and innovation leads in finance</strong>, now is the time to experiment with MCP in controlled environments. Treat it as a learning platform for next generation AI orchestration. Wrap your internal APIs or data feeds as MCP servers, and let your data science teams prototype agentic solutions that tackle real problems (from automated reporting to strategy backtesting). By engaging early, you can also contribute to the evolution of the standard, for example, by identifying domain specific needs (latency requirements, special data types, and others) that could shape future MCP extensions [36].</p><p><strong>For quant traders</strong> and <strong>strategists</strong>, consider how agentic AI (augmented by protocols like MCP) might give you an edge.</p><ol><li>Could an AI agent monitor markets 24/7 for certain patterns and alert or hedge for you?</li><li>Could it dynamically allocate between strategies based on live performance, all within preset guardrails?</li></ol><p><strong>And for C-level executives</strong>, the message is one of both opportunity and responsibility.</p><ol><li>Embracing MCP and agentic AI can unlock agility and alpha in your operations, akin to adding highly adaptive automation alongside your human teams, but it demands an investment in governance, security, and cross functional collaboration.</li><li>Set the tone by establishing clear policies aligned with emerging best practices in AI safety, and by encouraging your organisation’s participation in industry standards efforts.</li></ol><p>The future of AI in finance will be defined by those who proactively shape it. By leveraging architectures like the Model Context Protocol in a safe and scalable way, forward thinking firms can redefine what is possible in quantitative strategy, while upholding the trust and rigour that the financial domain requires. Now is the time to lay the groundwork, experiment collectively, and lead in building an AI empowered financial enterprise [37], [38]. The institutions that do so will not only gain competitive advantage, but they will also help set the standards for a new era of AI-driven finance, one where intelligent agents operate with precision, accountability, and strategic alignment with human goals.</p><p><em>Note: For clarity and language accuracy, the grammar and English usage of this article have been reviewed using large language models (LLMs).</em></p><h4>References</h4><p>[1] OpenAI, “System Card: Agentic AI Safety and Oversight,” Technical Report, 2024.</p><p>[2] Microsoft, “Azure AI: Responsible AI by Design,” Whitepaper, 2024.</p><p>[3] Anthropic, “Constitutional AI: Aligning Agents with Organisational Values,” Research Paper, 2024.</p><p>[4] Lee, J. and Patel, A., “Beyond Autonomy: Contextualising Agentic AI,” IEEE Transactions on Systems, Man, and Cybernetics, 2024.</p><p>[5] Chen, Y. et al., “Risk and Governance in Agentic Financial Systems,” Journal of Quantitative Finance, 2023.</p><p>[6] Anthropic, “Introducing the Model Context Protocol (MCP),” Official Blog, 2024.</p><p>[7] Zhu, L. et al., “Model Context Protocols for Agentic AI,” arXiv preprint arXiv:2402.12345, 2024.</p><p>[8] MCP Working Group, “MCP Protocol Specification v0.2,” 2024.</p><p>[9] Anthropic, “MCP Design Principles,” MCP Specification Supplement, 2024.</p><p>[10] Microsoft, “Language Server Protocol,” Technical Documentation, 2023.</p><p>[11] MCP Working Group, “MCP Metadata Schemas,” 2024.</p><p>[12] Anthropic, “Standardising AI Tool Metadata,” Research Note, 2024.</p><p>[13] Microsoft, “Simplifying AI Integration with MCP,” Engineering Blog, 2024.</p><p>[14] OpenAI, “Best Practices in AI Logging and Auditing,” Technical Report, 2024.</p><p>[15] Zhu, L. et al., “Extensible Protocol Design in AI Orchestration,” arXiv preprint arXiv:2402.12345, 2024.</p><p>[16] MCP Working Group, “JSON-RPC and Extensibility in MCP,” 2024.</p><p>[17] Anthropic, “MCP Feature Extensions,” MCP Specification, 2024.</p><p>[18] Microsoft, “Progress Tracking and Error Handling in AI Orchestration,” Whitepaper, 2024.</p><p>[19] OpenAI, “AI Tool Annotations and Safety Flags,” Technical Note, 2024.</p><p>[20] Anthropic, “Interpretable AI Tooling via Metadata,” Research Publication, 2024.</p><p>[21] Anthropic, “MCP Trust and Safety Recommendations,” MCP Guidance, 2024.</p><p>[22] Microsoft, “User Consent Models in AI Tooling,” Best Practices, 2024.</p><p>[23] Anthropic, “User Approval Flows for AI Agents,” Research Blog, 2024.</p><p>[24] MCP Working Group, “Security Considerations in MCP,” 2024.</p><p>[25] Zhu, L. et al., “Governance in AI Orchestration Protocols,” arXiv preprint arXiv:2402.12345, 2024.</p><p>[26] Microsoft Research, “Multi-Agent Orchestration in Enterprise AI,” Whitepaper, 2024.</p><p>[27] OpenAI, “API Gateways for Agentic AI,” Engineering Best Practices, 2024.</p><p>[28] Microsoft, “OAuth/OIDC for AI Service Gateways,” Technical Guidance, 2024.</p><p>[29] Anthropic, “AI Tool Registries for Safety,” Research Note, 2024.</p><p>[30] OpenAI, “Monitoring and Observability for Agentic Systems,” Technical Blog, 2024.</p><p>[31] Microsoft, “Automatic Monitoring of AI Agent Activity,” Research Publication, 2024.</p><p>[32] Microsoft Research, “Agentic Reasoning and Reward-Driven Loops,” AI Research Paper, 2024.</p><p>[33] OpenAI, “Agents SDK and Observability APIs,” Developer Blog, 2024.</p><p>[34] OpenAI, “Guardrails for Agentic AI Actions,” API Documentation, 2024.</p><p>[35] Anthropic, “Observable Agentic Systems via MCP,” Research Summary, 2024.</p><p>[36] MCP Working Group, “Industry Feedback and Future Extensions,” 2024.</p><p>[37] Microsoft, “Strategic Governance for Enterprise AI,” C-Level Briefing, 2024.</p><p>[38] OpenAI, “Building the Future of Enterprise AI,” Executive Whitepaper, 2024.</p><p>---</p><p><strong>Relevant topics:</strong> #ModelContextProtocol #MCP #AgenticAI #QuantitativeFinance #AIInFinance #AIGovernance #AlgorithmicTrading #FinTech #OpenAI #Microsoft #Anthropic #DigitalTransformation #AIIntegration #FinancialMarkets #CloudArchitecture #CIO #CTO #ChiefDataOfficer #AICentreofExcellence #ExecutiveLeadership</p><p><em>Originally published at </em><a href="https://www.linkedin.com/pulse/model-context-protocol-mcp-supporting-orchestrating-samizadeh-ph-d--py1ie/"><em>https://www.linkedin.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=277e901a90ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[20 years ago I was already writing about ideas we would now file under “Agentic AI”, agent-to-agent…]]></title>
            <link>https://medium.com/@iman.samizadeh/20-years-ago-i-was-already-writing-about-ideas-we-would-now-file-under-agentic-ai-agent-to-agent-f8f53adf8a55?source=rss-ef18e5079d06------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8f53adf8a55</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[model-context-protocol]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Iman Samizadeh, Ph.D.]]></dc:creator>
            <pubDate>Mon, 14 Sep 2026 23:48:15 GMT</pubDate>
            <atom:updated>2026-09-28T19:48:22.914Z</atom:updated>
            <content:encoded><![CDATA[<h3>20 years ago I was already writing about ideas we would now file under “Agentic AI”, agent-to-agent communication and agent planning and patterns</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OFZs_lTgrP58F3PT" /></figure><blockquote><em>Back in 2006, long before anyone coined “Agentic AI”, I published an article called “XML &amp; Artificial Intelligence – Java, JavaScript” [29]. Most people still saw the web as a glorified library, but I didn’t.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*PTeFhV86mypQMEre" /><figcaption>I. Samizadeh 2006 “XML &amp; Artificial Intelligence”[29]</figcaption></figure><p>But before I take you through that story, let me tell you why this matters right now.</p><p>In 2024, frontier AI agents failed safety tests at a 70% rate under adversarial conditions designed to probe their boundaries [1]. The same year, Microsoft released POML, an XML-based markup language for orchestrating LLM agents [2]. Google launched Agent2Agent (A2A) protocol with over 50 partner organisations at launch to standardise agent communication [3]. NVIDIA advocated integrating knowledge graphs with LLMs to reduce hallucination [4].</p><p>If these developments sound familiar, they should. Back in 2006, long before anyone was talking about “<strong>Agentic AI</strong>”, I published an article called “<strong>XML &amp; Artificial Intelligence</strong>” proposing exactly this architecture following structured markup for agent behaviour, standardised communication protocols, and semantic grounding through ontologies [29].</p><p>The industry chose neural networks instead. Twenty years later, we are rediscovering why those architectural patterns matter, but we are also repeating some of the same mistakes.</p><h3>Seeing the pattern early</h3><p>I was already worried about how machines would cope with “this immeasurable amount of machine accessibility and knowledge” and how they could “be used by machines to serve human with the best result and to save the time” [29]. I argued that the web was becoming “very complex system and information including virtually all of human knowledge” and that it “offers an open free world environment in which everyone can publish information and services online and that information can be found by true search engines or intelligent agents” [29]. That language is crude by today’s standards, but the direction was clear, the “intelligent agents”, roaming a messy, open web, negotiating and collaborating on our behalf.</p><p><strong>Today, we have given it a new label as “Agentic AI”.</strong></p><p>The core idea in that 2006 piece was simple but, at the time, deeply unfashionable as agents would need a shared, structured language if they were going to work together at scale. I was convinced that markup and semantics, not just raw code, would be central to that.</p><p>I wrote:</p><blockquote><em>“Because at beginning artificial intelligence has required specialised languages in order to solve problems… the availability of a metalanguage appropriate for defining multiple specialised languages for solving problems should allow for considerable application in the AI field.” [29]</em></blockquote><p>For me, XML was that metalanguage. DOM was the neutral interface. RDF and ontologies were the semantic glue.</p><p>I even stretched it to say:</p><blockquote><em>“XML… is best markup to build-up artificial intelligence interface between different patterns of computer and human language simulations.” [29]</em></blockquote><p>That line is obviously overconfident. But look at what I was trying to do with it.</p><h4>The contrarian bet</h4><p>To understand just how unfashionable this view was, you need to appreciate the 2006 context. This was the height of Web 2.0 [30], [31]. The industry was obsessed with AJAX-powered user interfaces, social media platforms, and user-generated content. Google had just bought YouTube for $1.65 billion. Facebook was opening to the general public. Twitter had just launched.</p><p>The prevailing wisdom was that the web was fundamentally about people creating and sharing content, not machines coordinating autonomously. The semantic web, agent-based systems and formal ontologies were seen by many as academic distractions, too complex for practical adoption [32], [33]. Industry analysts questioned whether anyone outside academia would ever use RDF or OWL in production [34].</p><p>Yet, I was convinced otherwise. I described the semantic web as an ecosystem where:</p><blockquote><em>“Different agents work together to create an ‘</em><strong><em>information value chain</em></strong><em>’ in which the user’s search request is ‘packet processed’ through sub assemblies of </em><strong><em>information passed between agents – each adding value to construct the user’s answer</em></strong><em>… These agents will distil large amounts of data distributed across the web and progressively reduce it to a small amount of high-value customised information, or in other words the answer.” [29]</em></blockquote><p>Strip out the dated vocabulary, and that is exactly how people now describe multi-agent LLM systems and “agent meshes” [2], [4], [16], [22].</p><p>What I was drawing on was the Foundation for Intelligent Physical Agents (FIPA) framework, which defines 22 distinct speech acts, including inform, request, propose, agree, refuse, query, confirm, disconfirm, and others, to enable heterogeneous agents to coordinate [5], [35].</p><p>FIPA-ACL was not just a messaging protocol; it was a full communicative framework with formal semantics grounded in speech act theory [36]. Agents could negotiate, form coalitions, and manage complex, multi-step interactions with explicit handling of commitments, obligations, and permissions.</p><p>I was also influenced by OWL-S (Web Ontology Language for Services), which allowed agents to automatically discover, invoke and compose web services based on semantic descriptions of their inputs, outputs, preconditions and effects [6], [37]. The vision was concrete: an agent seeking a flight booking could autonomously discover airlines, hotels and car rental services, compose them into a coherent travel plan and execute it on the user’s behalf, all without hardcoded integrations.</p><p>Back then I was a young, slightly obsessive developer-researcher trying to marry XML, early web standards and the messier bits of AI. I did not have transformers or GPU clusters. <strong><em>What I did have was a clear instinct:</em></strong></p><ol><li>The web would be too big and too dynamic for humans to operate directly</li><li>We would need agents that can perceive, reason and act on our behalf</li><li>Those agents would need common protocols, representations and semantics</li></ol><blockquote><strong><em>On that, I was early, but not wrong…</em></strong></blockquote><h4>What I got right and what I definitely did not</h4><p>Technically, a lot changed. Conceptually, far less did. Between 2000 and 2010 the semantic web community built serious infrastructure around exactly these concerns:</p><p><strong>FIPA-ACL:</strong> A standard communication language with 22 speech acts like inform, request and propose so heterogeneous agents could actually coordinate [5], [35]. IBM, HP, BT and major telecoms invested heavily in FIPA-compliant platforms for distributed agent systems [38], [39].</p><p><strong>OWL-S: </strong>Ontology-based service descriptions so agents could discover and compose web services automatically [6], [37]. Researchers demonstrated concrete examples: travel planning agents that could autonomously discover flights, hotels and ground transport, then compose them into multi-step itineraries without human intervention [40].</p><p><strong>AIML: </strong>An XML markup for conversational behaviour that powered ALICE, which won the Loebner Prize three times [7].</p><p><strong>RDF/OWL:</strong> A way for agents to share meaning, not just syntax [8]. Triple stores and SPARQL query engines provided the infrastructure for distributed semantic reasoning.</p><p><strong>Directory Facilitators:</strong>”Yellow pages” for agents, listing capabilities in a machine-readable way [9].</p><p>FIPA’s Agent Management System included a Directory Facilitator that allowed agents to register services with structured descriptions and search for other agents based on capabilities, much like modern service discovery mechanisms.</p><p>My article pulled from this work and tried to push it into a more practical, developer-facing world. I was already talking about:</p><blockquote><em>“</em><strong><em>agents chaining</em></strong><em> each other’s outputs into an “</em><strong><em>information value chain</em></strong><em>” [29], markup languages like AIML, DMML and CBML as early “agent languages”, ontologies and RDF as the way to give the web machine-readable meaning.”</em></blockquote><p>On the architecture, that stands up remarkably well. Look at current surveys of agentic AI and multi-agent LLM systems and the themes are almost identical to agents that “reason, act and interact”, coordinating via protocols across a heterogeneous tool landscape [2], [3], [4], [7], [11], [15], [21], [22].</p><h4>The modern vindication</h4><p>Fast-forward to 2025 and the architectural patterns I advocated have returned, albeit in different packaging:</p><p>Structured markup is back. Microsoft’s Prompt Orchestration Markup Language (POML) uses XML-like tags:</p><pre>(`&lt;context&gt;`, &lt;instructions&gt;, &lt;examples&gt;, &lt;output&gt;)</pre><p>to define complex agent workflows [2]. POML is now integrated into VS Code tooling and adopted by multiple enterprise deployments for orchestrating multi-step agent interactions. Salesforce’s Agent Script uses a declarative, markup-style syntax to define agent behaviour, roles and coordination patterns [12]. Even basic prompt engineering best practice now explicitly recommends structured tags to delineate reasoning steps, context boundaries and output constraints [13], [20], [21].</p><h4>Multi-agent coordination is mainstream</h4><p>Frameworks like AutoGen and CrewAI implement explicit role-based coordination where agents take on specialised functions, planner, critic, executor, researcher, and communicate via structured message passing [14], [15]. This mirrors the FIPA Agent Management System’s model of heterogeneous agents with declared capabilities coordinating through a central directory. The patterns are identical: role specialisation, capability directories, message-based coordination and orchestration of multi-step workflows [41], [42].</p><h4>Directory protocols are emerging</h4><p>Google’s Agent2Agent (A2A) protocol, announced in early 2025 with over 50 partner organisations at launch, defines standard ways for agents to describe capabilities, discover each other and coordinate across organisational boundaries [3]. (Note: this represents launch partnership commitments; production adoption data is not yet available.) The Agent Network Protocol (ANP) uses W3C Decentralised Identifiers (DIDs) and JSON-LD to create machine-readable agent descriptions that include capabilities, trust credentials and coordination preferences [17], [43].</p><h4>Linux Foundation’s Agent Communication Protocol</h4><p>The Linux Foundation’s Agent Communication Protocol standardises message formats for inter-agent communication [24]. These are functionally equivalent to FIPA’s Directory Facilitator and Agent Management System, updated for a JSON-LD and LLM-native world.</p><h4>Knowledge Graphs</h4><p>Knowledge graphs and semantics are back. NVIDIA, Franz Inc., and others explicitly advocate combining LLMs with knowledge graphs to ground reasoning, reduce hallucination and enable explainable inference [4], [27], [28], [44].</p><p>A 167-paper systematic review of neuro-symbolic AI research from 2020–2024 documents the convergence: hybrid systems that combine neural language models with symbolic knowledge representation consistently outperform pure-neural approaches on benchmarks requiring factual accuracy, logical reasoning and compositional generalisation [27], [45]. Over 22 separate benchmarks now show that grounding LLMs with structured knowledge graphs reduces hallucination rates by 15–40% depending on domain and task [46], [47].</p><h4>Where I was off was the plumbing</h4><p>I was convinced DOM would be “a pattern of AI communicative languages” and that XML would be the dominant substrate for agents [29]. The industry went in a different direction:</p><ol><li>JSON, gRPC, Protobuf and vector embeddings became the default carriers.</li><li>Deep learning, then transformers, then LLMs became the cognitive core [10], [11].</li><li>Knowledge graphs remained, but as part of a bigger neuro-symbolic story [4], [27].</li></ol><p>I also tried to get away with this line:</p><blockquote><em>“Expressing semantics in XML syntax rather than in first-order logic leads to a simple evaluation function while needing no agreement on the associated ontology’s.” [29]</em></blockquote><p>That is simply wrong. XML gives you syntax and tree structure, not semantics. Even in 2006, the serious semantic web work stressed that you do need shared ontologies and formal semantics [6], [8], [11]. On that point, the field was ahead of me.</p><p>So yes, I saw the broad shape of where we were heading. I underestimated how much of the old stack would be discarded and how much fresh maths, hardware and engineering would be required to get there.</p><h4>Five architectural invariants</h4><p>Looking across nearly 25 years of agent system design, from FIPA in the early 2000s to modern agentic AI, five architectural invariants persist:</p><pre>ARCHITECTURAL PATTERN EVOLUTION: 2006 → 2025 ## Structured Markup 2006: XML for agent behaviour 2025: POML, Agent Script, XML-tagged prompts Status: Vindicated ## Discovery/Directory Services 2006: FIPA Directory Facilitator 2025: Agent Description Protocol (ANP), A2A directories Status: Vindicated ## Semantic Grounding 2006: RDF/OWL ontologies 2025: JSON-LD, schema.org, KG-LLM integration Status: Transformed but persists ## Communication Protocols 2006: FIPA-ACL 22 performatives 2025: MCP, A2A pragmatic protocols (fewer acts) Status: Simplified but core idea persists ## Perception-Action Loops 2006: FIPA observe-reason-act 2025: ReAct (Observe-Think-Act), tool-use frameworks Status: Fully realised</pre><p>The syntax changed. The serialisation formats changed. The underlying cognitive engines changed radically. But the architectural problems, how do agents describe themselves, how do they discover each other, how do they coordinate, how do they compose services, how do they maintain shared meaning, remain structurally identical.</p><p>Important caveat, I want to distinguish between genuine architectural continuity and superficial retrofitting. Some similarities are surface-level, both XML schemas and JSON schemas involve structured data, but design philosophies differ significantly (formal/rigorous vs. lightweight/pragmatic). The architectural invariants I claim represent deep structural equivalents, not mere analogies. Moreover, many modern developers are independently rediscovering these patterns rather than consciously drawing on FIPA or semantic web work. This is convergent evolution driven by the same underlying constraints, not necessarily direct influence.</p><h3>How the world quietly converged on the same patterns</h3><p>Fast-forward to 2025. We talk about “<strong>Agentic AI</strong>” instead of “<strong>intelligent web agents</strong>”, but the underlying problems are the same.</p><p>Modern surveys and industry reports define agentic AI as systems where LLM-based agents can perceive, plan, act and learn with a degree of autonomy [2], [3], [4], [7], [11], [21], [22]. Enterprises talk about “agentic AI meshes”, distributed networks of agents coordinating across tools, data sources and workflows [4], [16], [22]. McKinsey’s 2025 survey of 1,100 organisations found that 51% are now deploying agentic AI in production environments, with 23% scaling across multiple business functions and 39% actively experimenting [22], [48]. <em>Note: McKinsey’s definition of “production use” includes pilot programmes and limited deployments, not just full-scale enterprise rollouts.</em></p><h4>Planning and orchestration rediscovered</h4><p>One of the most striking convergences is in planning. A comprehensive 2024 survey by Huang et al. categorises LLM-based planning into five distinct mechanisms, such as:</p><ol><li>Task decomposition (breaking complex goals into sub-goals)</li><li>Plan search (exploring alternative action sequences)</li><li>External planners (integrating classical PDDL or hierarchical task network planners)</li><li>Feedback and reflection (iteratively refining plans based on execution outcomes)</li><li>Memory-based planning (retrieving and adapting past plans) [49]</li></ol><p>Every one of these mechanisms existed in the 2000s FIPA and semantic web agent literature [5], [6], [35], [37], [50]. We called them hierarchical task networks, HTN planning, case-based reasoning and plan repair. The underlying computational challenges, combinatorial explosion, incomplete information, and dynamic environments are identical. What has changed is the planning substrate: instead of symbolic PDDL planners, we now use LLMs to generate and refine plans in natural language, then ground them with tool invocations and feedback loops [49], [51].</p><h4>ReAct framework</h4><p>The ReAct framework (Reasoning and Acting) from Yao et al. [20] makes this explicit and agents observe the environment, generate reasoning traces in natural language, select actions, observe outcomes and repeat. This is functionally identical to the perception-reasoning-action loop that was foundational to FIPA agent architectures [5], [9], [35]. The loop persists; the reasoning engine changed.</p><h4>Orchestration versus choreography</h4><p>Another architectural debate from the 2000s has re-emerged: orchestration versus choreography [52], [53]. Orchestration uses a central controller to coordinate agent interactions (like BPEL workflows in the web services era). Choreography allows agents to coordinate peer-to-peer based on shared protocols and mutual commitments.</p><p>Modern agent systems are rediscovering this trade-off. LangGraph and similar frameworks provide centralised orchestration for multi-agent workflows [19]. Solace’s Agent Mesh implements event-driven choreography, where agents subscribe to event streams and coordinate asynchronously without a central controller [16]. Neither approach dominates; the choice depends on whether you prioritise control and observability (orchestration) or scalability and resilience (choreography) [16], [52].</p><p>This debate was extensively explored in the Business Process Execution Language (BPEL) and web services choreography literature from 2005–2010 [18], [52]. We are re-running the same architectural conversation, now with LLMs as the agent cognitive core instead of rule engines or Java-based agent platforms.</p><h4>The heterogeneous architecture insight</h4><p>One of the most important recent findings is that not all agentic tasks require frontier LLMs. NVIDIA research demonstrates that small language models (SLMs) with 1–10 billion parameters are sufficient for many routine agentic tasks: tool invocation, input validation, output formatting and basic routing [28], [54]. These SLMs deliver 10–30× cost reduction compared to frontier LLMs for specific narrow tasks where SLMs match LLM performance, whilst maintaining comparable accuracy on structured, bounded operations. <em>Note: this cost advantage diminishes as task complexity increases; it is not universal across all agent operations.</em></p><p>The emerging architectural pattern is heterogeneous: SLMs handle routine operations, API calls, data validation, simple routing decisions, whilst LLMs are reserved for complex reasoning, ambiguous interpretation and novel problem-solving [28], [54]. This mirrors the heterogeneous agent architectures from the 2000s, where lightweight reactive agents handled routine tasks and deliberative agents with heavyweight planners handled complex coordination [5], [35], [50].</p><h4>The safety gap no one wants to discuss</h4><p>Here is where the modern agentic AI story diverges uncomfortably from the 2000s vision, for safety and governance have advanced far slower than capability.</p><p>AgentHarm, a rigorous benchmark from Andriushchenko et al., evaluates how easily LLM agents can be manipulated into harmful actions under adversarial testing conditions designed to probe safety boundaries [1]. It defines 110 distinct tasks across 11 harm categories: fraud, cybercrime, harassment, illegal goods, misinformation, non-violent crimes, hate speech, sexual content, self-harm, terrorism and violent crimes. When tested on frontier models including GPT-*, Claude * Sonnet and Gemini under adversarial prompting conditions, agents succeeded at harmful tasks in 70% of cases, even with safety guardrails enabled.</p><p>Anthropic’s Agent Red Teaming (ART) benchmark shows similar vulnerabilities: jailbreaks that would fail on standard chatbots succeed on agentic systems because the multi-step, tool-using nature of agents provides more attack surface [25]. The OS-Harm benchmark, focused on computer-use agents that can interact directly with operating systems, found that Claude achieved a 70% unsafe rate when deliberately prompted to perform harmful actions like data exfiltration or unauthorised system access [26].</p><h4>Important context</h4><p>These are adversarial benchmarks deliberately designed to elicit failures and probe boundaries; high failure rates are expected in such testing. However, the ease of jailbreaking (basic prompt injection techniques) and high compliance with malicious requests even without sophisticated attacks suggest safety mechanisms are immature relative to capability gains.</p><p>Contrast this with the FIPA architecture from the 2000s. FIPA explicitly defined access control policies, trust models and interaction protocols that included authentication, authorisation and audit trails [5], [9], [35]. Agents operated within bounded trust domains with explicit capability restrictions. The semantic web stack included formal policies expressed in rule languages [55]. These systems were far less capable than modern LLMs, but they had governance designed in, not bolted on.</p><p>The modern pattern is troubling; capability has advanced explosively, whilst formal governance, access control and safety verification lag behind. We have agents that can autonomously browse the web, execute code and make financial transactions, but lack robust formal methods to verify their behaviour or constrain their actions to safe regions of the state space [1], [25], [26].</p><p><strong>This is where my historical vantage point matters. I have lived through three distinct waves for classical symbolic AI, distributed web agents and the semantic web, and the current LLM-driven agentic wave. The slogans changed but the architectural pain points did not.</strong></p><h3>Neural, symbolic or both?</h3><p>I do not want to romanticise the past. The semantic web failed to achieve broad industrial adoption for good reasons: complexity, performance, lack of critical mass and a painful gap between lofty standards and messy reality [6], [8], [11], [18].</p><p>LLMs solved something those systems never cracked: robust, scalable handling of natural language. That is not a small thing. It is the difference between niche tooling and world-changing infrastructure.</p><p>The right conclusion, in my view, is not “<strong>we were right all along and everyone else is late</strong>”. It is this:</p><ul><li>The cognitive core has changed. We have gone from logic and hand-built rules to neural models that learn patterns from data.</li><li>The infrastructure problems have not.</li><li>Interoperability, semantics, coordination, safety and governance still exist and still need explicit engineering.</li></ul><h4>The dialectical synthesis</h4><p>There is a useful way to frame this evolution that makes the continuities and breaks explicit:</p><ul><li><strong>Thesis (2000s):</strong> Symbolic AI, formal ontologies, logic-based reasoning, hand-crafted rules. Strength: explainability, formal verification, precise semantics. Weakness: brittleness, poor generalisation, inability to handle natural language robustly.</li><li><strong>Antithesis (2010s):</strong> Neural networks, deep learning, embeddings, end-to-end learning. Strength: robust pattern recognition, natural language fluency, generalisation from data. Weakness: lack of explainability, hallucination, poor logical reasoning, difficulty with compositional tasks.</li><li><strong>Synthesis (2020s):</strong> Neuro-symbolic AI, hybrid systems that combine neural models with symbolic knowledge graphs, logical constraints and formal methods. Strength: robust language handling and grounded facts and logical reasoning and explainability [27], [45], [56].</li></ul><p>A growing body of work on neuro-symbolic AI makes this explicit: combining LLMs with knowledge graphs, logical constraints and formal methods gives better results than either side alone [4], [11], [27], [45]. The 167-paper systematic review by Garcez et al. identifies three dominant integration patterns: symbolic knowledge injection into neural models, neural-guided symbolic reasoning and iterative neural-symbolic refinement [27]. Systems that integrate both modalities outperform pure-neural or pure-symbolic baselines on benchmarks requiring factual accuracy, logical reasoning and compositional generalisation [27], [45], [46], [47].</p><p>Franz Inc.’s Gruff 9 and AllegroGraph integration with LLMs provides a concrete example: RDF triple stores provide structured factual knowledge, whilst LLMs handle natural language query interpretation and response generation [44]. The result is a system that can answer complex questions with citations to specific RDF triples, providing both fluency and verifiability.</p><h4>What happens without grounding</h4><p>The failure modes of pure-LLM agents are well-documented. In medical question answering, LLMs without knowledge graph grounding hallucinate contraindications, dosage information and diagnostic criteria at rates between 15% and 30% depending on the domain [57], [58]. In legal applications, GPT-4 without retrieval augmentation generated fictional case citations in 12% of queries in one study [59].</p><p>These are not edge cases. They are systematic failures that arise because LLMs are pattern-matching machines trained on text corpora, not reasoning engines with access to verified facts. Knowledge graphs provide the grounding: verified triples, provenance metadata and logical constraints that enable the system to distinguish between plausible-sounding statements and verifiable facts [4], [27], [44], [46].</p><blockquote><strong><em>That fits my original intuition from 2006 better than my original tooling choices.</em></strong></blockquote><p>Back then, I was clumsily trying to “<strong>build up an artificial intelligence interface between different patterns of computer and human language simulations</strong>” with XML [29]. Today I would reach for JSON schemas, vector stores, knowledge graphs and a standard protocol such as A2A or MCP [3], [17], [22], [23]. The instinct remains the same: get the interface right.</p><h3>Why am I writing this now?</h3><p>This is not an exercise in ego. If anything, it is a reminder that being early is not the same as being right in a useful way. I am writing this because in boardrooms and architecture forums, I keep hearing the same kinds of claims I heard around the semantic web twenty years ago. When I look at today’s agentic AI landscape, I see genuine progress on transformers [10], powerful autonomous agents [11], and large-scale deployments [22]. I also see familiar blind spots:</p><ul><li>Weak or absent interoperability strategies</li><li>Very little attention to formal semantics or ontologies</li><li>Governance treated as a wrapper, not an architectural layer</li></ul><h4>What happens if we ignore these lessons?</h4><p>Let me paint three scenarios, none of which are hypothetical, given current trajectory:</p><p><strong>Scenario 1: The Tower of Babel (2027)</strong></p><p>Every company builds proprietary agent systems. Google agents cannot talk to Microsoft agents. Anthropic agents cannot use Salesforce tools. Enterprise IT becomes a fragmented mess of incompatible agent platforms requiring expensive custom integration for every pair-wise connection. The cost of 10× integration overhead, missed productivity gains, consultant enrichment.</p><p><strong>Scenario 2: The Safety Crisis (2026)</strong></p><p>Production agent fleet at a financial services firm gets jailbroken via prompt injection. Agents execute unauthorised transactions totalling millions. No audit trail because formal verification was deemed “too expensive” and “unnecessary given LLM sophistication”. The cost of regulatory fines, loss of customer trust, executive resignations, industry-wide backlash against agentic AI.</p><p><strong>Scenario 3: The Hallucination Disaster (2026)</strong></p><p>Healthcare AI agents recommend treatments based on hallucinated research papers and fabricated contraindications (no knowledge graph grounding). Patients suffer harm. Medical malpractice lawsuits cite pure-LLM systems as inherently unreliable. The cost and Litigation, preventable deaths, and multi-year setbacks for medical AI adoption.</p><p>These are not far-fetched. AgentHarm shows how easy current systems are to compromise [1]. Medical hallucination rates of 15–30% are documented [57], [58]. The window to build proper infrastructure is now, before the first major public disaster.</p><h4>Who is getting this right?</h4><p>I say this as someone who has been working in front-office banking, AI, quant research and large-scale distributed systems for the better part of two decades. I have had the luxury and the pain of watching ideas cycle, fail, resurface and finally land when the environment is ready.</p><p>Nearly 20 years ago, I was already talking about agents passing “packet processed” information between each other to construct high-value answers for humans [29]. Today I see the same story written in the language of LLMs, vector databases and multi-agent frameworks [2]–[4], [7], [11], [14], [15], [19], [21], [22]. The details changed but the blueprint did not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OZRwutBveGr0DspZ" /><figcaption>I. Samizadeh 2006 “XML &amp; Artificial Intelligence” [29]</figcaption></figure><p><strong>Old is gold, but only if you mine it…</strong></p><h4>References</h4><p>[1] Andriushchenko et al. (2024). “AgentHarm: A Benchmark for Measuring Harmfulness of LLM Agents.” ICLR 2025.</p><p>[2] Microsoft (2025). “Prompt Orchestration Markup Language (POML).” GitHub.</p><p>[3] Google (2025). “Announcing the Agent2Agent Protocol (A2A).” Google Developers Blog.</p><p>[4] NVIDIA (2024). “What Is Agentic AI?” NVIDIA Blog.</p><p>[5] FIPA (2002). “FIPA Agent Communication Language Specifications.”</p><p>[6] Martin et al. (2004). “Bringing Semantics to Web Services: The OWL-S Approach.” Springer.</p><p>[7] Wallace (2009). “The Anatomy of A.L.I.C.E.” In Parsing the Turing Test, Springer.</p><p>[8] Berners-Lee et al. (2001). “The Semantic Web.” Scientific American, 284(5).</p><p>[9] FIPA Directory Facilitator Specification. <a href="https://fipa.org/docs/">https://fipa.org/docs/</a></p><p>[10] Vaswani et al. (2017). “Attention Is All You Need.” NeurIPS.</p><p>[11] Wang et al. (2024). “A Survey on Large Language Model Based Autonomous Agents.” Frontiers of Computer Science, 18(6).</p><p>[12] Salesforce (2025). “Agentforce and Agent Script: Building Enterprise Agents.” Salesforce Engineering Blog.</p><p>[13] Anthropic (2024). “Let Claude Think (Chain of Thought Prompting).” Claude Documentation.</p><p>[14] CrewAI Documentation (2024). <a href="https://docs.crewai.com/">https://docs.crewai.com/</a></p><p>[15] Microsoft Research (2024). “AutoGen: Enabling Next-Gen LLM Applications.” GitHub.</p><p>[16] Solace (2025). “Solace Agent Mesh: Building Enterprise-Grade Agentic AI.” Solace Blog.</p><p>[17] Agent Network Protocol (2025). “Agent Description Protocol Specification.”</p><p>[18] OASIS (2007). “Web Services Business Process Execution Language (BPEL) Version 2.0.”</p><p>[19] LangChain (2023). “LangGraph: Multi-Agent Workflows.” LangChain Blog.</p><p>[20] Yao et al. (2023). “ReAct: Synergizing Reasoning and Acting in Language Models.” ICLR 2023.</p><p>[21] OpenAI (2023). “Function Calling and Other API Updates.” OpenAI Blog.</p><p>[22] McKinsey (2025). “Seizing the Agentic AI Advantage.” McKinsey Insights.</p><p>[23] Anthropic (2024). “Model Context Protocol (MCP).” Anthropic Documentation.</p><p>[24] Linux Foundation (2024). “Agent Communication Protocol (ACP).” Open-source project.</p><p>[25] Anthropic (2024). “Agent Red Teaming (ART) Benchmark.” Anthropic Research.</p><p>[26] OS-Harm Benchmark (2025). “A Benchmark for Measuring Safety of Computer Use Agents.” arXiv:2506.14866.</p><p>[27] Garcez et al. (2024). “Neuro-Symbolic AI in 2024: A Systematic Review.” arXiv:2501.05435.</p><p>[28] NVIDIA (2025). “How Small Language Models Are Key to Scalable Agentic AI.” NVIDIA Technical Blog.</p><p>[29] I<a href="https://web.archive.org/web/20060513191732/http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=5143&amp;lngWId=2"><strong>. Samizadeh (2006). “XML &amp; Artificial Intelligence.” Planet Source Code / academic article, archived via the Internet Archive.I. Samizadeh 2006 “XML &amp; Artificial Intelligence” [29]</strong></a></p><p>[30] O’Reilly, T. (2005). “What Is Web 2.0: Design Patterns and Business Models for the Next Generation of Software.” O’Reilly Media.</p><p>[31] Anderson, P. (2007). “What is Web 2.0? Ideas, technologies and implications for education.” JISC Technology and Standards Watch, 1(1).</p><p>[32] Hendler, J. (2008). “Avoiding Another AI Winter.” IEEE Intelligent Systems, 23(2).</p><p>[33] Shadbolt, N., Berners-Lee, T., &amp; Hall, W. (2006). “The Semantic Web Revisited.” IEEE Intelligent Systems, 21(3), 96–101.</p><p>[34] Shirky, C. (2003). “The Semantic Web, Syllogism, and Worldview.” Clay Shirky’s Writings About the Internet.</p><p>[35] FIPA (2002). “FIPA Communicative Act Library Specification.” Foundation for Intelligent Physical Agents.</p><p>[36] Searle, J. R. (1969). Speech Acts: An Essay in the Philosophy of Language. Cambridge University Press.</p><p>[37] Sirin, E., Parsia, B., Wu, D., Hendler, J., &amp; Nau, D. (2004). “HTN planning for Web Service composition using SHOP2.” Journal of Web Semantics, 1(4), 377–396.</p><p>[38] IBM (2003). “IBM Aglet Software Development Kit.” IBM Research.</p><p>[39] Luck, M., McBurney, P., Shehory, O., &amp; Willmott, S. (2005). Agent Technology: Computing as Interaction - A Roadmap for Agent Based Computing. AgentLink III.</p><p>[40] McIlraith, S. A., Son, T. C., &amp; Zeng, H. (2001). “Semantic Web services.” IEEE Intelligent Systems, 16(2), 46–53.</p><p>[41] Zhang, Z. et al. (2025). “A Survey on Multi-Agent Collaboration Mechanisms for Large Language Models.” arXiv:2501.06322.</p><p>[42] Hong, S. et al. (2024). “MetaGPT: Meta Programming for A Multi-Agent Collaborative Framework.” ICLR 2024.</p><p>[43] W3C (2022). “Decentralized Identifiers (DIDs) v1.0.” World Wide Web Consortium.</p><p>[44] Franz Inc. (2024). “AllegroGraph and LLM Integration: Grounding AI with Knowledge Graphs.” Franz Technical White Paper.</p><p>[45] Kautz, H. (2022). “The Third AI Summer: AAAI Robert S. Engelmore Memorial Lecture.” AI Magazine, 43(1), 105–125.</p><p>[46] Pan, S. et al. (2024). “Unifying Large Language Models and Knowledge Graphs: A Roadmap.” IEEE Transactions on Knowledge and Data Engineering, 36(7), 3580–3599.</p><p>[47] Baek, J. et al. (2023). “Knowledge-Augmented Language Model Prompting for Zero-Shot Knowledge Graph Question Answering.” arXiv:2306.04136.</p><p>[48] Chui, M. et al. (2025). “The economic potential of generative AI: The next productivity frontier.” McKinsey Global Institute.</p><p>[49] Huang, W. et al. (2024). “Understanding the planning of LLM agents: A survey.” arXiv:2402.02716.</p><p>[50] Ghallab, M., Nau, D., &amp; Traverso, P. (2004). Automated Planning: Theory and Practice. Morgan Kaufmann.</p><p>[51] Valmeekam, K. et al. (2023). “On the Planning Abilities of Large Language Models.” arXiv:2302.06706.</p><p>[52] Peltz, C. (2003). “Web Services Orchestration and Choreography.” IEEE Computer, 36(10), 46–52.</p><p>[53] Barros, A., Dumas, M., &amp; ter Hofstede, A. H. (2005). “Service Interaction Patterns.” International Conference on Business Process Management, Springer.</p><p>[54] Touvron, H. et al. (2023). “Llama 2: Open Foundation and Fine-Tuned Chat Models.” arXiv:2307.09288.</p><p>[55] Kagal, L., Finin, T., &amp; Joshi, A. (2003). “A policy language for a pervasive computing environment.” IEEE 4th International Workshop on Policies for Distributed Systems and Networks.</p><p>[56] Kambhampati, S. (2024). “Can Large Language Models Reason and Plan?” arXiv:2403.04121.</p><p>[57] Singhal, K. et al. (2023). “Large language models encode clinical knowledge.” Nature, 620(7972), 172–180.</p><p>[58] Thirunavukarasu, A. J. et al. (2023). “Large language models in medicine.” Nature Medicine, 29(8), 1930–1940.</p><p>[59] Dahl, M. et al. (2024). “Large Legal Fictions: Profiling Legal Hallucinations in Large Language Models.” arXiv:2401.01301.</p><p>[60] Huang, X. et al. (2023). “A Survey of Safety and Trustworthiness of Large Language Models through the Lens of Verification and Validation.” arXiv:2305.11391.</p><p>[61] Rao, A. et al. (2024). “Safeguarding LLM-based Multi-agent Systems through Formal Verification.” arXiv:2410.12345.</p><p><em>Originally published at </em><a href="https://www.linkedin.com/pulse/20-years-ago-i-already-writing-ideas-we-would-now-ai-dr-im%C3%A1n-55cne/"><em>https://www.linkedin.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8f53adf8a55" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A brief introduction to two data processing architectures — Lambda and Kappa for Big Data]]></title>
            <link>https://medium.com/data-science/a-brief-introduction-to-two-data-processing-architectures-lambda-and-kappa-for-big-data-4f35c28005bb?source=rss-ef18e5079d06------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f35c28005bb</guid>
            <category><![CDATA[apache-spark]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[apache-flink]]></category>
            <category><![CDATA[kafka]]></category>
            <dc:creator><![CDATA[Iman Samizadeh, Ph.D.]]></dc:creator>
            <pubDate>Thu, 15 Mar 2018 02:13:37 GMT</pubDate>
            <atom:updated>2021-06-16T16:41:44.028Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>A brief introduction to two data processing architectures — Lambda and Kappa for Big Data</strong></h3><p>Big Data, Internet of things (IoT), Machine learning models and various other modern systems are becoming an inevitable reality today. People from all walks of life have started to interact with data storages and servers as a part of their daily routine. Therefore we can say that dealing with big data in the best possible manner is becoming the main area of interest for businesses, scientists and individuals. For instance an application launched for achieving certain business goals will be more successful if it can efficiently handle the queries made by customers and serve their purpose well. Such applications need to interact with data storage and in this article we’ll try to explore two important data processing architectures that serve as the backbone of various enterprise applications known as Lambda and Kappa.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*BWBSroFVpWPmcdMDnIWJjA.png" /></figure><p>The rapid growth of social media applications, cloud based systems, Internet of things and an unending spree of innovations has made it important for a developer or a data scientist to take well calculated decisions while launching, upgrading or troubleshooting an enterprise application. Although it has been widely accepted and understood that using a modular approach to build an application has multiple advantages and long term benefits, the pursuit for selecting the right data processing architecture still keeps putting question marks in front of many proposals related to existing and upcoming enterprise software. Although there are various data processing architectures being followed around the globe these days let’s investigate the Lambda and Kappa architectures in detail and find out what makes each of them special and in what circumstances one should be preferred over another.</p><h4><strong>Lambda Architecture</strong></h4><p>Lambda architecture is a data processing technique that is capable of dealing with huge amount of data in an efficient manner. The efficiency of this architecture becomes evident in the form of increased throughput, reduced latency and negligible errors. While we mention data processing we basically use this term to represent high throughput, low latency and aiming for near-real-time applications. Which also would allow the developers to define delta rules in the form of code logic or natural language processing (NLP) in event-based data processing models to achieve robustness, automation and efficiency and improve the data quality. Moreover, any change in the state of data is an event to the system and as a matter of fact it is possible to give a command, queried or expected to carry out delta procedures as a response to the events on the fly.</p><p>Event sourcing is a concept of using the events to make prediction as well as storing the changes in a system on the real time basis a change of state of a system, an update in the databases or an event can be understood as a change. For instance if someone interact with a web page or a social network profile, the events like page view, likes or Add as a Friend request etc… are triggering events that can be processed or enriched and the data stored in a database.</p><p>Data processing deals with the event streams and most of the enterprise software that follow the Domain Driven Design use the stream processing method to predict updates for the basic model and store the distinct events that serve as a source for predictions in a live data system. To handle numerous events occurring in a system or delta processing, Lambda architecture enabling data processing by introducing three distinct layers. Lambda architecture comprises of Batch Layer, Speed Layer (also known as Stream layer) and Serving Layer.</p><h4>1. Batch layer</h4><p>New data keeps coming as a feed to the data system. At every instance it is fed to the batch layer and speed layer simultaneously. Any new data stream that comes to batch layer of the data system is computed and processed on top of a Data Lake. When data gets stored in the data lake using databases such as in memory databases or long term persistent one like NoSQL based storages batch layer uses it to process the data using MapReduce or utilizing machine-learning (ML) to make predictions for the upcoming batch views.</p><h4>2. Speed Layer (Stream Layer)</h4><p>The speed layer uses the fruit of event sourcing done at the batch layer. The data streams processed in the batch layer result in updating delta process or MapReduce or machine learning model which is further used by the stream layer to process the new data fed to it. Speed layer provides the outputs on the basis enrichment process and supports the serving layer to reduce the latency in responding the queries. As obvious from its name the speed layer has low latency because it deals with the real time data only and has less computational load.</p><h4>3. Serving Layer</h4><p>The outputs from batch layer in the form of batch views and from speed layer in the form of near-real time views are forwarded to the serving layer which uses this data to cater the pending queries on ad-hoc basis.</p><p>Here is a basic diagram of what Lambda Architecture model would look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EoY9aK7tk34Q9xl_DqGIfg.png" /><figcaption>Lambda Architecture</figcaption></figure><p>Let’s translate that to a functional equation which defines any query in big data domain. The symbols used in this equation are known as Lambda and the name for the Lambda architecture is also coined from the same equation. This function is widely known to those who are familiar with tidbits of big data analysis.</p><pre>Query = λ (Complete data) = λ (live streaming data) * λ (Stored data)</pre><p>The equation means that all the data related queries can be catered in the Lambda architecture by combining the results from historical storage in the form of batches and live streaming with the help of speed layer.</p><p><strong>Applications of Lambda Architecture</strong></p><p>Lambda architecture can be deployed for those data processing enterprise models where:</p><ul><li>User queries are required to be served on ad-hoc basis using the immutable data storage.</li><li>Quick responses are required and system should be capable of handling various updates in the form of new data streams.</li><li>None of the stored records shall be erased and it should allow addition of updates and new data to the database.</li></ul><p>Lambda architecture can be considered as near real-time data processing architecture. As mentioned above, it can withstand the faults as well as allows scalability. It uses the functions of batch layer and stream layer and keeps adding new data to the main storage while ensuring that the existing data will remain intact. Companies like Twitter, Netflix, and Yahoo are using this architecture to meet the quality of service standards.</p><h4>Pros and Cons of Lambda Architecture</h4><h4>Pros</h4><ul><li>Batch layer of Lambda architecture manages historical data with the fault tolerant distributed storage which ensures low possibility of errors even if the system crashes.</li><li>It is a good balance of speed and reliability.</li><li>Fault tolerant and scalable architecture for data processing.</li></ul><h4>Cons</h4><ul><li>It can result in coding overhead due to involvement of comprehensive processing.</li><li>Re-processes every batch cycle which is not beneficial in certain scenarios.</li><li>A data modeled with Lambda architecture is difficult to migrate or reorganize.</li></ul><h4><strong>Kappa Architecture</strong></h4><p>In 2014 Jay Kreps started a discussion where he pointed out some discrepancies of Lambda architecture that further led the big data world to another alternate architecture that used less code resource and was capable of performing well in certain enterprise scenarios where using multi layered Lambda architecture seemed like extravagance.</p><p>Kappa Architecture cannot be taken as a substitute of Lambda architecture on the contrary it should be seen as an alternative to be used in those circumstances where active performance of batch layer is not necessary for meeting the standard quality of service. This architecture finds its applications in real-time processing of distinct events. Here is a basic diagram for the Kappa architecture that shows two layers system of operation for this data processing architecture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z7IPmjFAwdltXEnknNK75Q.png" /><figcaption>Kappa Architecture</figcaption></figure><p>Let’s translate the operational sequencing of the kappa architecture to a functional equation which defines any query in big data domain.</p><pre>Query = K (New Data) = K (Live streaming data)</pre><p>The equation means that all the queries can be catered by applying kappa function to the live streams of data at the speed layer. It also signifies that that the stream processing occurs on the speed layer in kappa architecture.</p><h4><strong>Applications of Kappa architecture</strong></h4><p>Some variants of social network applications, devices connected to a cloud based monitoring system, Internet of things (IoT) use an optimized version of Lambda architecture which mainly uses the services of speed layer combined with streaming layer to process the data over the data lake.</p><p>Kappa architecture can be deployed for those data processing enterprise models where:</p><ul><li>Multiple data events or queries are logged in a queue to be catered against a distributed file system storage or history.</li><li>The order of the events and queries is not predetermined. Stream processing platforms can interact with database at any time.</li><li>It is resilient and highly available as handling Terabytes of storage is required for each node of the system to support replication.</li></ul><p>The above mentioned data scenarios are handled by exhausting Apache Kafka which is extremely fast, fault tolerant and horizontally scalable. It allows a better mechanism for governing the data-streams. A balanced control on the stream processors and databases makes it possible for the applications to perform as per expectations. Kafka retains the ordered data for longer durations and caters the analogous queries by linking them to the appropriate position of the retained log. LinkedIn and some other applications use this flavor of big data processing and reap the benefit of retaining large amount of data to cater those queries that are mere replica of each other.</p><h4>Pros and Cons of Kappa architecture</h4><h4><strong>Pros</strong></h4><ul><li>Kappa architecture can be used to develop data systems that are online learners and therefore don’t need the batch layer.</li><li>Re-processing is required only when the code changes.</li><li>It can be deployed with fixed memory.</li><li>It can be used for horizontally scalable systems.</li><li>Fewer resources are required as the machine learning is being done on the real time basis.</li></ul><h4><strong>Cons</strong></h4><p>Absence of batch layer might result in errors during data processing or while updating the database that requires having an exception manager to reprocess the data or reconciliation.</p><h4><strong>Conclusion</strong></h4><p>In short the choice between Lambda and Kappa architectures seems like a tradeoff. If you seek you’re an architecture that is more reliable in updating the data lake as well as efficient in devising the machine learning models to predict upcoming events in a robust manner you should use the Lambda architecture as it reaps the benefits of batch layer and speed layer to ensure less errors and speed. On the other hand if you want to deploy big data architecture by using less expensive hardware and require it to deal effectively on the basis of unique events occurring on the runtime then select the Kappa architecture for your real-time data processing needs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f35c28005bb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/a-brief-introduction-to-two-data-processing-architectures-lambda-and-kappa-for-big-data-4f35c28005bb">A brief introduction to two data processing architectures — Lambda and Kappa for Big Data</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservices: A growing trend in software development]]></title>
            <link>https://medium.com/@iman.samizadeh/microservices-a-growing-trend-in-software-development-c8d3e036c717?source=rss-ef18e5079d06------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8d3e036c717</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[as-a-service-software]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[Iman Samizadeh, Ph.D.]]></dc:creator>
            <pubDate>Wed, 28 Feb 2018 12:16:12 GMT</pubDate>
            <atom:updated>2018-02-28T12:16:12.737Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*h5uSrWF3NQUAdNt6mMKKbQ.png" /></figure><p>Today the world of development has come a long way forward from small programs that helped the users in simple calculations to such codes which are capable of running a complete business without perpetual supervision of human beings. The software developers write codes to achieve a specific goal and strive to create something that is useful. The ability of codes to automate the services and improve the user’s experience has motivated the entrepreneurs to heavily rely on the boons of software development. We have a lot of examples where a humble business was transformed into a multimillion fortune with the help of technology, obviously the said transformation was driven by software. While the importance of software development in the growth of a business has been accepted as an established fact, the recent topic of debate and discussion in the world of development revolves around finding out the appropriate approach for tackling a business problem.</p><p>One of these approaches is to use the <a href="https://en.wikipedia.org/wiki/Microservices">Microservices</a> architecture in order to provide workable solutions for a business. As it is not easy to explain it in a single sentence like we usually define other technical terms related to software engineering therefore let’s explore this concept in detail and develop an understanding about Microservices.</p><h3><strong>Concept of Microservices</strong></h3><p>Providing software solutions by focusing on particular services and using functional programming approach is not something new for a developer. However Microservices are a step ahead in this regard as they require each service to be independently defined, tested and deployed.</p><p>You’ll agree that there is a direct relationship between complexity of a software code and the functionalities that it promises to the users. To add various functions and abilities to tackle different case scenarios efficiently, the developers have to add up multiple blocks of codes together. In other words quality of code comes at the cost of complexity of program architecture. Now a complex set of code blocks won’t hurt if it equally suits the developers and business owners however the truth is that many modern business owners demand attributes like high availability, modularity, scalability and partial deployment from software developers. To add these properties in software solutions it is required to split the programs in to modules. These modules are designed to act like autonomous programs and they independently provide the desired services to the users. We can name a set of these small independent modules as Microservices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*-iesnttgaHHIQ16z-Sm_KA.png" /></figure><p>The desire to bring ease and automation for the customers drives the organizations to hire expert developers. It should be noted that any improvement in an ongoing process is a result of a changed behavior and for every change in the way a business deals with its stakeholders requires an upgrade in the architecture of software that it uses for its operations. Consider the example of a business that uses a single application to provide its services. That application needs to be distributed along all of its service points and business centers and it will require same infrastructure and system accessories to effectively perform its operations.</p><p>In many situations it is possible that a bug in one area of a <a href="https://en.wikipedia.org/wiki/Monolithic_system">Monolithic</a> application may put the whole software to a halt which can impede a business from achieving its targets. On the contrary using Microservices can solve this problem by allowing the developers to split the services in to separate software components that co-operate and interact with each other to run the whole mechanism.</p><h3>Application of Microservices in the business</h3><p>Microservices add the value to a business by improving overall performance. By considering the scenarios that may cause failures or interruption in the availability of services to the users an attempt is made to add responsiveness and redundancy to the architecture. These measures improve the user experience and augment the reliability of the services provided by a particular business.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*lvArNW0TTsOrupp6BvhEdQ.png" /></figure><p>While starting any venture we have a lot of queries, confusions and expectation in our minds. Usually the first few meetings between stakeholders, owners and developers are vague and every party tries to clear the fog from their windscreen to see the upcoming challenges clearly. At this time there are stories, examples and information about available technology that may allow the developers to wrap the expectations from a business venture around the technology with the help of a software. Therefore, it won’t be wrong if we suggest that it is good for a startup to go with a application as the things are not that concrete in the start and there is a lot of room for improvement and revision however once a team of developers is clear about the product they can start focusing on the basic services to convert each of them in to an independent micro service.</p><p>Microservices need to be tested separately and checked for inter-operability before deployment in a real time scenario. However this hard work pays by making a business more manageable, easy to analyze and equipped to resist disasters. It is noticed that many established enterprises are shifting towards Microservices to reap the benefits of multiple platforms by focusing all of their business fronts with detailed attention.</p><h3>What makes Microservices stand apart?</h3><p>Business owners seek growth in the size and profits of their enterprise and developers try to ensure that growth by designing well-defined software architecture that can be easily changed to accommodate the ever growing demands of the owners. As discussed earlier Microservices meet this criteria and their highly scalable architecture gives the confidence to the business owners to play their cards without any hesitation.</p><p>Here are a few features and flavors of software development that aid the Microservices to comply with the latest demands of business world:</p><h4>1 — Bounded Context</h4><p>A Bounded Context has a distinct domain and data model as well as its own application services. Moreover it always contains the details of a single domain and perfect integrations points to coordinate with other bounded contexts whenever required. It beautifully conforms to our definition of a Microservice: an independent code, definite interfaces, capable of implementing a business requirement. Hence we can say that while providing Microservices a developer borrows the <a href="https://en.wikipedia.org/wiki/Domain-driven_design">Domain Driven Design</a> or DDD concept of designing applications with respect to particular domains from bounded context. It also hints on the size of a Microservice that should cover a single context completely.</p><p>In other words Microservices split the projects into products and the products that independently cover a particular context, interact with each other to form the whole project.</p><h4>2 — Integration and Interoperability</h4><p>At the end of the day all we are concerned about are the services. Therefore it should be everyone’s priority to discover the services, understanding the relation between services, gauging the visibility that we must provide between these services and to keep in mind that all these services must obey the contract between developer and owner. In the past developers relied on <a href="https://en.wikipedia.org/wiki/Enterprise_application_integration">Enterprise Application Integration</a> or EAI and later the <a href="https://en.wikipedia.org/wiki/Enterprise_service_bus">Enterprise Service Bus</a> or ESB to provide service integration however designing the Microservices architecture with proper integration points simply eradicate EAI and ESB out of discussion. However using <a href="https://en.wikipedia.org/wiki/Application_programming_interface">Application Programming Interfaces</a> APIs effectively to provide optimal integration of various independent Microservices with the data resources and storage is still one of the main challenges for developers because without ensuring Interoperability between distinct Microservices it won’t be possible to harness the full benefits of this superb style of architecture.</p><h4>3 — Manageability and Metrics</h4><p>By splitting the services in to independent components we can apply a flexible approach while assigning resources for the services. It also allows us to program each service with the best options available in terms of language, libraries and frameworks. We can see that by opting Microservices our options have increased, it also allows us to manage our services in a better way.</p><p>The Microservice approach to architect a system also reduces the size of code for each service which improves the query response time. By doing so it provides a lot of runtime data records to support analysis of a business in detail. By having access to detailed data related to runtime business transactions there will be less surprises and augmented control over the business operations.</p><h4>4 — Scalability</h4><p>A service can be independently managed for load balancing, scaling it to cater a requirement or improve its responsiveness to a real time behavior. The team can scale a microservices component at runtime independently of other component. This helps in utilizing the resources efficiently and rapid reaction to changes in the workload and allows the developers and owners to try new things without fear of disturbing the overall system.</p><h4>5 — Resiliency</h4><p>The separate runtime of microservices provides immediate resilience that is independent of failures. Each component could be created as per its requirements with a decoupled design. Outage in one area does not shut down the remaining processes, and we may continue providing services to clients. The application automatically reacts to control the damage, and clients may not suspect the loss in functionality.</p><h4>6— Designed for Failure</h4><p>While deploying Microservices developers go with a brave approach that failures are inevitable in any real time application and by accepting this notion they try to explore as many failure scenarios as they can. By knowing such scenarios they improve the individual components of code to provide resilience in those scenarios where failures were detected earlier. A famous business is known to most, Netflix, also provides its services around the globe by designing its software backbone on the basis of Microservices. They use specially designed software that creates failures and allows them to measure their ability to recover against service affecting elements. It allows them to refactor their applications as well as provide redundancy to their system.</p><h4><strong>7— Continuous Delivery and Continuous Integration</strong></h4><p>Unlike Monolithic architecture, wherein dedicated teams work on each entities such as UI, database, server-side logic, and technological layers, Microservices uses cross-functional teams for a continuous delivery model. When developers, operations, and testing teams work simultaneously on a single service, testing and debugging becomes easy and instant. With this approach of incremental development, code is continuously developed, tested and deployed known as <a href="https://en.wikipedia.org/wiki/Continuous_delivery">CD</a> and <a href="https://en.wikipedia.org/wiki/Continuous_integration">CI</a>. All such steps results in ensuring continuous delivery of services to the users.</p><h4><strong>8 — DevOps</strong></h4><p>Microservices can increase the productivity of <a href="https://en.wikipedia.org/wiki/DevOps">DevOps</a> as they include a common toolset that could be used for operations. This common toolset creates a common terminology and processes for requirements, dependencies and issues, which in turn makes it easier for developers and operation to work together.</p><h4><strong>9 — Polyglot</strong></h4><p>For every service, we can freely select appropriate programing language, tools and libraries. This works great for teams where different kinds of expertise and experiences are on board. A single service can be built by a diversely composed team using various tools and technologies.</p><h4>10 — Faster time to market</h4><p>With Microservices architecture, you don’t need to rewrite the entire code to add or modify a feature. Because the architecture works with loosely coupled services, you only make changes to a specific service. By developing the project in smaller increments that are independently testable and deployable, business enjoy faster time to market.</p><h3>A win win for developers and business owners</h3><p>Microservices technique is a way of designing software to help the established enterprises in increasing their market worth by reaching to their consumers more effectively. However don’t take Microservices as a magic wand which will remove all the architectural discrepancies and development problems in a single go. It has its own liabilities and it provides benefits to the developers and business owners at a cost. The comparison shows that the impact of Microservices on a business greatly outnumbers the costs incurred on adopting this architecture style.</p><p>Monolithic applications used to provide software support by blending all the required services in a single process. This type of software architecture limits the ability to regularly analyze and modify the program for a specific business front as every little modification in the program requires a complete revision of the application.</p><p>Modern business trends change at a very fast pace and delays and errors are not acceptable for running businesses therefore developers are adopting the Microservices architecture to make sure that the software solution is agile, modular, scalable, resilient and effectively deployable. Moreover, Microservices style of software architecture empower the developers to keep an eye on the changing trends of business by rapid data collection for monitoring which helps in shaping the whole business for ultimate success.</p><p><em>Graphic credit: </em><a href="https://github.com/adrianco/spigo"><em>https://github.com/adrianco/spigo</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8d3e036c717" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>