<?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 Aman Jain on Medium]]></title>
        <description><![CDATA[Stories by Aman Jain on Medium]]></description>
        <link>https://medium.com/@amanjn53?source=rss-682f45aafc6b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LJwq6-b2UTfqFS8lAwrGVw.png</url>
            <title>Stories by Aman Jain on Medium</title>
            <link>https://medium.com/@amanjn53?source=rss-682f45aafc6b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 14:06:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amanjn53/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[I Tried Running Multi-User LLM Workloads on a Quadro P5000. It Worked — Until It Didn’t.]]></title>
            <link>https://medium.com/@amanjn53/i-tried-running-multi-user-llm-workloads-on-a-quadro-p5000-it-worked-until-it-didnt-9fd8475295ce?source=rss-682f45aafc6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fd8475295ce</guid>
            <category><![CDATA[ai-infrastructure]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[local-llm]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[nvidia-gpu]]></category>
            <dc:creator><![CDATA[Aman Jain]]></dc:creator>
            <pubDate>Tue, 05 May 2026 08:51:53 GMT</pubDate>
            <atom:updated>2026-05-05T08:51:53.730Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A cinematic, high-contrast hero image showing an NVIDIA Quadro P5000 GPU on a desk, split into two contrasting themes: on the left, a green “dream” section highlighting local LLM promises like privacy and control; on the right, a red “reality” section showing system limits such as VRAM exhaustion, large KV cache usage, latency spikes, and lack of true concurrency. Surrounding elements include a terminal screen with a Qwen model running at 64K context, system logs indicating model swapping, a lat" src="https://cdn-images-1.medium.com/max/1024/1*qYBab8JaWjwlTTfObgvtrQ.png" /></figure><p>There’s a phase every engineer hits when working with local LLMs:</p><blockquote>“This is actually working… maybe I don’t need expensive infra.”</blockquote><p>That phase ended for me the moment I moved from chat to real workloads.</p><p>This is the story of how the NVIDIA Quadro P5000 held up surprisingly well for simple use cases — and completely fell apart under anything resembling production pressure.</p><h3>The Illusion: “It Works on My Machine”</h3><p>I started with Ollama and a quantized version of Qwen 3.5 30B.</p><p>Single user. Chat interface. Short prompts.</p><p>And honestly? It felt great.</p><ul><li>Responses were coherent</li><li>Latency was acceptable</li><li>Setup was ridiculously simple</li></ul><p>At this stage, it’s easy to believe you’ve cracked something.</p><p>But this setup is deceptive. It only works because you’re operating in the easiest possible regime:</p><ul><li>minimal context</li><li>no concurrency</li><li>no orchestration</li></ul><p>The moment you step out of that, the cracks show.</p><h3>The Shift: From Chat to Agentic Work</h3><p>The real goal wasn’t chatting. It was <strong>agentic workflows</strong>:</p><ul><li>code copilots</li><li>long-running reasoning tasks</li><li>working across a codebase</li></ul><p>These workflows have one non-negotiable requirement:</p><blockquote><strong><em>Large context windows</em></strong></blockquote><p>So I pushed num_ctx to 64K.</p><p>That’s when things got interesting.</p><h3>The Hidden Cost of Context</h3><p>What I hadn’t fully appreciated at the start:</p><blockquote><em>Context isn’t just a parameter — it’s a </em><strong><em>memory commitment.</em></strong></blockquote><p>With Ollama:</p><ul><li>Increasing context size increases <strong>KV cache allocation</strong></li><li>That allocation scales with:</li><li>model size</li><li>number of layers</li><li>sequence length</li></ul><p>On a 30B model, a 64K context window quietly eats a massive chunk of your 16GB VRAM.</p><p>The system still worked — but now:</p><ul><li>latency increased</li><li>GPU memory became tight</li><li>headroom disappeared</li></ul><p>I accepted the trade-off. This was research.</p><h3>Where It Actually Breaks: Multi-User Reality</h3><p>Things only truly broke when I introduced <strong>multiple users</strong>.</p><p>I exposed the system on my local network and started testing concurrent access.</p><h3>Scenario 1: Different Models</h3><p>Two users. Two different models.</p><p>What happened:</p><ul><li>Model A unloaded</li><li>Model B loaded</li><li>Request processed</li></ul><p>Then back again.</p><p>No parallelism. Just <strong>model thrashing</strong>.</p><p>This isn’t a bug. It’s physics:</p><ul><li>16GB VRAM cannot hold multiple large models</li><li>So the system swaps</li></ul><blockquote><strong><em>Conclusion:</em></strong><em> Multi-model concurrency is unrealistic on this class of hardware.</em></blockquote><h3>Scenario 2: Same Model, Multiple Users</h3><p>This one was more subtle — and more important.</p><p>Same model. Multiple users. Should work, right?</p><p>Technically, yes. Practically, not really.</p><p>What I observed:</p><ul><li>Throughput didn’t scale</li><li>Latency increased with each additional user</li><li>Requests behaved almost like a queue</li></ul><p>Why?</p><p>Because each request isn’t free. It carries:</p><ul><li>its own <strong>KV cache footprint</strong></li><li>its own memory pressure</li></ul><p>And without advanced scheduling or batching:</p><ul><li>the GPU isn’t efficiently shared</li><li>work isn’t merged</li><li>memory gets fragmented</li></ul><blockquote><em>The bottleneck wasn’t compute. It was </em><strong><em>memory and scheduling</em></strong><em>.</em></blockquote><h3>The Architecture Wall</h3><p>At this point, it’s tempting to blame the tooling.</p><p>But the deeper issue is the hardware.</p><p>The NVIDIA Quadro P5000 is built on Pascal:</p><ul><li>no Tensor Cores</li><li>no modern attention optimizations</li><li>limited compatibility with newer kernels</li></ul><p>This matters more than people think.</p><p>Modern LLM inference stacks assume:</p><ul><li>fast matrix ops (Tensor Cores)</li><li>efficient attention kernels</li><li>high memory bandwidth</li></ul><p>Without those, you’re not just slower — you’re structurally limited.</p><h3>The vLLM Experiment</h3><p>To push further, I tried vLLM.</p><p>On paper, this is exactly what I needed:</p><ul><li>continuous batching</li><li>efficient KV cache management</li><li>real multi-user support</li></ul><p>And here’s the key insight:</p><blockquote><em>vLLM isn’t just faster — it’s a different philosophy of inference.</em></blockquote><p>But on the P5000, reality didn’t match theory.</p><ul><li>Limited support for modern CUDA kernels</li><li>Missing optimizations like advanced attention mechanisms</li><li>Overall poor compatibility with Pascal-era GPUs</li></ul><p>So while vLLM is the <em>right direction</em>, the hardware couldn’t take advantage of it.</p><h3>What Actually Failed</h3><p>It’s easy to walk away saying “this didn’t work.”</p><p>That’s not quite true.</p><p>Here’s what actually happened:</p><ul><li>The model worked</li><li>The tooling worked</li><li>The workflows worked</li></ul><p><strong>The system failed under realistic load.</strong></p><p>More precisely:</p><blockquote><em>The combination of large context, limited VRAM, and lack of batching made concurrency collapse.</em></blockquote><h3>Where the P5000 Still Makes Sense</h3><p>After all this, the NVIDIA Quadro P5000 isn’t useless — it’s just misunderstood.</p><p>It works well for:</p><ul><li>short, stateless requests</li><li>structured data extraction</li><li>single-user workflows</li><li>queued processing systems</li></ul><p>It fails at:</p><ul><li>agentic workflows</li><li>large context windows</li><li>real-time multi-user systems</li><li>multi-model serving</li></ul><h3>The Real Lesson</h3><p>Most people optimize for:</p><ul><li>model size</li><li>quantization</li><li>prompt quality</li></ul><p>But at scale, none of that matters first.</p><p>The real constraint is this:</p><blockquote><strong><em>LLM serving is a memory problem disguised as a compute problem.</em></strong></blockquote><p>Once you:</p><ul><li>increase context</li><li>add users</li><li>introduce state</li></ul><p>You’re no longer “running a model.”</p><p>You’re running a <strong>memory management system under pressure</strong>.</p><h3>Closing Thought</h3><p>Local LLMs feel magical at first because they hide the hard parts.</p><p>But the moment you move from:</p><ul><li><em>demo → system</em></li><li><em>single-user → multi-user</em></li><li><em>chat → workflows</em></li></ul><p>You hit reality.</p><p>And in my case, that reality was simple:</p><blockquote><em>A 16GB Pascal GPU can run LLMs.<br>It just can’t sustain them.</em></blockquote><p>If you’re building something beyond a demo, don’t just ask:</p><blockquote>“Can this model run?”</blockquote><p>Ask:</p><blockquote><strong><em>“Can this workload sustain?”</em></strong></blockquote><p>That’s where the real engineering begins.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fd8475295ce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evolving Intelligence Systems: From Static Optimization to Adaptive Policy Graphs]]></title>
            <link>https://medium.com/@amanjn53/evolving-intelligence-systems-from-static-optimization-to-adaptive-policy-graphs-235c5552efc8?source=rss-682f45aafc6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/235c5552efc8</guid>
            <category><![CDATA[genetic-algorithm]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[evolutionary-algorithms]]></category>
            <category><![CDATA[adaptive-learning]]></category>
            <dc:creator><![CDATA[Aman Jain]]></dc:creator>
            <pubDate>Mon, 02 Mar 2026 11:16:44 GMT</pubDate>
            <atom:updated>2026-03-02T11:16:44.085Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_WDtJTXMWvzpJGs02MmuVg.png" /></figure><h3>Disclaimer</h3><p>These are evolving research notes, not a finalized framework. The ideas presented here reflect ongoing architectural thinking around dynamic policy systems, evolutionary optimization, and temporal graph intelligence. Assumptions may evolve as the system understanding deepens.</p><h3>1. The Real Problem: State Evolution, Not Prediction</h3><p>Most machine learning systems assume:</p><ul><li>Static dataset</li><li>Fixed objective</li><li>Stable evaluation metric</li></ul><p>But real organizational systems are dynamic:</p><ul><li>Decisions compound.</li><li>Policies shift.</li><li>Leadership changes.</li><li>Feedback alters what “correct” means.</li></ul><p>Consider a simple post:</p><blockquote><em>“Due to X, leadership under Y decided to do Z for key account K.”</em></blockquote><p>Inside this one sentence:</p><ul><li>Causal trigger (X)</li><li>Authority structure (Y)</li><li>Decision object (Z)</li><li>Target entity (K)</li><li>Temporal context</li></ul><p>Over thousands of such posts, the system becomes a <strong>time-evolving intelligence mesh</strong>.</p><p>The real challenge is not classification.</p><p>It is:</p><blockquote><em>How did the system reach its current state, and where is it trending?</em></blockquote><h3>2. From Text to Temporal Graph</h3><p>Unstructured posts must be transformed into structured events:</p><pre>(Event)<br> ├── caused_by → X<br> ├── decided_by → Leader Y<br> ├── action → Z<br> ├── target → Account K<br> ├── time → T</pre><p>Accumulated over time, these form a dynamic decision graph.</p><p>Typical implementation stack:</p><ul><li>NLP pipelines using PyTorch or TensorFlow</li><li>Graph storage using Neo4j</li></ul><p>But structure alone does not produce intelligence.</p><p>We must compute evolving <strong>state</strong> from compounding decisions.</p><h3>3. Why Static Scoring Fails</h3><p>A naïve policy score might look like:</p><pre>ImpactScore =<br>    0.5 * Authority<br>  + 0.3 * Escalation<br>  + 0.2 * Recency</pre><p>But:</p><ul><li>What if crisis periods increase recency importance?</li><li>What if authority weakens during restructuring?</li><li>What if cross-company interactions become dominant?</li></ul><p>In dynamic systems, the definition of “correct decision” evolves after feedback.</p><p>Therefore:</p><blockquote><em>The evaluation logic must adapt.</em></blockquote><h3>4. Genetic Algorithms — Used Properly</h3><p>Genetic Algorithms (GA) are often misapplied for feature selection.</p><p>In dynamic policy systems, their real power lies in evolving <strong>decision logic</strong>.</p><p>Instead of evolving features, evolve parameters:</p><pre>individual = [<br>    authority_weight,<br>    recency_decay_rate,<br>    escalation_weight,<br>    cross_company_multiplier,<br>    path_penalty<br>]</pre><p>Each individual represents a scoring strategy.</p><p>Fitness is computed by:</p><ol><li>Applying this scoring logic to historical graph states.</li><li>Predicting outcomes.</li><li>Comparing against feedback.</li><li>Returning a performance score.</li></ol><p>The population evolves scoring strategies over time.</p><h3>5. The Critical Shift: Fitness Is Not Static</h3><p>In real systems:</p><ul><li>Feedback changes.</li><li>Objectives shift.</li><li>Risk tolerance evolves.</li></ul><p>This transforms optimization into:</p><blockquote><em>A dynamic adaptive tracking problem.</em></blockquote><p>Mechanisms to handle this:</p><h3>Sliding Window Evaluation</h3><pre>Fitness(t) = Performance over recent time window</pre><h3>Regime-Based Evaluation</h3><pre>Fitness = F(system_state, parameters)</pre><p>Different scoring logic for growth vs crisis phases.</p><h3>Archive Memory</h3><p>Store elite strategies from past regimes.<br>Reintroduce them when similar patterns reappear.</p><h3>6. Evolutionary Pressure: How Offspring Compete</h3><p>Evolution requires structured competition:</p><ul><li>Tournament selection (localized survival)</li><li>Rank-based selection (controlled pressure)</li><li>Fitness sharing (diversity preservation)</li><li>Steady-state replacement (continuous adaptation)</li></ul><p>Too much selection → premature convergence.<br>Too much mutation → chaos.</p><p>Balance is critical.</p><h3>7. When GA Makes Sense</h3><p>GA is appropriate when:</p><ul><li>Objective is non-differentiable</li><li>Logic is hybrid (symbolic + numeric)</li><li>Search space is combinatorial</li><li>Interpretability matters</li><li>Gradients are unavailable</li></ul><p>GA is less suitable when:</p><ul><li>Feedback is immediate and dense</li><li>Micro-level action tuning is required</li></ul><p>In such cases, reinforcement learning may complement evolutionary logic.</p><p>A hybrid approach often works best:</p><ul><li>GA evolves macro strategy.</li><li>Online learning refines short-term adaptation.</li></ul><h3>8. The Deeper Insight</h3><p>What is being modeled here is not just optimization.</p><p>It is organizational learning.</p><ul><li>Decisions mutate.</li><li>Strategies recombine.</li><li>Feedback selects.</li><li>Memory preserves.</li><li>Environment shifts.</li></ul><p>In static ML problems, convergence is the goal.</p><p>In dynamic intelligence systems, convergence may be undesirable.</p><p>The goal becomes:</p><blockquote><em>Continuous adaptive alignment with evolving reality.</em></blockquote><p>Genetic Algorithms, when applied at the logic layer rather than the feature layer, become tools for structured adaptation in complex policy graphs.</p><p>And when combined with temporal knowledge modeling, they allow us to build systems that evolve with the environments they model.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=235c5552efc8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Built a Local SMTP Server Using Postal and Cloudflare to Understand How Mailchimp Really…]]></title>
            <link>https://medium.com/@amanjn53/how-i-built-a-local-smtp-server-using-postal-and-cloudflare-to-understand-how-mailchimp-really-2ccd9517a46b?source=rss-682f45aafc6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ccd9517a46b</guid>
            <category><![CDATA[mailchimp]]></category>
            <category><![CDATA[alternatives-to-mailchimp]]></category>
            <category><![CDATA[email-infrastructure]]></category>
            <category><![CDATA[postal]]></category>
            <category><![CDATA[smtp-server]]></category>
            <dc:creator><![CDATA[Aman Jain]]></dc:creator>
            <pubDate>Wed, 17 Dec 2025 07:20:28 GMT</pubDate>
            <atom:updated>2025-12-17T07:20:28.478Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I Built a Local SMTP Server Using Postal and Cloudflare to Understand How Mailchimp Really Works</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*MDP3G8e6QjFl4SQVQo6bjg.png" /></figure><p>Email looks simple from the outside — until you try running it yourself.</p><p>This project started purely out of <strong>curiosity</strong>. I wanted to understand <strong>how email service providers like Mailchimp send cold and promotional emails</strong>, how they manage IP reputation, DNS, and routing, and why email delivery is so sensitive to infrastructure decisions.</p><p>To answer those questions, I built a <strong>local SMTP server using Postal</strong>, exposed it using <strong>Cloudflare Tunnel</strong>, and tested real-world delivery across <strong>Gmail, Outlook, and Hostinger</strong>.</p><p>This article is a <strong>hands-on, step-by-step walkthrough</strong> of what worked, what broke, and <em>why email infrastructure is designed the way it is</em>.</p><h3>Why This Project (Not Because Gmail Blocked Me Initially)</h3><p>Important clarification:</p><blockquote><strong><em>Gmail did not block emails initially.</em></strong></blockquote><p>The goal was <strong>not</strong> to bypass spam filters or send spam.<br> The goal was to <strong>observe what starts breaking</strong> when you try to replicate what Mailchimp does — but without their infrastructure.</p><p>I wanted to understand:</p><ul><li>Why ESPs insist on static IPs</li><li>Why Return-Path and rDNS matter so much</li><li>Why inbound and outbound email are separated</li><li>Why Cloudflare alone isn’t enough for SMTP</li></ul><p>The only way to learn this was to <strong>build it myself</strong>.</p><h3>Tech Stack Used</h3><p>To keep the experiment realistic but cost-effective:</p><ul><li><strong>Postal</strong> — Open-source mail server</li><li><strong>WSL (Ubuntu)</strong> — Local Linux environment</li><li><strong>Cloudflare Tunnel</strong> — Secure public exposure</li><li><strong>Cloudflare DNS</strong> — Domain &amp; email records</li><li><strong>Small VPS</strong> — Static IP for inbound email handling</li></ul><h3>Step 1: Running Postal Locally Using WSL Ubuntu</h3><p>I installed <strong>Postal inside WSL (Ubuntu)</strong> on my local machine.</p><p>Why WSL?</p><ul><li>Fast setup</li><li>Native Linux tooling</li><li>Ideal for experimentation</li><li>No immediate VPS cost</li></ul><p>At this stage:</p><ul><li>Postal UI was running locally</li><li>SMTP server was active</li><li>Everything worked on localhost</li></ul><p>But obviously, <strong>no external mail server could reach it yet</strong>.</p><h3>Step 2: Exposing Postal Using Cloudflare Tunnel</h3><p>My ISP places my machine behind <strong>CGNAT</strong>, which means:</p><ul><li>No public IP</li><li>No port forwarding</li><li>No direct inbound access</li></ul><p>So I used <strong>Cloudflare Tunnel</strong>.</p><h3>Tunnel setup:</h3><pre>postal.domain.com → localhost:5000</pre><p>Postal’s web interface runs on <strong>port 5000</strong>, so I exposed that securely.</p><h3>Result:</h3><ul><li>Postal UI accessible at <a href="https://postal.domain.com/">https://postal.domain.com</a></li><li>No open router ports</li><li>Fully encrypted traffic</li></ul><p>At this point, the <strong>control plane</strong> was live.</p><h3>Step 3: Creating SMTP Server and Sending Domain in Postal</h3><p>Inside the Postal dashboard:</p><ol><li>Created an <strong>SMTP server</strong></li><li>Added a <strong>sending domain</strong></li><li>Generated required DNS records:</li></ol><ul><li>SPF</li><li>DKIM</li><li>Return-Path (RP)</li></ul><p>All records were added to <strong>Cloudflare DNS</strong> and validated successfully.</p><h3>Step 4: Gmail and Outlook Rejected Emails (Spamhaus Listing)</h3><p>I then tested sending emails to:</p><ul><li>Gmail</li><li>Outlook</li><li>Hostinger</li></ul><p>Both <strong>Gmail and Outlook rejected the emails during the SMTP handshake</strong>.</p><h3>Root Cause</h3><p>The rejection logs clearly showed:</p><blockquote><strong><em>The sending IP was listed in Spamhaus</em></strong></blockquote><p>This immediately explained the behavior:</p><ul><li>Outlook heavily relies on <strong>Spamhaus blocklists</strong></li><li>Gmail does as well</li><li>A listed IP results in <strong>hard rejection</strong>, regardless of SPF or DKIM</li></ul><p>This was purely an <strong>IP reputation issue</strong>, not a configuration mistake.</p><h3>Why This Happens with Local or Shared IPs</h3><p>In my case:</p><ul><li>The IP belonged to an ISP or shared environment</li><li>I had no control over its history</li><li>Previous abuse had already poisoned the reputation</li></ul><p>This revealed an important truth:</p><blockquote><em>Email providers trust </em><strong><em>IP history</em></strong><em>, not your intent.</em></blockquote><h3>Step 5: Hostinger Soft-Fail &amp; Return-Path Discovery</h3><p>Hostinger behaved differently.</p><p>Instead of rejecting emails outright, it <strong>soft-failed delivery</strong>.</p><p>Logs revealed:</p><blockquote><em>rp.portal.domain.com does not resolve to a valid IP</em></blockquote><p>This pointed directly to the <strong>Return-Path domain</strong>.</p><h3>Step 6: Why Return-Path Breaks Local SMTP Setups</h3><p>Return-Path is critical for:</p><ul><li>Bounce handling</li><li>Reputation tracking</li><li>SMTP trust validation</li></ul><p>In my setup:</p><ul><li>rp.portal.domain.com pointed to my <strong>local machine</strong></li><li>My local machine:</li><li>Was behind <strong>CGNAT</strong></li><li>Had no static IP</li><li>Cloudflare Tunnel:</li><li>Cannot expose <strong>port 25</strong></li><li>Cannot provide <strong>PTR / rDNS</strong></li></ul><p>This is a <strong>hard technical limitation</strong>, not a misconfiguration.</p><h3>Why Cloudflare Tunnel Is Not Enough for SMTP</h3><p>Cloudflare Tunnel is excellent for:</p><ul><li>Web dashboards</li><li>APIs</li><li>Control planes</li></ul><p>But <strong>SMTP is infrastructure-heavy</strong>:</p><ul><li>Port 25 must be directly reachable</li><li>Static IPs are mandatory</li><li>Reverse DNS (PTR) is required</li><li>Reputation is IP-based</li></ul><p>This is why ESPs don’t run SMTP entirely behind tunnels.</p><h3>Step 7: Separating Outbound and Inbound (Like Real ESPs)</h3><p>The solution was <strong>architectural</strong>, not tactical.</p><h3>Final Architecture:</h3><pre>Outbound Emails<br>→ Local Postal (via Cloudflare Tunnel)</pre><pre>Inbound Emails / Return-Path / Bounces<br>→ VPS with Static IP</pre><p>Why a VPS?</p><ul><li>Public static IP</li><li>Proper PTR (reverse DNS)</li><li>Port 25 allowed</li><li>Industry-standard inbound handling</li></ul><p>I updated DNS:</p><pre>rp.portal.domain.com → VPS IP</pre><h3>Result:</h3><ul><li>Hostinger stopped soft-failing</li><li>SMTP trust improved</li><li>Behavior aligned with real ESPs</li></ul><h3>Why Mailchimp and ESPs Are Built This Way</h3><p>This experiment made it obvious:</p><ul><li>Control planes can be dynamic</li><li>SMTP planes must be stable</li><li>Inbound email is reputation-critical</li><li>IP ownership matters more than software</li></ul><p>Mailchimp doesn’t “beat spam filters” — <strong>designs infrastructure correctly</strong>.</p><h3>Key Learnings from This Experiment</h3><ol><li>Spamhaus listing = instant rejection</li><li>Gmail &amp; Outlook behavior is consistent and correct</li><li>SPF/DKIM alone don’t guarantee delivery</li><li>Return-Path is non-negotiable</li><li>Cloudflare Tunnel ≠ SMTP solution</li><li>CGNAT breaks inbound email</li><li>Static IPs are essential</li></ol><h3>Who Should Try This Project?</h3><p>This setup is ideal if you:</p><ul><li>Want to deeply understand email systems</li><li>Are building a SaaS or ESP</li><li>Care about architecture over shortcuts</li></ul><p>Not ideal if you:</p><ul><li>Just want transactional emails fast</li><li>Don’t want to manage IP reputation</li></ul><h3>Final Thoughts</h3><p>This project wasn’t about sending spam or bypassing Gmail.</p><p>It was about understanding <strong>why email infrastructure is hard</strong> — and why platforms like Mailchimp exist.</p><p>After building this, I no longer see email as “just SMTP”.</p><p>It’s <strong>distributed trust engineering</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ccd9517a46b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Replaced 70% of My Full-Stack Work With a Codex Agent Inside VS Code]]></title>
            <link>https://medium.com/@amanjn53/how-i-replaced-70-of-my-full-stack-work-with-a-codex-agent-inside-vs-code-512fc5ecba83?source=rss-682f45aafc6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/512fc5ecba83</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[future-of-coding]]></category>
            <category><![CDATA[full-stack-development]]></category>
            <category><![CDATA[ai-agents-in-action]]></category>
            <dc:creator><![CDATA[Aman Jain]]></dc:creator>
            <pubDate>Mon, 24 Nov 2025 04:59:59 GMT</pubDate>
            <atom:updated>2025-11-24T04:59:59.067Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A futuristic digital artwork of a programmer coding in Visual Studio Code, with a widescreen monitor displaying backend and frontend code side-by-side. The scene glows with neon blue highlights, holographic UI elements, and high-tech sci-fi patterns, creating an advanced, immersive coding environment." src="https://cdn-images-1.medium.com/max/1024/1*51XiGDdnq8-STro40aSYHA.png" /></figure><h3><strong><em>A glimpse into the future of software development -and why it feels like having superpowers.</em></strong></h3><p>There are moments in tech when you realize you’re no longer just writing code — you’re orchestrating it.<br>The first time firewalls became declarative.<br>The first time CI/CD felt like magic.<br>The first time GitHub Copilot autocompleted a function before you finished thinking.</p><p>But what I’ve been experiencing over the past weeks goes beyond productivity.<br>It feels like <strong>watching the role of a full-stack developer evolve in real time.</strong></p><p>This article is a walkthrough of how I built a workflow where a <strong>Codex-powered autonomous agent inside Visual Studio Code</strong> now performs <strong>70% of my full-stack tasks</strong> — reliably, consistently, across backend and frontend — in a single session.<br> And why I believe this workflow will soon become the default way software is built.</p><h3>The Old Workflow: Context Switching Hell</h3><p>Full-stack development has always had one hidden enemy: <strong>context fragmentation</strong>.</p><p>Different terminals.<br>Different codebases.<br>Different tabs.<br>Different mental models.</p><p>Backend running on port 8080.<br>Frontend on 3000.<br>The API contracts stored somewhere in Confluence.<br>Design considerations hiding in JIRA.<br>Prototype screenshots saved in someone’s Google Drive.</p><p>Every feature demanded a cognitive marathon.</p><h3>The Breakthrough: One VS Code Window. One Agent. Two Projects. Zero Switching.</h3><p>The transformation began with a bold idea:</p><blockquote>“What if both my backend and frontend lived in the same VS Code workspace…<br> and the agent could modify both, intelligently, in a single flow?”</blockquote><p>So I merged the spaces:</p><pre>workspace/<br>   /frontend<br>   /backend<br>   .vscode/</pre><p>Then I connected my <strong>Codex Agent</strong> — with file-level understanding, multi-file context, and permissioned execution.</p><p>Suddenly, I had a partner who could:</p><ul><li>Read backend models</li><li>Update frontend components accordingly</li><li>Adjust API routes</li><li>Modify validation</li><li>Update tests in both services</li><li>And do all of this <em>together</em>, as one atomic feature update</li></ul><p>It felt like pairing with an engineer who understood the entire system.</p><h3>Prototyping in Google AI Studio — Then Letting Codex Build the Real Thing</h3><p>Before writing a line of code, we prototype ideas in <strong>Google AI Studio</strong>.<br>It’s fast, visual, expressive.</p><p>Once the prototype feels right, I take <strong>screenshots and design specs</strong> and feed them into the Codex agent inside VS Code:</p><blockquote>“Here’s the prototype. Here are the JIRA design considerations. Implement this end-to-end in both frontend + backend.”</blockquote><p>The agent sees:</p><ul><li>UI layout from the screenshot</li><li>User interactions inferred visually</li><li>API payloads required</li><li>Domain models in the backend</li><li>Existing React components</li><li>Validation rules</li><li>Error states</li><li>Business logic workflows</li></ul><p>And it executes everything like a senior developer with perfect memory.</p><h3>Real Example: An End-to-End Feature in Minutes, Not Hours</h3><p>Traditionally, an end-to-end feature might involve:</p><ul><li>Designing the component</li><li>Creating backend route</li><li>Writing validation and business rules</li><li>Updating DB models</li><li>Wiring frontend API calls</li><li>Handling responses + UI state</li><li>Writing tests</li><li>Manually debugging the integration</li></ul><p>Instead, I gave the agent the prompt + screenshots + acceptance criteria and watched it:</p><ul><li>Update the Spring Boot backend</li><li>Create new REST endpoints</li><li>Modify entity classes</li><li>Adjust TypeScript types</li><li>Generate React JSX</li><li>Add loading states</li><li>Implement error boundaries</li><li>Write unit tests</li><li>Fix its own build errors</li></ul><p>All in one run.</p><h3>The Results — Measured, Not Just Felt</h3><p>After tracking my actual work for 3 weeks:</p><blockquote><strong><em>Overall productivity increase: 70%+</em></strong></blockquote><p>Breakdown:</p><ul><li><strong>Backend tasks:</strong> 60–80% faster</li><li><strong>Frontend tasks:</strong> 50–70% faster</li><li><strong>Documentation &amp; JIRA updates:</strong> 80% faster</li><li><strong>Bug fixing:</strong> 65% faster</li></ul><p>But this isn’t just about speed. It’s about <strong>focus</strong>.</p><p>The agent handles boilerplate, repetitive flows, cross-layer propagation, and mechanical updates.<br>I focus on architecture, business logic, user experience, and innovation.</p><h3>Why This Gave Me Goosebumps</h3><p>Because for the first time, a tool didn’t feel like assistance. It felt like <strong>extension</strong>.</p><p>Like the boundary of my capabilities had shifted. Like my “developer bandwidth” had multiplied.</p><p>When I see the agent refactor models, sync types, update APIs, patch UI, fix tests, and self-correct errors in one unified context…<br>I realize that full-stack development is no longer a two-hand job.<br>It’s a <em>multi-mind</em> collaboration between human and machine.</p><h3>What This Means for Developers</h3><p>This shift is irreversible.</p><p>Soon:</p><ul><li>Every repo will come with an agent</li><li>Every sprint will feel like directing, not coding</li><li>Backlog items will be completed in hours, not days</li><li>Prototyping → Development → Testing will be a continuum</li><li>Teams will grow smaller but deliver exponentially more</li><li>The bottleneck will move from execution to imagination</li></ul><p>We’re entering an era where the IDE becomes a co-developer. And that gives me chills every time I trigger the agent.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=512fc5ecba83" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The End of Context Collapse: Why Agentic Context Engineering (ACE) Is the Blueprint for Scalable…]]></title>
            <link>https://www.designsystemscollective.com/the-end-of-context-collapse-why-agentic-context-engineering-ace-is-the-blueprint-for-scalable-d5dd66fd8911?source=rss-682f45aafc6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5dd66fd8911</guid>
            <category><![CDATA[aritificial-intelligence]]></category>
            <category><![CDATA[ai-system-design]]></category>
            <category><![CDATA[context-engineering]]></category>
            <category><![CDATA[agentic-context]]></category>
            <category><![CDATA[llm-agent]]></category>
            <dc:creator><![CDATA[Aman Jain]]></dc:creator>
            <pubDate>Mon, 27 Oct 2025 08:03:24 GMT</pubDate>
            <atom:updated>2025-10-28T06:18:50.273Z</atom:updated>
            <content:encoded><![CDATA[<h3>The End of Context Collapse: Why <em>Agentic Context Engineering (ACE)</em> Is the Blueprint for Scalable, Self-Improving LLM Agents</h3><figure><img alt="A futuristic digital illustration showing a humanoid figure interacting with a glowing holographic interface labeled “Agentic Context Engineering (ACE)”. The interface displays three connected modules — Generator, Reflector, and Curator — each with tasks like “Solve Queries,” “Critique Execution,” and “Merge Lessons.” The scene uses blue neon light, circuit-like patterns, and a sci-fi atmosphere to symbolize intelligent agents collaboratively evolving contextual knowledge." src="https://cdn-images-1.medium.com/max/1024/1*fOlR0UEpJIpMK9_i2N4a2g.png" /></figure><p>As Large Language Models (LLMs) leave the lab and enter complex real-world domains — autonomous coding, financial reasoning, compound AI systems — the way they <em>store, recall,</em> and <em>adapt knowledge</em> is changing profoundly.</p><p>The new consensus is clear: <strong>context adaptation</strong>, not model fine-tuning, is the future.<br>Rather than altering expensive model weights, we now modify an LLM’s inputs — its instructions, memory, and runtime context — to unlock new capabilities on demand. Contexts are interpretable, quickly updatable, and vastly cheaper than fine-tuning.</p><p>But there’s a catch. Two invisible forces have quietly sabotaged this progress: <strong>brevity bias</strong> and <strong>context collapse</strong>.</p><h3>The Two Pitfalls That Kill AI Memory</h3><h3>1. Brevity Bias</h3><p>Prompt engineers often chase conciseness — believing “shorter is better.” In practice, this obsession with brevity strips away the richness that LLMs rely on: domain heuristics, tool-use conventions, and lessons from failure. Detailed prompts help models reason contextually and distill relevance themselves. Trimming them too aggressively is like asking a pilot to fly blindfolded — lightweight, yes, but dangerous.</p><h3>2. Context Collapse</h3><p>This is the <em>terminal failure mode</em> of many adaptive agents.<br>When a model is asked to rewrite or summarize its entire context — a <strong>monolithic rewrite</strong> — it compresses complex playbooks into short, oversimplified summaries.</p><p>Result? A catastrophic loss of detail, degraded reasoning, and a sharp decline in performance.</p><p>In short: context collapse is memory decay disguised as optimization.</p><p>To overcome these limitations, we must stop treating prompts as static instructions and start viewing them as <strong>evolving playbooks</strong> — living documents that grow, refine, and retain experience.</p><p>This is the foundation of <strong>Agentic Context Engineering (ACE)</strong>.</p><h3>Introducing ACE: The Three Agents That Build a Perfect Playbook</h3><p><strong>Agentic Context Engineering (ACE)</strong> is a structured framework for scalable, resilient context adaptation.<br>It prevents collapse by updating knowledge <em>incrementally</em> rather than rewriting it wholesale.<br>At its core are three specialized agents that form a closed learning loop:</p><h3>1. The Generator (Planner / Coder)</h3><p>This is the base LLM — such as <em>DeepSeek-V3.1</em> in testing.<br>Its role: execute new tasks and generate reasoning trajectories using the current playbook as guidance.<br>It’s the <em>doer</em> — the one producing actions and outputs.</p><h3>2. The Reflector (Expert Coach)</h3><p>Once the Generator completes its run, the Reflector steps in to critique.<br>It reviews reasoning traces, identifies conceptual errors, pinpoints root causes, and extracts a distilled lesson — a tactical or strategic insight worth remembering.<br>It’s the <em>teacher</em> — turning outcomes into wisdom.</p><h3>3. The Curator (Editor / Organizer)</h3><p>The Curator safeguards the integrity of the playbook.<br>It merges the Reflector’s insights as <strong>small, structured “delta entries”</strong> — incremental bullet-point updates — using deterministic (non-LLM) logic.<br>This preserves all past knowledge while layering new lessons on top.<br>It’s the <em>archivist</em> — ensuring continuous improvement without collapse.</p><p>Together, these agents form a feedback loop that allows a system to <em>grow smarter with every iteration</em> — without ever losing its accumulated expertise.</p><h3>ACE in Action: How It Works in the Real World</h3><h3>Custom Software Workflows (CMS JSON Generation)</h3><p>ACE isn’t limited to research — it’s directly applicable to enterprise automation.</p><p><strong>Scenario:</strong> A CMS requires an AI to generate structured JSON configs based on dynamic component rules.<br><strong>The Challenge:</strong> The AI must remember detailed guidelines — design philosophy, policies, and schema constraints.<br><strong>ACE Alignment: </strong>treating these rules as an <em>evolving playbook</em>, the system automatically updates when new components or policies appear.<br>This prevents the LLM from summarizing or “simplifying away” critical structure — a direct defense against brevity bias and context collapse.</p><p>For example, in our <a href="https://medium.com/design-systems-collective/building-a-modern-visual-cms-with-google-ai-studio-our-journey-toward-an-ai-native-design-system-3f1f9b27a67b">Visual CMS project</a>,</p><p>we applied ACE principles to teach an AI how to <em>understand and generate component-based interfaces.</em></p><p>The system learned not just “what components exist,” but <em>how to use them correctly</em> — combining a living <strong>specification</strong>, evolving <strong>policy</strong>, and curated <strong>examples</strong> into a single self-updating context.</p><p>This alignment between ACE and component-driven design produced an AI that could autonomously compose valid, idiomatic UI trees while continuously refining its internal playbook as the design system evolved.</p><h3>ACE and Design Systems: How to Build an Adaptive Design Language</h3><p>Design systems are living organisms — and anyone who’s run one knows how quickly they decay.<br> Component specs drift out of sync with real implementations, Figma libraries fork in silence, and “best practices” become folklore.</p><p><strong>Agentic Context Engineering (ACE)</strong> offers a blueprint for fixing that by applying <em>the same adaptive feedback architecture that helps LLMs self-improve</em> to the way teams manage their design systems.</p><p>Here’s what that looks like when put into practice:</p><h3>1. Generator → Reflector → Curator for UI Teams</h3><ul><li><strong>Generator:</strong> Designers, developers, or even AI co-pilots propose new components, patterns, or tokens. Each proposal includes not just design intent but the context — why it exists, what problem it solves, and the design constraints.</li><li><strong>Reflector:</strong> Automated validators (linting, accessibility audits, usability test reports, or even AI reviewers) analyze how these new patterns behave in real usage. They identify mismatches: accessibility gaps, visual inconsistencies, or over-complex props.</li><li><strong>Curator:</strong> A service or script merges verified insights back into the system — updating component documentation, adding design tokens, or generating a “delta entry” in a JSON/YAML playbook (think: component_policy.json).</li></ul><p>This mirrors ACE’s <strong>incremental delta update</strong> model: instead of rewriting the entire design system guide when a component changes, you add precise, atomic updates — small edits that accumulate into a continuously improving knowledge base.</p><h3>2. Adaptive Documentation in Action</h3><p>Traditional design docs are static snapshots; ACE turns them into a <strong>living memory</strong>.</p><p>For example:</p><ul><li>Each time a button component triggers a usability complaint, the Reflector logs it as a delta — “Button hover state fails WCAG contrast under light theme.”</li><li>The Curator integrates that delta into the style spec and updates future scaffolds automatically.</li><li>When an AI design assistant (like the one in our <a href="https://medium.com/design-systems-collective/building-a-modern-visual-cms-with-google-ai-studio-our-journey-toward-an-ai-native-design-system-3f1f9b27a67b">Visual CMS project</a>) generates a new layout, it references the latest playbook — which now includes that fix.</li></ul><p>You now have <strong>adaptive documentation</strong>: design knowledge that updates itself through feedback loops, rather than waiting for a design-ops sprint.</p><h3>3. The Grow-and-Refine Loop for Components</h3><p>Borrowing from ACE’s “grow-and-refine” principle</p><ul><li><strong>Grow</strong> when new patterns emerge (introduce a new Card variant, layout grid, or interaction).</li><li><strong>Refine</strong> by merging overlapping or obsolete patterns (remove duplicates, unify typography tokens).</li></ul><p>This ensures your design system expands intelligently — always evolving but never bloating.</p><h3>4. Why It Matters</h3><p>The payoff is huge:</p><ul><li><strong>Consistency improves</strong> because new patterns are validated and integrated immediately.</li><li><strong>Documentation debt disappears</strong>, since changes are recorded as structured deltas, not forgotten meeting notes.</li><li><strong>AI co-design tools get smarter</strong>, learning from every iteration to produce better, on-brand UIs.</li></ul><p>ACE essentially transforms your design system from a static rulebook into a <em>context-adaptive design brain</em> — one that observes, learns, and evolves like a well-trained AI model.</p><h3>Why the Playbook Paradigm Wins</h3><p>ACE demonstrates that <strong>detail isn’t the enemy of scalability — it’s the foundation of it.</strong><br> A comprehensive playbook enables agents to reason consistently, integrate new data fluidly, and improve autonomously — without ever losing prior knowledge.</p><p>In real deployments, ACE reduced adaptation latency by <strong>86.9% on average</strong> while improving reliability and interpretability.</p><p>The message is clear:</p><blockquote><em>The future of scalable, self-improving AI isn’t hidden in the model’s weights.<br>It’s written — in detail — in the </em>context<em> that teaches the model how to think.</em></blockquote><h3>Research Reference</h3><p>For a deep dive into the methodology and empirical results of ACE, see the paper:<br>Agentic Context Engineering: Evolving Contexts for Self‑Improving Language Models (Zhang et al., 2025). <a href="https://www.arxiv.org/abs/2510.04618">arXiv</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5dd66fd8911" width="1" height="1" alt=""><hr><p><a href="https://www.designsystemscollective.com/the-end-of-context-collapse-why-agentic-context-engineering-ace-is-the-blueprint-for-scalable-d5dd66fd8911">The End of Context Collapse: Why Agentic Context Engineering (ACE) Is the Blueprint for Scalable…</a> was originally published in <a href="https://www.designsystemscollective.com/">Design Systems Collective</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Modern Visual CMS with Google AI Studio: Our Journey Toward an AI-Native Design System]]></title>
            <link>https://www.designsystemscollective.com/building-a-modern-visual-cms-with-google-ai-studio-our-journey-toward-an-ai-native-design-system-3f1f9b27a67b?source=rss-682f45aafc6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f1f9b27a67b</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[aistudio]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[design-systems]]></category>
            <dc:creator><![CDATA[Aman Jain]]></dc:creator>
            <pubDate>Tue, 14 Oct 2025 10:15:39 GMT</pubDate>
            <atom:updated>2025-10-18T05:34:00.060Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Tr7q1gM9CRLnFMJATSx9Q.png" /></figure><p>When we started this journey, the vision was ambitious but clear: to create more than just a page builder. We wanted to build a <strong>modern, developer-friendly visual Content Management System (CMS)</strong> that respected the principles of structured, component-based architecture while offering the effortless creativity of visual editing.</p><p>But our mission eventually grew beyond that. We didn’t just build a CMS — we built a <strong>system designed to teach an AI how to use our CMS like an expert</strong>, enabling users to generate entire page layouts from a single prompt.</p><p>This is the story of how we achieved that — blending the craftsmanship of good engineering, the elegance of thoughtful UX, and the intelligence of AI.</p><h3>Phase 1: The Foundation — Structure and Style</h3><p>We began with the basics: a solid architectural core that could scale.</p><h4>1. Component-First Data Model</h4><p>We defined a flexible CustomComponent structure capable of representing both standard HTML elements (div, p, img) and advanced, reusable React components like Card, Carousel, or HeroSection. This gave us a unified component tree that could model any layout with precision and consistency.</p><h4>2. The Core Editor Panels</h4><p>Two foundational tools shaped our UI:</p><ul><li><strong>The Component Selector</strong> for exploring and navigating the page structure.</li><li><strong>The Style Editor</strong> for modifying visual properties of any selected component.</li></ul><h4>3. Intelligent Styling</h4><p>We resisted the temptation to create a flat list of CSS properties. Instead, we built a <strong>context-aware Style Editor</strong> — one that knows when to show Flexbox controls or when to hide irrelevant options, making the UI intuitive and intelligent.</p><h3>Phase 2: A World-Class User Experience</h3><p>A functional tool isn’t enough. It has to feel good to use.</p><h4>The Dynamic Panel System</h4><p>We implemented a <strong>draggable, resizable, dockable</strong> panel system — turning our web application into a <strong>desktop-grade design studio</strong>. Users could tailor their workspace to their preferences, giving a sense of mastery and control.</p><h4>Intuitive Interaction</h4><p>From right-click context menus to copy-paste of styles and wizards for complex tasks (like the <strong>FlexGrid Wizard</strong>), we added UX elements that balanced simplicity with depth.</p><h4>Guidance and Help</h4><p>To keep power accessible, we added inline HelpTooltips and a full <strong>Help Center</strong>, ensuring users understood the capabilities without being overwhelmed.</p><h3>Phase 3: Unleashing True Design Power</h3><p>At this stage, we evolved from a visual editor into a <strong>true design system</strong>.</p><h4>Style Sets — The Game Changer</h4><p>Managing consistency across a large site is hard. So, we built <strong>Style Sets</strong> — reusable, inheritable design tokens that act like visually managed CSS classes.<br> A “Heading” Style Set could define typography and margins, while a “Sub-heading” inherited it and simply changed the font size.<br> This system empowered large-scale visual consistency with minimal redundancy.</p><h4>Responsive Design as a First-Class Citizen</h4><p>We built a <strong>Breakpoint Manager</strong> to make responsive design integral to the workflow, not an afterthought. The <strong>Breakpoint Review Tool</strong> offered a unified view of all styles across screen sizes — a massive productivity leap for real-world designs.</p><h3>Phase 4: Expanding Beyond the Basics</h3><p>Once the foundation was rock-solid, we expanded into high-value features.</p><h4>Custom Components &amp; Interactivity</h4><p>From a configurable Carousel to a powerful Button that could trigger AJAX requests or toggle component visibility, we introduced interactivity without breaking simplicity.</p><h4>Developer-Focused Additions</h4><p>We built a Code component for raw HTML and even an <strong>MJML Exporter</strong>, allowing web designs to be converted into production-ready email templates — a huge technical milestone.</p><h4>Polished Animations</h4><p>The useScrollAnimation hook empowered designers to add scroll-triggered fade-in or slide-in effects directly from the UI.<br> Little details that make experiences feel alive.</p><h3>Phase 5: Teaching the AI — Building the CMS for Humans and Machines</h3><p>This is where things truly became groundbreaking.<br> We weren’t content with just building a CMS for people — we wanted it to be <strong>AI-native</strong>, capable of collaboration with generative models via <strong>Google AI Studio</strong>.</p><p>The goal:</p><blockquote><em>To teach an AI how to use our CMS like an expert designer, so that users could generate entire page layouts from a single natural-language prompt.</em></blockquote><p>Here’s how we achieved that, through three key pillars:</p><h4>1. The Component Specification (specGenerator.ts) — The Dictionary</h4><p>Our first challenge was simple but profound:<br> How does an AI understand what a Card or Carousel is?<br> How does it know which properties a component supports or which style rules apply only when certain conditions (like display: flex) are met?</p><p>We built the <strong>Spec Generator</strong>, which automatically:</p><ul><li>Scans the componentRegistry to list all available components.</li><li>Analyzes the styleService to catalog all visual properties.</li><li>Produces a structured JSON “dictionary” — the ground truth of our UI world.</li></ul><p>This <strong>spec file</strong> serves as an API reference for our front-end design system, giving the AI perfect contextual awareness of every building block.</p><h4>2. The Generation Policy (generatePolicySpec()) — The Rulebook</h4><p>Knowledge alone isn’t enough.<br> The AI needed <em>wisdom</em> — rules, constraints, and best practices.</p><p>So, we built a <strong>Policy Generator</strong> that converts the structured spec into a human-readable Markdown guide for AI. It’s the <strong>style manual</strong> of our design system.</p><p>It teaches:</p><ul><li>Never omit the name property.</li><li>Distinguish between <strong>props</strong> (for custom components) and <strong>attributes</strong> (for HTML elements).</li><li>Follow our golden principle: <strong>Composition Over Configuration.</strong></li></ul><p>If the spec is <em>what exists</em>, the policy defines <em>how to use it correctly.</em></p><h4>3. The Default Example (initialState.ts) — The Blueprint</h4><p>We know that examples are the best teachers.<br> So, our initial state wasn’t a trivial “Hello, World.” Instead, it was a <strong>comprehensive Component Showcase</strong> — a live demonstration of layout hierarchies, component usage, and even advanced styling like hover effects.</p><p>When we feed this to Google AI Studio, it becomes a <strong>few-shot learning prompt</strong>.<br> The AI sees patterns, understands composition, and learns what “good” looks like — producing structured, idiomatic component trees in response to prompts like:</p><blockquote><em>“Create a three-card feature section with a headline and CTA.”</em></blockquote><h3>The Synergy: Creating an AI Co-Pilot</h3><p>Together, these three layers — <strong>Spec, Policy, and Example</strong> — transform a general-purpose AI into a <strong>domain-expert co-pilot</strong> for our CMS.</p><ul><li>The <strong>Spec</strong> gives it perfect factual knowledge.</li><li>The <strong>Policy</strong> enforces the grammar of good design.</li><li>The <strong>Example</strong> provides real-world context and aesthetics.</li></ul><p>By auto-generating these artifacts on every editor load, we made it easy for developers or AI agents to “learn” our system instantly — paving the way for seamless AI-assisted content generation and visual design.</p><h3>What We Built Together</h3><p>Looking back, what we’ve built is more than a product.<br> It’s a <strong>platform</strong>, a <strong>learning system</strong>, and a <strong>vision</strong> of how humans and AI can co-create the future of design.</p><p>Our CMS now stands as a:</p><ul><li>Flexible, component-driven design environment.</li><li>Professional, panel-based editing workspace.</li><li>Fully AI-aware ecosystem — bridging natural language with structured visual composition.</li><li>Living blueprint for the next generation of intelligent, collaborative content creation tools.</li></ul><p>This journey wasn’t just about software. It was about reimagining what a CMS could be — not just <strong>a tool to design with</strong>, but <strong>a system that designs with you</strong>.</p><p><strong><em>specGenerator.ts</em></strong></p><pre>import type { CustomPropGroupDefinition, StyleCategoryDefinition, StylePropertyDefinition, StyleSubGroupDefinition, ExtendedCSSProperties } from &#39;../types&#39;;<br>import { componentRegistry, TEXT_EDITABLE_TAGS } from &#39;./componentRegistry&#39;;<br>import { getApplicableAttributes } from &#39;./htmlAttributeService&#39;;<br>import { getApplicableProperties, styleCategories } from &#39;./styleService&#39;;<br><br>/**<br> * A version of StyleCategoryDefinition for the spec, where sub-groups are references.<br> */<br>type SpecStyleCategoryDefinition = Omit&lt;StyleCategoryDefinition, &#39;subGroups&#39;&gt; &amp; {<br>    subGroups: readonly { $ref: string }[];<br>};<br><br>/**<br> * Defines the specification for a single configurable component.<br> */<br>export interface ComponentSpec {<br>  type: string; // e.g., &#39;div&#39;, &#39;Card&#39;<br>  category: &#39;custom&#39; | &#39;html&#39;;<br>  description: string;<br>  canHaveChildren: boolean;<br>  canHaveContent: boolean;<br>  // All configurable properties (custom props for components, attributes for HTML elements)<br>  settings: (CustomPropGroupDefinition | { $ref: string })[];<br>  // All applicable style properties, grouped into the same categories as the UI<br>  // FIX: Updated applicableStyles to use SpecStyleCategoryDefinition to match the generated structure.<br>  applicableStyles: readonly SpecStyleCategoryDefinition[];<br>}<br><br>/**<br> * Defines all reusable parts of the component system.<br> */<br>interface SystemDefinitions {<br>    styleProperties: Record&lt;string, StylePropertyDefinition&gt;;<br>    styleSubGroups: Record&lt;string, StyleSubGroupDefinition&gt;;<br>    propDefinitions: Record&lt;string, CustomPropGroupDefinition&gt;;<br>}<br><br>/**<br> * Defines the base schema for a CustomComponent instance, following JSON Schema conventions.<br> */<br>interface ComponentBaseSchema {<br>    description: string;<br>    type: &#39;object&#39;;<br>    properties: Record&lt;string, { type: string; description: string }&gt;;<br>    required: readonly string[];<br>}<br><br>/**<br> * Defines the complete specification for all components in the system.<br> */<br>export interface SystemSpec {<br>  definitions: SystemDefinitions;<br>  components: ComponentSpec[];<br>  baseSchema: ComponentBaseSchema;<br>}<br><br>// Hardcoded descriptions for clarity. These could be expanded.<br>const componentDescriptions: Record&lt;string, string&gt; = {<br>    // HTML Elements<br>    div: &quot;A generic container for grouping content. The primary block for layout.&quot;,<br>    p: &quot;A paragraph of text.&quot;,<br>    h1: &quot;A top-level heading for a page or section.&quot;,<br>    button: &quot;An interactive button that can be clicked by the user. Note: for actions, use the custom &#39;Button&#39; component.&quot;,<br>    span: &quot;An inline container for a small piece of content, often used to style parts of a text.&quot;,<br>    img: &quot;An element to embed an image into the page. Note: for drag-and-drop, use the custom &#39;Image&#39; component.&quot;,<br>    a: &quot;A hyperlink to another web page, file, or location.&quot;,<br>    section: &quot;A thematic grouping of content, typically with a heading.&quot;,<br>    // Custom Components<br>    Card: &quot;A custom component that presents content and actions about a single subject in a container with a border and optional shadow.&quot;,<br>    Image: &quot;A custom component for displaying images with built-in drag-and-drop upload functionality.&quot;,<br>    Button: &quot;A custom, interactive button that can trigger actions on other components, such as showing, hiding, or fetching data.&quot;,<br>    Carousel: &quot;A custom component for displaying a slideshow of other components in an interactive carousel.&quot;,<br>    FlexGrid: &quot;A custom component that creates a flexible grid layout with configurable columns and gaps.&quot;,<br>    Code: &quot;A custom component that renders raw HTML content.&quot;,<br>};<br><br>const VOID_ELEMENTS = new Set([&#39;img&#39;]);<br>const toCamelCase = (str: string) =&gt; str.replace(/([A-Z])/g, &#39; $1&#39;).replace(/[^a-zA-Z0-9]+(.)?/g, (m, c) =&gt; c ? c.toUpperCase() : &#39;&#39;).replace(/^./, (s) =&gt; s.toLowerCase());<br><br><br>/**<br> * Generates a detailed, normalized specification for all available components in the system.<br> * The output uses a `definitions` object and `$ref` pointers to avoid repetition.<br> * @returns {SystemSpec} A comprehensive specification object.<br> */<br>export const generateComponentSpecs = (): SystemSpec =&gt; {<br>    const specs: ComponentSpec[] = [];<br>    const HTML_TAGS_TO_SPEC = [&#39;div&#39;, &#39;section&#39;, &#39;p&#39;, &#39;h1&#39;, &#39;button&#39;, &#39;span&#39;, &#39;img&#39;, &#39;a&#39;];<br><br>    const definitions: SystemDefinitions = {<br>        styleProperties: {},<br>        styleSubGroups: {},<br>        propDefinitions: {},<br>    };<br>    <br>    // 1. Populate Definitions<br>    // Populate all unique style properties<br>    styleCategories.forEach(cat =&gt; {<br>        cat.subGroups.forEach(sub =&gt; {<br>            sub.properties.forEach(prop =&gt; {<br>                definitions.styleProperties[prop.name as string] = prop;<br>            });<br>        });<br>    });<br><br>    // Populate all unique style sub-groups with references<br>    styleCategories.forEach(cat =&gt; {<br>        cat.subGroups.forEach(sub =&gt; {<br>            const subGroupId = toCamelCase(sub.name);<br>            definitions.styleSubGroups[subGroupId] = {<br>                ...sub,<br>                properties: sub.properties.map(prop =&gt; ({ $ref: `#/definitions/styleProperties/${prop.name as string}` } as any)),<br>            };<br>        });<br>    });<br>    <br>    // Populate all unique prop groups from custom components and attributes<br>    Object.values(componentRegistry).forEach(reg =&gt; {<br>        reg.propGroups.forEach(group =&gt; {<br>            const groupId = toCamelCase(group.name);<br>            definitions.propDefinitions[groupId] = group;<br>        });<br>    });<br>    const attrGroup: CustomPropGroupDefinition = {<br>        name: &#39;HTML Attributes&#39;,<br>        properties: [<br>            ...getApplicableAttributes(&#39;a&#39;) || [],<br>            ...getApplicableAttributes(&#39;img&#39;) || [],<br>        ]<br>    };<br>    definitions.propDefinitions[&#39;htmlAttributes&#39;] = attrGroup;<br><br><br>    // 2. Generate Component Specs with References<br><br>    /**<br>     * Helper function to create a referenced structure of applicable styles for a component type.<br>     */<br>    const getReferencedApplicableStyles = (type: string): readonly SpecStyleCategoryDefinition[] =&gt; {<br>        const applicablePropNames = getApplicableProperties(type, {});<br>        const applicablePropSet = new Set(applicablePropNames);<br><br>        return styleCategories.map(category =&gt; {<br>            const subGroups = category.subGroups<br>                .filter(subGroup =&gt; subGroup.properties.some(prop =&gt; applicablePropSet.has(prop.name)))<br>                .map(subGroup =&gt; ({ $ref: `#/definitions/styleSubGroups/${toCamelCase(subGroup.name)}` }));<br>            return { ...category, subGroups };<br>        }).filter(category =&gt; category.subGroups.length &gt; 0);<br>    };<br><br>    // Process Custom Components<br>    for (const [name, registration] of Object.entries(componentRegistry)) {<br>        specs.push({<br>            type: name,<br>            category: &#39;custom&#39;,<br>            description: componentDescriptions[name] || `A custom ${name} component.`,<br>            canHaveChildren: name !== &#39;Image&#39; &amp;&amp; name !== &#39;Button&#39;,<br>            canHaveContent: name === &#39;Button&#39;,<br>            settings: registration.propGroups.map(group =&gt; ({ $ref: `#/definitions/propDefinitions/${toCamelCase(group.name)}` })),<br>            applicableStyles: getReferencedApplicableStyles(name),<br>        });<br>    }<br><br>    // Process standard HTML Elements<br>    for (const tag of HTML_TAGS_TO_SPEC) {<br>        const settings: (CustomPropGroupDefinition | { $ref: string })[] = [];<br>        const applicableAttributes = getApplicableAttributes(tag);<br>        if (applicableAttributes &amp;&amp; applicableAttributes.length &gt; 0) {<br>            // Find which properties of the main &#39;htmlAttributes&#39; group apply to this tag.<br>            const applicableAttrNames = new Set(applicableAttributes.map(a =&gt; a.name));<br>            const filteredGroup: CustomPropGroupDefinition = {<br>                name: &#39;HTML Attributes&#39;,<br>                properties: definitions.propDefinitions.htmlAttributes.properties.filter(p =&gt; applicableAttrNames.has(p.name))<br>            }<br>            if (filteredGroup.properties.length &gt; 0) {<br>                // This is a bit of a workaround since we don&#39;t have per-tag attribute groups<br>                // We inline a filtered version of the main attribute group.<br>                 settings.push(filteredGroup);<br>            }<br>        }<br>        <br>        specs.push({<br>            type: tag,<br>            category: &#39;html&#39;,<br>            description: componentDescriptions[tag] || `A standard HTML &lt;${tag}&gt; element.`,<br>            canHaveChildren: !VOID_ELEMENTS.has(tag),<br>            canHaveContent: TEXT_EDITABLE_TAGS.has(tag),<br>            settings,<br>            applicableStyles: getReferencedApplicableStyles(tag),<br>        });<br>    }<br>    <br>    // 3. Define the base schema for a component instance.<br>    const baseSchema: ComponentBaseSchema = {<br>        description: &quot;The fundamental structure for any component instance in the page tree.&quot;,<br>        type: &#39;object&#39;,<br>        properties: {<br>          id: { type: &#39;string&#39;, description: &quot;A unique identifier for the component (e.g., &#39;comp-12345&#39;).&quot; },<br>          name: { type: &#39;string&#39;, description: &quot;A human-readable name for the editor&#39;s component tree.&quot; },<br>          type: { type: &#39;string&#39;, description: &quot;The component type, either a lowercase HTML tag or a PascalCase custom component name.&quot; },<br>          styles: { type: &#39;object&#39;, description: &quot;A map of breakpoint IDs to style objects. Must include a &#39;base&#39; key for default styles.&quot; },<br>          props: { type: &#39;object&#39;, description: &quot;(Optional) A map of key-value pairs for custom properties specific to a registered component.&quot; },<br>          attributes: { type: &#39;object&#39;, description: &quot;(Optional) A map of standard HTML attributes for HTML elements.&quot; },<br>          content: { type: &#39;string&#39;, description: &quot;(Optional) The direct text content of an element, used for text-based tags like &#39;p&#39;, &#39;h1&#39;, etc.&quot; },<br>          children: { type: &#39;array&#39;, description: &quot;(Optional) An array of nested component objects, forming the tree structure.&quot; },<br>        },<br>        required: [&#39;id&#39;, &#39;name&#39;, &#39;type&#39;, &#39;styles&#39;],<br>    };<br><br>    return { definitions, components: specs, baseSchema };<br>};<br><br>/**<br> * Generates a human-readable (and LLM-friendly) policy document in Markdown<br> * that outlines the rules for creating valid component JSON.<br> * @param systemSpec The machine-readable system specification.<br> * @returns A string containing the generation policy in Markdown format.<br> */<br>export const generatePolicySpec = (systemSpec: SystemSpec): string =&gt; {<br>    let policy = `<br># LLM Generation Policy for Component JSON<br><br>You are an expert at generating structured JSON for a web page builder. Adhere strictly to the following rules when creating the JSON output. Any deviation will result in invalid output.<br><br>---<br><br>### 1. Core Component Schema (MANDATORY FOR ALL COMPONENTS)<br>Every single component object, at every level of the tree, **MUST** have the following four properties:<br><br>- **\`id\` (string, required):** A unique identifier. Example: \`&quot;comp-123456&quot;\`.<br>- **\`name\` (string, required):** A human-readable name for the editor. Example: \`&quot;Hero Section&quot;\`. **DO NOT OMIT THIS.**<br>- **\`type\` (string, required):** The component&#39;s type. This can be a lowercase HTML element (e.g., \`&quot;div&quot;\`) or a \`PascalCase\` custom component (e.g., \`&quot;Card&quot;\`).<br>- **\`styles\` (object, required):** An object for styling rules. See the &quot;Styling Rules&quot; section below.<br><br>### 2. Property Usage Rules (\`props\` vs. \`attributes\`)<br>This is a strict rule. Do not confuse these two properties.<br><br>- **Use \`props\` for Custom Components:** For types like \`Card\`, \`Image\`, \`Button\`, \`Carousel\`, \`FlexGrid\`, \`Code\`. The **only** available props for each are listed at the end of this policy. Do not invent props.<br>- **Use \`attributes\` for standard HTML Elements:** For types like \`a\`, \`img\`, \`p\`. Use this for standard HTML attributes like \`href\` or \`src\`.<br><br>### 3. Styling Rules<br>The \`styles\` object has a specific structure that **MUST** be followed:<br><br>- It **MUST** contain a top-level key named **\`&quot;base&quot;\`**.<br>- The value of \`&quot;base&quot;\` is an object containing the CSS properties (in camelCase).<br><br>**INCORRECT:**<br>\`\`\`json<br>&quot;styles&quot;: {<br>  &quot;backgroundColor&quot;: &quot;#ffffff&quot;<br>}<br>\`\`\`<br><br>**CORRECT:**<br>\`\`\`json<br>&quot;styles&quot;: {<br>  &quot;base&quot;: {<br>    &quot;backgroundColor&quot;: &quot;#ffffff&quot;,<br>    &quot;padding&quot;: &quot;1rem&quot;<br>  }<br>}<br>\`\`\`<br><br>### 4. Composition Over Configuration (CRITICAL RULE)<br>Do not add properties to a component that are not explicitly defined in its specification. To build complex visuals, **nest components inside each other** using the \`children\` array.<br><br>- **INCORRECT:** Adding a \`price\` or \`image\` property to a \`Card\`.<br>  \`\`\`json<br>  // WRONG: &quot;Card&quot; does not have an &quot;image&quot; or &quot;price&quot; prop.<br>  { <br>    &quot;type&quot;: &quot;Card&quot;, <br>    &quot;props&quot;: { <br>      &quot;title&quot;: &quot;My Card&quot;, <br>      &quot;image&quot;: &quot;url...&quot;, <br>      &quot;price&quot;: &quot;$99.99&quot; <br>    }<br>  }<br>  \`\`\`<br>- **CORRECT:** Nesting an \`Image\` component and a \`p\` component *inside* the \`Card\`&#39;s \`children\` array.<br>  \`\`\`json<br>  // RIGHT: The Card contains other components that display the content.<br>  { <br>    &quot;type&quot;: &quot;Card&quot;, <br>    &quot;props&quot;: { &quot;title&quot;: &quot;My Card&quot; },<br>    &quot;children&quot;: [<br>      { &quot;type&quot;: &quot;Image&quot;, &quot;name&quot;: &quot;Card Image&quot;, &quot;props&quot;: { &quot;src&quot;: &quot;url...&quot; }, ... },<br>      { &quot;type&quot;: &quot;p&quot;, &quot;name&quot;: &quot;Card Price&quot;, &quot;content&quot;: &quot;$99.99&quot;, ... }<br>    ]<br>  }<br>  \`\`\`<br><br>---<br><br>### 5. Valid Component Properties<br>Only use the properties listed below for each custom component type. **DO NOT INVENT PROPERTIES.**<br><br>`;<br><br>    const customComponents = systemSpec.components.filter(c =&gt; c.category === &#39;custom&#39; &amp;&amp; c.settings.length &gt; 0);<br><br>    for (const comp of customComponents) {<br>        policy += `\n- **\`${comp.type}\`**\n`;<br>        const propGroups = comp.settings.map(s =&gt; {<br>            const ref = (s as { $ref: string }).$ref;<br>            if (ref) {<br>                const groupId = ref.split(&#39;/&#39;).pop()!;<br>                return systemSpec.definitions.propDefinitions[groupId];<br>            }<br>            return s as CustomPropGroupDefinition;<br>        });<br><br>        const propNames = propGroups.flatMap(g =&gt; g.properties.map(p =&gt; `\`${p.name}\``)).join(&#39;, &#39;);<br>        policy += `  - Valid \`props\`: ${propNames}\n`;<br>    }<br><br>    policy += `\n---\nFollow these rules precisely to ensure the generated JSON is valid.`;<br><br>    return policy.trim();<br>};</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f1f9b27a67b" width="1" height="1" alt=""><hr><p><a href="https://www.designsystemscollective.com/building-a-modern-visual-cms-with-google-ai-studio-our-journey-toward-an-ai-native-design-system-3f1f9b27a67b">Building a Modern Visual CMS with Google AI Studio: Our Journey Toward an AI-Native Design System</a> was originally published in <a href="https://www.designsystemscollective.com/">Design Systems Collective</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From React UI to Full Backend: How I Built an Inventory Management System with AI Agents]]></title>
            <link>https://medium.com/@amanjn53/from-react-ui-to-full-backend-how-i-built-an-inventory-management-system-with-ai-agents-e3442f8ccddd?source=rss-682f45aafc6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3442f8ccddd</guid>
            <category><![CDATA[codex-agent]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[google-ai-studio]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <dc:creator><![CDATA[Aman Jain]]></dc:creator>
            <pubDate>Thu, 25 Sep 2025 08:06:23 GMT</pubDate>
            <atom:updated>2025-09-25T08:06:23.548Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zrzIl2mh5GuSI4VjJWCOuQ.png" /></figure><p>Building a production-grade system has traditionally meant long cycles of frontend design, backend scaffolding, API contracts, and business rule enforcement. But with the right AI tools, much of this work can now be <strong>automated</strong>.</p><p>In this post, I’ll share how I used <strong>Google AI Studio</strong> and <strong>OpenAI Codex Agent</strong> to go from a <strong>React UI</strong> for an Inventory Management System (IMS) to a complete <strong>Java + Spring Boot + MySQL backend</strong> — with domain modeling, DTOs, business logic, and even cross-tenant data sharing.</p><h3>🔧 The Tools That Made It Happen</h3><ol><li><strong>Google AI Studio</strong></li></ol><ul><li>Rapidly prototyped and iterated on the IMS frontend.</li><li>Centralized all API calls into services/api.ts so the backend contract was crystal clear.</li></ul><ol><li><strong>OpenAI Codex Agent</strong></li></ol><ul><li>Analyzed the repo, ran the UI, and mapped APIs from services/api.ts.</li><li>Combined this with a <strong>Software Business Logic Spec</strong> I provided.</li><li>Generated backend code (entities, services, controllers, Flyway migrations).</li></ul><h3>🛠️ Structuring for Success</h3><p>Two deliberate choices set the stage:</p><ul><li><strong>Centralized API layer (</strong><strong>services/api.ts)</strong><br> I instructed my frontend team to put <em>all</em> API calls in one file. This meant Codex Agent had a single source of truth for UI–backend interaction. No scattered code, no ambiguity.</li><li><strong>Business Logic Specification</strong><br> Alongside the repo, I prepared a document describing rules like:</li><li>SKUs must be unique.</li><li>Stock cannot move if insufficient quantity exists.</li><li>Pools cannot be deleted if stock remains.</li><li>Transactions must be atomic and auditable.</li></ul><p>This gave Codex Agent <strong>both the contract and the rules</strong>.</p><h3>🤖 Round 1 with Codex Agent</h3><p>I ran Codex Agent with my prompt:</p><pre>You are a senior full-stack architect and backend engineer.  <br>You have access to a repository that contains a complete React-based Inventory Management System (IMS).  <br><br>Your tasks are:  <br><br>1. **Run the React UI** locally (`npm install` then `npm start`).  <br>   - Observe how the UI behaves.  <br>   - Capture all API calls (from `services/api.ts`).  <br>   - Identify the expected inputs, outputs, and workflows.  <br><br>2. **Reverse-engineer the business logic**:  <br>   - For each API (Pools, Locations, Items, Stock Lots, Transactions, Permissions, Users, Roles),  <br>     document the **business rules, constraints, and workflows**.  <br>   - Build the **domain model** showing relationships (e.g., Locations -&gt; Stock etc.).  <br><br>3. **Generate backend code** in **Java + Spring Boot + MySQL**:  <br>   - Create entities, repositories, services, and controllers matching the frontend contract.  <br>   - Implement business logic (e.g., unique SKU, stock checks, transactional stock movements).  <br>   - Implement audit trail via `stock_movements` table.  <br>   - Provide **Flyway migrations** for schema setup.  <br><br>4. **Output deliverables**:  <br>   - API specification (OpenAPI/Swagger).  <br>   - Business logic &amp; domain modeling document (Markdown).  <br>   - Complete Spring Boot backend project (Maven).  <br><br>Constraints:  <br>- Use **Spring Boot 3.x**, **Java 17+**, **JPA/Hibernate**.  <br>- Database: **MySQL** with **Flyway migrations**.  <br>- REST endpoints under `/api/v1/*`.  <br>- Controllers must align with frontend API calls (`services/api.ts`).  <br>- Services must enforce validations and transactional logic.  <br><br>Goal:  <br>Deliver a **production-ready backend implementation** that the IMS React frontend can use without modification.</pre><p>The result?</p><ul><li>DTOs that matched the frontend.</li><li>Business logic enforcing my rules.</li><li>Repositories and controllers aligned with api.ts.</li></ul><p>But… the code was <strong>rudimentary</strong>. It didn’t fit neatly into my existing backend framework.</p><h3>🔄 Round 2 — Teaching the Framework</h3><p>To fix this, I gave Codex Agent <strong>more context</strong>: I integrated a <strong>data-sharing framework</strong> to allow tenants to securely share stock reports.</p><ul><li>My <strong>framework outline</strong>: class and method definitions, no implementations.</li><li>An <strong>example class</strong> already implemented using the framework.</li><li>A strict instruction:</li></ul><pre>Use the data-sharing framework style as a guide -- use {{DomainEntity using framework}} as your reference point.  <br>Follow its class structure and method signatures.  <br>Do not alter the business logic — only adapt it to the framework conventions.</pre><p>This worked brilliantly. Codex Agent regenerated the code, but this time it:</p><ul><li>Matched my architecture.</li><li>Respected my framework’s abstractions.</li><li>Preserved all the business logic.</li></ul><p>Now, instead of code I had to refactor, I had <strong>production-ready components</strong> that dropped into my system seamlessly.</p><h3>⚠️ Lessons Learned</h3><p>While Codex Agent did a lot of heavy lifting, it wasn’t perfect:</p><ul><li>The generated <strong>business logic was only ~70–80% accurate</strong>.</li><li>Some <strong>bugs and logical gaps</strong> crept in (for example, corner cases in stock movement validation).</li><li>The <strong>spec wasn’t always followed exactly</strong> — Codex interpreted rules loosely in places.</li></ul><p>This meant that while the <strong>essence of the logic was correct</strong>, I still had to <strong>review, refine, and fix</strong> the code.</p><p>💡 <strong>Takeaway</strong>: Codex Agent is a great accelerator, but not a substitute for careful engineering oversight.</p><h3>📦 The Final Deliverables</h3><p>By combining Google AI Studio + Codex Agent + framework adaptation, I had:</p><ul><li><strong>React UI</strong> with all APIs in services/api.ts.</li><li><strong>DTOs</strong> perfectly aligned with the frontend.</li><li><strong>Business logic services</strong>: stock checks, SKU uniqueness, audit trails, transaction safety.</li><li><strong>Flyway migrations</strong>: schema for items, pools, locations, stock snapshots, stock movements.</li><li><strong>Controllers</strong> matching the frontend contract.</li><li><strong>Multi-tenant data sharing APIs</strong> for stock reports.</li></ul><p>All in a fraction of the time a traditional approach would take.</p><h3>⚡ Why This Matters</h3><p>Traditionally, building such a system would involve weeks of:</p><ul><li>Requirement workshops</li><li>API contract writing</li><li>Manual scaffolding</li><li>Endless backend–frontend sync</li></ul><p>With this workflow:</p><ul><li><strong>Google AI Studio</strong> → prototype UI quickly.</li><li><strong>Codex Agent + api.ts</strong> → infer contracts automatically.</li><li><strong>Business Logic Spec</strong> → enforce real-world rules.</li><li><strong>Framework examples</strong> → generate code in the right style.</li><li><strong>Data-sharing framework</strong> → enable advanced features like multi-tenant reporting.</li></ul><p>I went from a <strong>frontend-only repo → full-stack IMS application</strong> in days, not months.</p><h3>✅ Final Thoughts</h3><p>AI didn’t replace me as a developer — it accelerated me.</p><p>By giving Codex Agent the <strong>right context</strong> (APIs, business logic, framework), I transformed it from a code generator into a <strong>system builder</strong>.</p><p>This experiment shows that <strong>UI-driven + Spec-driven + Framework-guided backend generation</strong> isn’t just possible — it’s practical.</p><p>Would you try this workflow for your next project?</p><p>✍️ <em>If you enjoyed this experiment, follow me for more real-world stories about AI-powered development.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3442f8ccddd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Great Number Hide-and-Seek: Why Computers Sometimes Lose Track]]></title>
            <link>https://medium.com/@amanjn53/the-great-number-hide-and-seek-why-computers-sometimes-lose-track-cfb0f0f79761?source=rss-682f45aafc6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfb0f0f79761</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[floating-points]]></category>
            <category><![CDATA[computers]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Aman Jain]]></dc:creator>
            <pubDate>Tue, 16 Sep 2025 09:04:28 GMT</pubDate>
            <atom:updated>2025-09-16T09:04:28.412Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="The Great Number Hide-and-Seek" src="https://cdn-images-1.medium.com/max/1024/1*yIt0YAilZNWL9qFryTXoTQ.png" /></figure><p>Imagine a game of hide-and-seek. The players? Numbers. The seeker? Your computer. Most of the time, everyone gets found. But sometimes, a few sneaky numbers slip away, hiding so well that even the smartest computers forget them.</p><p>This mysterious game is called the <strong>floating-point problem</strong>. And believe it or not, it explains why even “thinking computers” (like ChatGPT and other Large Language Models, or LLMs) can sometimes give slightly different answers to the same question.</p><p>So, let’s meet our cast of characters in this number adventure.</p><h3>Meet the Players</h3><ul><li><strong>Biggie the Football Field (1230)</strong>: Huge, strong, and impossible to ignore.</li><li><strong>Tiny Ant (23.4)</strong>: Small but determined — wants to be counted too!</li><li><strong>Floaty the Dot</strong>: Loves to wander, shifting left and right to help numbers fit into the computer’s memory box.</li></ul><p>Together, they show us how computers juggle numbers.</p><h3>The Shrinking Suitcase</h3><p>Computers can’t carry every single detail of every number. Instead, they use a trick: pack numbers into a <strong>shrinking suitcase</strong> that only has room for a few important digits. The dot (Floaty) moves around to make big numbers smaller and small numbers bigger.</p><ul><li>Biggie (1230) becomes <strong>1.23 × 1⁰³</strong></li><li>Tiny Ant (0.486) becomes <strong>4.86 × 10⁻¹</strong></li></ul><p>It’s clever, but there’s a catch: if the suitcase is too full, <strong>someone gets squished out.</strong></p><h3>The Disappearing Ant</h3><p>Now watch what happens when Biggie and Tiny Ant try to travel together.</p><p>Biggie proudly takes up most of the suitcase. Tiny Ant squeezes in… but there isn’t enough room for all her details. The computer writes down:</p><p>1230 + 23.4 ≈ <strong>1250</strong></p><p>Tiny Ant’s “.4” disappears! She’s still there, but her contribution got lost in Biggie’s shadow.</p><p>💡 <strong>Did You Know?</strong><br> This “lost detail” is called <strong>rounding error</strong>. It happens because computers only keep a fixed number of digits, even if more exist in the real answer.</p><h3>The Unfair Game</h3><p>Normally, in math, the order doesn’t matter.<br> (2 + 3) + 4 = 2 + (3 + 4) → always 9.</p><p>But in floating-point land, the rules bend.</p><ul><li>If you let Biggie and his twin (-1230) cancel each other first, Tiny Ant gets noticed: Result = <strong>0.1</strong></li><li>But if Tiny Ant tries to tag along with Biggie before the cancellation, she vanishes: Result = <strong>0</strong></li></ul><p>Same numbers, different story. Floating points change the ending depending on the order of play.</p><p>💡 <strong>Did You Know?</strong><br> This bending of rules is called <strong>non-associativity</strong>. For floating-point numbers, (a + b) + c may not equal a + (b + c)!</p><h3>Why Smart Computers Care</h3><p>Large Language Models (LLMs) are powered by super-fast chips called GPUs. Imagine hundreds of kids all playing hide-and-seek with numbers at once, shouting results at the teacher. Depending on the order, some Tiny Ants vanish, some survive, and the final answer changes ever so slightly.</p><p>That’s why sometimes, when you ask an AI the same question twice, you don’t always get the exact same wording. It’s not being moody — it’s just that numbers played a different round of hide-and-seek.</p><p>💡 <strong>Did You Know?</strong><br> This unpredictability has a big name: <strong>nondeterminism</strong>. It’s what happens when small differences in calculations ripple through a giant system like an LLM.</p><h3>The Big Lesson</h3><p>Floating-point numbers are adventurous travelers. They squeeze into suitcases, shift their dots around, and sometimes leave little details behind. For everyday math, it doesn’t matter. But for giant AI models crunching billions of numbers, even tiny ants can tip the scales.</p><p>So next time your computer surprises you with a slightly different answer, remember:<br> ✨ It’s not magic — it’s the Great Number Hide-and-Seek.</p><p>🔍 Curious to see the “grown-up” detective report? Check out “<a href="https://thinkingmachines.ai/blog/defeating-nondeterminism-in-llm-inference">Defeating Nondeterminism in LLM Inference</a>” by Horace He and the Thinking Machines Lab team.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfb0f0f79761" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond the Hype: Architecting the Foundational Enterprise AI Agent]]></title>
            <link>https://medium.com/@amanjn53/beyond-the-hype-architecting-the-foundational-enterprise-ai-agent-5dbefb881c04?source=rss-682f45aafc6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5dbefb881c04</guid>
            <category><![CDATA[ai-strategy]]></category>
            <category><![CDATA[ai-architecture]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[generative-ai-use-cases]]></category>
            <category><![CDATA[enterprise-ai]]></category>
            <dc:creator><![CDATA[Aman Jain]]></dc:creator>
            <pubDate>Wed, 10 Sep 2025 08:10:12 GMT</pubDate>
            <atom:updated>2025-09-10T08:10:12.768Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Flat-style digital illustration with dark blue background. On the left, bold white text reads “Beyond the Hype: Architecting the Foundational Enterprise AI Agent.” On the right, icons represent enterprise AI elements: a smiling AI face inside a frame, a shield with a checkmark, a stacked server, and a business professional in a suit and tie. The composition symbolizes secure, modular AI systems for enterprises." src="https://cdn-images-1.medium.com/max/1024/1*QiL84dn41lVz8Vwsk5wTrw.png" /></figure><p>AI agents are no longer just hype — they are quickly becoming central to how enterprises will operate in the future. From automating routine tasks to enabling complex workflows, the potential is transformative. But moving from a proof-of-concept chatbot to a <strong>secure, reliable, and scalable enterprise AI agent</strong> is not as simple as plugging in a large language model (LLM).</p><figure><img alt="Mind map for — What is an Agent" src="https://cdn-images-1.medium.com/max/1024/1*mmGekXRZu9kFhP7IrNnjrg.png" /></figure><p>Enterprises that succeed will be those that treat AI agents not as experimental add-ons, but as <strong>strategic systems built on a solid architectural foundation</strong>.</p><h3>Why “Just Use an LLM” Fails Enterprises</h3><p>The instinct to rely on a single, powerful AI model is tempting. But in practice, it creates risks that most organizations cannot afford:</p><ul><li><strong>High Cost</strong> — Running massive models requires specialized hardware and spiraling infrastructure budgets.</li><li><strong>Security Concerns</strong> — Granting unrestricted access to sensitive data is a compliance nightmare.</li><li><strong>Unpredictability</strong> — Large models can go off-script, hallucinate, or produce responses that violate company policies.</li></ul><p>In short: <strong>bigger isn’t always better</strong>. The enterprise needs AI that is cost-efficient, trustworthy, and aligned with business rules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z0kFHpjn9lTuywHGilRZ4Q.png" /></figure><h3>The Enterprise AI Foundation</h3><p>Building the right foundation for AI agents requires rethinking design. The best-performing enterprise agents share three architectural principles:</p><h3>1. Modularity for Control</h3><p>Instead of relying on one “black box” model, enterprises use smaller, specialized components for different tasks — such as understanding intent, enforcing permissions, and formatting responses. This makes systems easier to secure, audit, and optimize.</p><h3>2. The Right Model for the Right Task</h3><p>Not every task needs a massive AI. Lightweight models can handle routine understanding and formatting tasks quickly and cheaply, while larger models are reserved for complex reasoning. This “fit-for-purpose” approach balances performance with cost.</p><h3>3. Local-First for Security and Efficiency</h3><p>Running AI models on local infrastructure, rather than in the cloud, addresses two enterprise priorities: <strong>data privacy and cost savings</strong>. This shift ensures that sensitive information never leaves company-controlled environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a6k7OffkhExcwLUR8t62gw.png" /></figure><h3>Orchestrating Intelligence</h3><p>An enterprise AI agent isn’t a single tool — it’s a system of coordinated capabilities. Organizations can start small with a <strong>single-agent system</strong>, where one agent executes workflows with clear boundaries.</p><p>As needs grow, <strong>multi-agent systems</strong> become powerful:</p><ul><li>A <strong>manager agent</strong> can delegate tasks to specialized sub-agents.</li><li>Or a <strong>peer-to-peer model</strong> lets agents hand off tasks to each other.</li></ul><p>The orchestration strategy should evolve with business complexity, ensuring flexibility without unnecessary overhead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OSIinn6k7lWqcU7Ss9zYMw.png" /></figure><h3>Guardrails: Building Trust Into the System</h3><p>Perhaps the most overlooked part of enterprise AI is <strong>trust</strong>. Without safeguards, enterprises risk compliance violations, reputational damage, and even financial losses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oCejNXkAmQK2ZNXG5t4_iA.png" /></figure><p>That’s why robust guardrails are essential:</p><ul><li>Blocking unsafe or off-topic inputs.</li><li>Protecting personal and sensitive data.</li><li>Enforcing role-based access to tools and systems.</li><li>Ensuring outputs align with company policies and formats.</li></ul><p>Equally important: keeping a <strong>human in the loop</strong> for high-risk actions. This combination of automation + oversight builds confidence and long-term reliability.</p><h3>Beyond Technology: Strategic Adoption</h3><p>Even the best-designed AI agents fail without the right organizational approach. Lessons from leading companies highlight key strategies:</p><ul><li><strong>Start Small, Measure Often</strong> — Use structured evaluations to improve performance before scaling.</li><li><strong>Integrate AI into Products and Processes</strong> — Make AI part of daily workflows, not an isolated tool.</li><li><strong>Invest Early</strong> — Early adoption compounds learning and competitive advantage.</li><li><strong>Tailor AI to Your Business</strong> — Fine-tuned models aligned with organizational data outperform generic ones.</li><li><strong>Empower Experts</strong> — Let employees closest to the work experiment with and shape AI-driven solutions.</li><li><strong>Automate Boldly</strong> — Free teams from repetitive work so they can focus on innovation.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QiqrCUqvK17IrWOmK7c1dg.png" /></figure><h3>Conclusion: Building for the Future</h3><p>The path to enterprise-ready AI agents isn’t about quick fixes or flashy demos. It’s about building a <strong>deliberate foundation</strong>:</p><ul><li><strong>Modular and efficient</strong> systems that use the right tools for the right job.</li><li><strong>Secure by design</strong>, with permission layers and local-first execution.</li><li><strong>Predictable and trustworthy</strong>, reinforced by guardrails and human oversight.</li><li><strong>Strategically aligned</strong>, delivering measurable business outcomes.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zk0WVzXvK4euzHkERi-7Sg.png" /></figure><p>By approaching AI agents as <strong>enterprise systems, not experiments</strong>, leaders can ensure these technologies evolve into trusted assets — driving efficiency, adaptability, and innovation across the organization.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mrGChWdbliTsQm9pOizR-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tqVDX2A6SI3mxVXL2ntEKQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5dbefb881c04" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an AI Agent in Java with Embabel and Ollama (DeepSeek-R1:8B)]]></title>
            <link>https://medium.com/@amanjn53/building-an-ai-agent-in-java-with-embabel-and-ollama-deepseek-r1-8b-d9d982fd2c4e?source=rss-682f45aafc6b------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9d982fd2c4e</guid>
            <category><![CDATA[ollama]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[embabel]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[task-automation]]></category>
            <dc:creator><![CDATA[Aman Jain]]></dc:creator>
            <pubDate>Fri, 05 Sep 2025 04:02:57 GMT</pubDate>
            <atom:updated>2025-09-05T04:09:59.006Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="A flowchart-style digital illustration showing how an intent extraction agent processes a user request, breaks it into atomic tasks, maps each task to a specialized agent (Sales, Purchase, Report Summarization, Email Sending), and then executes them in sequence to deliver the final output." src="https://cdn-images-1.medium.com/max/1024/1*VgTJWhxCYuPp0HftQkmOqQ.png" /></figure><p>AI agents are no longer just experimental chatbots. In modern applications, they’re <strong>intent extractors, decision makers, and task delegators</strong>. Imagine a system where you tell your assistant:</p><blockquote><em>“Get me the sales summary and purchase summary, then send it to John Doe.”</em></blockquote><p>The assistant should <strong>understand your request</strong>, <strong>break it into atomic tasks</strong>, and <strong>delegate those tasks</strong> to the right sub-agents — all without you writing tons of boilerplate orchestration logic.</p><p>That’s exactly what I set out to build. In this article, I’ll show you how I combined <a href="https://github.com/embabel"><strong>Embabel</strong></a> — a Java agent framework — with <strong>Ollama</strong> running <strong>DeepSeek-R1:8B</strong> to build an <strong>Intent Extraction Agent</strong> that makes this possible.</p><h3><strong>Why Embabel?</strong></h3><p>Normally, wiring an AI agent in Java means manually coding:</p><ul><li>Controllers and service layers.</li><li>Prompt construction for the LLM.</li><li>Parsing unstructured model output.</li><li>Orchestrating workflows across multiple modules.</li></ul><p><strong>Embabel simplifies all of this.</strong></p><ul><li>You define <strong>goals</strong> (@Goal) and <strong>actions</strong> (@Action).</li><li>The framework handles orchestration and execution.</li><li>Structured responses are automatically mapped into Java objects.</li><li>You focus on <strong>business-specific logic</strong>, not AI plumbing.</li></ul><p>This makes Embabel especially powerful for Java/Spring developers who want to plug AI agents into their existing ecosystems.</p><h3><strong>Why Ollama + DeepSeek-R1:8B?</strong></h3><p>Running large language models locally is now practical thanks to Ollama.</p><ul><li><strong>Ollama</strong> lets you run models like Mistral, Llama3, Phi3, and DeepSeek entirely on your machine.</li><li><strong>DeepSeek-R1:8B</strong> is reasoning-focused and relatively lightweight, making it great for local agent tasks like intent extraction.</li><li>No cloud dependency, no data leakage — everything runs in your environment.</li></ul><p>In application.properties, we configure Embabel to use Ollama + DeepSeek as the default brain for our agents:</p><pre>embabel.models.defaultLlm=deepseek-r1:8b<br>embabel.agent.platform.ranking.llm=deepseek-r1:8b</pre><h3>A Problem I Hit Along the Way</h3><p>Initially, I tried using <strong>Llama3.2:1b</strong> as the model behind Embabel’s <strong>ranking LLM</strong> — the component responsible for choosing which agent should handle a user’s input.</p><p>The issue?</p><ul><li><strong>Llama3.2:1b</strong> wasn’t accurately following the strict instructions.</li><li>Instead of keeping agent names exactly as defined, it would <strong>return slightly altered versions</strong> or even generate free text.</li><li>This broke the delegation flow, since Embabel relies on exact matches between <em>intents</em> and <em>agents</em>.</li></ul><p>Switching to <strong>DeepSeek-R1:8B</strong> solved this problem. It was far more <strong>deterministic</strong>, followed the rules, and consistently returned exactly the mapped agent names I asked for.</p><p>This was a key lesson:<br> 👉 <em>Choosing the right model for each agent’s responsibility matters more than just using the “biggest” one.</em></p><h3>Architecture</h3><p>Here’s the high-level flow:</p><pre>User Input<br>   ↓<br>Intent Extraction Agent (Embabel + DeepSeek)<br>   ↓<br>Tasks (Sales report, Purchase report, Summarization, Send)<br>   ↓<br>Delegated to Placeholder Agents:<br>   - Sales Reporting Agent<br>   - Purchase Reporting Agent<br>   - Report Summarization Agent<br>   - Email Sending Agent</pre><p>The <strong>Intent Extraction Agent</strong> is the entry point. It breaks down user input into atomic tasks and maps them to the right downstream agents.</p><h3>Implementation</h3><p>Let’s walk through the code.</p><h3>1. Intent-to-Agent Mapping</h3><p>We need a way to map <strong>intents</strong> (like fetch_sales_report) to <strong>agents</strong> (like Sales Reporting Agent).</p><pre>public class IntentAndAgent {<br>    private String intent;<br>    private String agent;<br>    // getters and setters...<br>}</pre><p>And the mapping class:</p><pre>public class IntentAndAgentMap implements PromptContributor {<br>    private List&lt;IntentAndAgent&gt; intentAndAgentList = new ArrayList&lt;&gt;();</pre><pre>    public void addIntentAndAgent(String intent, String agent) {<br>        IntentAndAgent intentAndAgent = new IntentAndAgent();<br>        intentAndAgent.setIntent(intent);<br>        intentAndAgent.setAgent(agent);<br>        intentAndAgentList.add(intentAndAgent);<br>    }</pre><pre>    @Override<br>    public String contribution() {<br>        return intentAndAgentList.stream()<br>            .map(a -&gt; a.getIntent() + &quot;: &quot; + a.getAgent())<br>            .collect(Collectors.joining(&quot;\n&quot;));<br>    }<br>}</pre><p>This is like our <strong>lookup table</strong> for routing.</p><h3>2. Response Schema</h3><p>We want structured output, not free text. So we define a schema:</p><pre>public class Task {<br>    private String intent;<br>    private String target;<br>    private String[] dependsOn;<br>    // getters and setters...<br>}</pre><pre>public class IntentExtractionResponse {<br>    private List&lt;Task&gt; tasks;<br>    // getters and setters...<br>}</pre><p>This ensures the LLM returns <strong>usable JSON-like output</strong> that maps directly to Java objects.</p><h3>3. The Intent Extraction Agent</h3><p>Here’s the star of the show:</p><pre>@Agent(description = &quot;Extracts the intent from a user&#39;s message and breaks them into atomic tasks&quot;)<br>public class IntentExtractionAgent {</pre><pre>    private IntentAndAgentMap intentAndAgentMap;<br>    @Autowired<br>    private AgentPlatform agentPlatform;</pre><pre>    IntentExtractionAgent() {<br>        intentAndAgentMap = new IntentAndAgentMap();<br>        intentAndAgentMap.addIntentAndAgent(&quot;fetch_sales_report&quot;, &quot;Sales Reporting Agent&quot;);<br>        intentAndAgentMap.addIntentAndAgent(&quot;fetch_purchase_report&quot;, &quot;Purchase Reporting Agent&quot;);<br>        intentAndAgentMap.addIntentAndAgent(&quot;summarize_reports&quot;, &quot;Report Summarization Agent&quot;);<br>        intentAndAgentMap.addIntentAndAgent(&quot;send_to_user&quot;, &quot;Email Sending Agent&quot;);<br>    }</pre><pre>    @Action<br>    @AchievesGoal(description = &quot;Extracts the intent from a user&#39;s message and breaks them into atomic tasks&quot;)<br>    void IntentExtractionResponse(final UserInput userInput, OperationContext context) {<br>        final IntentExtractionResponse response = context.ai()<br>                .withLlm(&quot;deepseek-r1:8b&quot;)<br>                .withPromptElements(<br>                        Persona.create(&quot;Task Planner&quot;,<br>                                &quot;You are a task planner. Break down a user&#39;s message into atomic tasks.&quot;,<br>                                &quot;Polite&quot;,<br>                                &quot;You are a polite and helpful assistant.&quot;),<br>                        intentAndAgentMap<br>                )<br>                .createObject(String.format(&quot;&quot;&quot;<br>                        Critically analyze the user&#39;s message and break it down into atomic tasks.<br>                        Keep the intent and agent name as specified, do not change them.</pre><pre>                        # User Input<br>                        %s<br>                        &quot;&quot;&quot;, userInput.getContent()), IntentExtractionResponse.class);</pre><pre>        System.out.println(response);<br>    }<br>}</pre><p>What’s happening here?</p><ul><li>We define the agent with @Agent.</li><li>Embabel wires everything up automatically.</li><li>The LLM (DeepSeek via Ollama) receives the user input and mapping.</li><li>The output is parsed into an IntentExtractionResponse.</li></ul><h3>Multi-Model Flexibility</h3><p>One of the most underrated features of Embabel is that you’re not limited to <strong>one model for everything</strong>.</p><p>You can assign different models to different agents:</p><pre>// Use DeepSeek for deterministic intent extraction<br>context.ai().withLlm(&quot;deepseek-r1:8b&quot;);</pre><pre>// Use Llama 3.1:70B for richer summarization<br>context.ai().withLlm(&quot;llama3.1:70b&quot;);</pre><pre>// Use Mistral for lightweight classification<br>context.ai().withLlm(&quot;mistral:7b&quot;);</pre><p>This means you can optimize for:</p><ul><li><strong>Accuracy</strong> (instruction-following vs reasoning).</li><li><strong>Latency</strong> (small vs large models).</li><li><strong>Cost</strong> (local vs cloud).</li></ul><p>In my setup:</p><ul><li>DeepSeek-R1:8B handled <strong>intent extraction and ranking</strong> reliably.</li><li>A larger model like <strong>Llama 3.1:70B</strong> could be plugged into the <strong>report summarization agent</strong> where creativity and context length matter more.</li></ul><p>👉 <em>Embabel makes hybrid, multi-model workflows a first-class citizen.</em></p><h3>Running the Agent</h3><p>Suppose the user input is:</p><blockquote><em>“Get me the sales summary and purchase summary and send it to John Doe.”</em></blockquote><p>The LLM produces structured tasks:</p><pre>{<br>  &quot;tasks&quot;: [<br>    {&quot;intent&quot;: &quot;fetch_sales_report&quot;, &quot;target&quot;: &quot;Sales Reporting Agent&quot;},<br>    {&quot;intent&quot;: &quot;fetch_purchase_report&quot;, &quot;target&quot;: &quot;Purchase Reporting Agent&quot;},<br>    {&quot;intent&quot;: &quot;summarize_reports&quot;, &quot;target&quot;: &quot;Report Summarization Agent&quot;},<br>    {&quot;intent&quot;: &quot;send_to_user&quot;, &quot;target&quot;: &quot;Email Sending Agent&quot;, &quot;dependsOn&quot;: [&quot;summarize_reports&quot;]}<br>  ]<br>}</pre><p>From here, Embabel can delegate these tasks to the respective agents.<br> For now, the <strong>downstream agents are placeholders</strong>, but this is exactly where you’d plug in reporting services, summarizers, or email modules.</p><h3>Why This Matters</h3><p>Without Embabel, you’d be manually:</p><ul><li>Building prompts.</li><li>Parsing JSON responses from the LLM.</li><li>Handling orchestration logic across services.</li></ul><p>With Embabel:</p><ul><li><strong>Declarative agent building</strong> with annotations.</li><li><strong>Structured AI responses</strong> mapped to Java objects.</li><li><strong>Local-first execution</strong> with Ollama + DeepSeek.</li><li><strong>Multi-model orchestration</strong> — use the right LLM for the right job.</li></ul><h3>Conclusion</h3><p>In this example, we saw how to build an <strong>Intent Extraction Agent</strong> in Java using <strong>Embabel + Ollama (DeepSeek-R1:8B)</strong>.</p><ul><li>The agent breaks down a complex user request into atomic tasks.</li><li>Maps each task to a specific downstream agent.</li><li>Delegates execution through Embabel’s orchestration layer.</li><li>Supports <strong>multi-model strategies</strong> to balance determinism, creativity, and performance.</li></ul><p>This is just the beginning — you can expand this with real sales/purchase reporting agents, email integration, or even multi-agent workflows.</p><p>If you’re a Java developer looking to build <strong>AI-native applications</strong>, Embabel + Ollama is a powerful, local-first starting point.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9d982fd2c4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>