<?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 Najah Naaji on Medium]]></title>
        <description><![CDATA[Stories by Najah Naaji on Medium]]></description>
        <link>https://medium.com/@data_philosopher?source=rss-46e429db0b5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CYjekrNk_YPg0BHCK46cOA.png</url>
            <title>Stories by Najah Naaji on Medium</title>
            <link>https://medium.com/@data_philosopher?source=rss-46e429db0b5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 14:58:32 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@data_philosopher/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[The Rearview Mirror is Broken (Fixing AI with a Headless Semantic Core) for Presira v3.0]]></title>
            <link>https://medium.com/@data_philosopher/the-rearview-mirror-is-broken-fixing-ai-with-a-headless-semantic-core-for-presira-v3-0-a68ee74b6d28?source=rss-46e429db0b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/a68ee74b6d28</guid>
            <dc:creator><![CDATA[Najah Naaji]]></dc:creator>
            <pubDate>Sun, 31 May 2026 16:31:57 GMT</pubDate>
            <atom:updated>2026-05-31T16:31:57.535Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Rearview Mirror is Broken (Fixing AI with a Headless Semantic Core) for Presira v3.0 Enterprise MVP.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zLP7ie_537ceU8sp.png" /></figure><blockquote><strong><em>The Context:</em></strong><em> I’m building the Presira Enterprise MVP in public, sharing our architectural decisions for folks who may find it helpful.</em></blockquote><blockquote><strong><em>What it is:</em></strong><em> A breakdown of how to build an autonomous supply chain using a Headless Semantic Core and Multi-Agent AI.</em></blockquote><blockquote><strong><em>Why it matters:</em></strong><em> Standard BI dashboards are passive, and generic AI hallucinates. By fixing the foundational data layer, we reduce crisis-response times for of manual analysis in simulated scenarios.</em></blockquote><blockquote><strong><em>Who it’s for:</em></strong><em> Supply Chain Executives, Enterprise Architects, and leaders in highly regulated industries.</em></blockquote><p>I’ve spent the last two decades architecting enterprise data systems-from my time at Google and AWS to leading digital transformations for major governments and tech firms. Over the years, I’ve seen every flavour of data crisis. But nothing compares to the sheer chaos of the modern global supply chain.</p><p>For folks managing logistics, procurement, or operations today, the problem isn’t a lack of data-they are drowning in it. The real challenge is the paralysis that comes from trying to make sense of a fragmented, chaotic system. Anyone who has worked with ERPs knows this firsthand; just look at the API landscape!</p><p>I call it the supply chain “Tower of Babel.”</p><p>To a Product Lifecycle Management (PLM) system, a product is a set of engineering specs. To an SAP ERP, it’s a financial ledger and inventory attributes. To a Transportation Management System (TMS) like Blue Yonder, it’s just freight dimensions and carrier contracts. Massive transaction volumes flowing daily, yet when a crisis hits, organisations freeze.</p><p>Back in 2021, I was in a project for Supply Chain Digital Twin, there was a component currently known as <a href="https://cloud.google.com/solutions/cortex?utm_source=google&amp;utm_medium=cpc&amp;utm_campaign=Cloud-SS-DR-GCP-1713664-GCP-DR-APAC-AU-en-Google-BKWS-BRO-AIML&amp;utm_content=c-Hybrid+%7C+BKWS+-+BRO+%7C+Txt+-+AIML-Generative+AI-Vertex+AI-AU_en-853882080171&amp;utm_term=vertex%20ai&amp;gclsrc=aw.ds&amp;gad_source=1&amp;gad_campaignid=8076404156&amp;gclid=Cj0KCQjwlerQBhDMARIsAB16H-X0A8aRwUnSFzVjIAkm0ufJaF-7tzNdYphBfKNetrDsNuS_heiSe78aArS2EALw_wcB">Google Cloud Cortex Framework</a> to bring in SAP ERP data. This data is complex! Remember dialing in a corporate “war room” during the 2021 Suez Canal blockage. We had the smartest planners in the room and massive screens showing live ship tracking. But when the Chief Supply Chain Officer asked, <em>“Exactly which tier-1 customer orders are trapped on that ship, and what is our financial exposure if we breach our SLAs?”</em> the room went silent.</p><p>Logistics had the ship name. Finance had the order values. Sales had the customer tiers. But none of those systems spoke to each other in real-time. It took 48 hours of manual Excel wrangling to get an answer. By then, the critical window to book alternative air freight had closed, costing millions in expedited fees and permanently damaging client trust. I was also at a loss looking into all the Data Definitions and cryptic table names to bring all the data together quickly!</p><h3>The Illusion of the BI Dashboard</h3><p>For the last ten years, the tech industry’s answer to this visibility problem has been the Business Intelligence (BI) dashboard. We poured millions into building beautiful Tableau and PowerBI charts.</p><p>But here is the hard truth: <strong>BI dashboards are just rearview mirrors.</strong></p><p>They are inherently retrospective. They report the news rather than making it. By the time a dashboard metric turns red, the disruption has already hit downstream P&amp;L. Furthermore, dashboards rely entirely on a human operator to constantly sift through filters, spot the anomaly, diagnose the root cause, form a hypothesis, and take action. We are permanently stuck in reactive mode.</p><p>When the Generative AI boom hit, everyone tried to slap an LLM over their database. “Just chat with your data!” they promised.</p><p>We tried it. And we watched standard “chat-to-SQL” tools hallucinate wildly. If you ask a generic AI wrapper, “What is our Perfect Order Fulfillment Rate?”, and let it loose on a messy data lake, it will guess at the SQL joins. In supply chain, where the definitions of “delivered” or “landed cost” are fiercely debated across departments, a hallucinated metric destroys trust instantly. You cannot run a global supply chain on a probabilistic guess.</p><p>The industry is finally realising that we need to move past “GenAI wrappers” to true agentic systems-autonomous, tool-using agents that deliver P&amp;L impact. But to do that, you have to fix the data first.</p><h3>The Headless Core: Curing AI Hallucinations</h3><p>This realisation led me to build the Presira Supply Chain Data Agent (SCDA). I realised that to put AI in charge of enterprise data, we had to fix the foundational semantic layer.</p><p>This isn’t a new problem. Years ago, I remember when LookML first hit the scene. It was an absolute revelation for enterprise architecture. Finally, we had a true “Semantic Layer.” For the first time, we could define a complex business metric once in code, and ensure everyone in the company was looking at the exact same numbers. <em>(Note: Looker exposes LookML and query endpoints via APIs and an Open SQL Interface, so reuse is possible, but it was not always API-first by design). Semantic Layer is a wider concept, some defines with KPIs/Business Logics, however there can be deeper ontologies involved. For this post lets keep it simple. Usig </em><a href="https://cloud.google.com/transform/data-agents-are-here-choose-your-path-to-getting-started-ai"><em>GCP Data Agents</em></a><em> with table descriptions in BigQuery was actually quite decent on this. However, we had a need to keep it open.</em></p><p>This is why, when architecting the Presira Semantic Analytics Platform, we refused to lock our logic inside a BI presentation layer. We implemented a <strong>Headless Semantic Core</strong> (using Cube + DuckDB) so every query-UI or agent-returns the same certified metric, eliminating SQL hallucination.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*73sze8WoLKysHRwZdR-fFw.png" /></figure><p>Decided to put a strict architectural rule for our V1: <em>all</em> queries must route through the semantic layer. Whether our Next.js UI requests a chart, or our Python-based AI agent needs to analyse an anomaly, they both hit the exact same Cube API. DuckDB serves as our highly performant analytical engine for the semantic layer. <em>(While excellent for our MVP workloads, we recognise it is an embedded OLAP engine and may not replace a distributed warehouse for extremely large, highly concurrent enterprise use cases.)</em></p><p>Now, when you ask the Presira agent, “What is our On-Time In-Full (OTIF) rate for Europe?”, it doesn’t write SQL. The LLM identifies the intent, formulates a JSON payload, and calls our financial_query() tool. That tool hits the Cube API, and the AI receives the pre-calculated, mathematically guaranteed value.</p><p>We entirely removed SQL generation from the LLM’s responsibilities. It is freed up to do what it does best: reason, simulate, and advise. A Headless Semantic Layer cures AI hallucinations by giving the agent a single source of truth. But a semantic layer is only as good as the design principles guiding it.</p><p>As we built out the Presira MVP, we knew that if we allowed every deployment to use custom, homegrown definitions for a “supplier” or a “return,” our AI agents would have to be retrained for every single client. To build a truly scalable intelligence platform, we anchored our data model to the absolute gold standard: the <strong>SCOR Digital Standard (SCOR-DS)</strong> and the <strong>GRI Standards for Sustainability</strong>.</p><p>We designed the Presira Semantic Analytics Platform to strictly mirror the SCOR-DS infinity loop (Orchestrate, Plan, Order, Source, Transform, Fulfill, Return).</p><p>Here is exactly how those SCOR-DS layers physicalise into our Gold Layer architecture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*sNFRx0pwyIOtMawA7FIFGA.png" /></figure><p><em>(Note: Some supporting fact tables are omitted for brevity.)</em></p><ul><li><strong>The Orchestrate &amp; Enable Layers:</strong> Our AI models dim_supply_chain_rule to capture safety stock limits and dim_risk_event to catalogue potential risks.</li><li><strong>The Transform Layer:</strong> We map employee labour hours and competencies directly to historical SCOR-DS Skill Codes (e.g., HS.0125 for Risk Analysis).</li></ul><p><strong>Sustainability (GRI):</strong> The AI tracks embedded Scope 3 upstream carbon directly at the product level, moving ESG from a “bolt-on” report to a live operational metric.</p><p>This was the furst step for building the Presira Enterprise MVP Semantic Core. In my next post, I’ll share exactly how we build the “War Room” (Graph Ontologies and Multi-Agent Swarms). Subscribe to follow along, or drop a comment if you’ve wrestled with the supply chain Tower of Babel yourself.</p><p><em>Originally published at </em><a href="https://open.substack.com/pub/najahn/p/the-rearview-mirror-is-broken-fixing?r=23h2q&amp;utm_campaign=post&amp;utm_medium=web&amp;showWelcomeOnShare=true"><em>https://najahn.substack.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a68ee74b6d28" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 4: Building the “The Strategic Debate Room” (Graph Ontologies and Multi-Agent Swarms)]]></title>
            <link>https://medium.com/@data_philosopher/part-5-building-the-the-strategic-debate-room-graph-ontologies-and-multi-agent-swarms-9ddb17787783?source=rss-46e429db0b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ddb17787783</guid>
            <dc:creator><![CDATA[Najah Naaji]]></dc:creator>
            <pubDate>Sun, 31 May 2026 16:30:37 GMT</pubDate>
            <atom:updated>2026-05-31T16:32:32.908Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/766/0*4ziFhtoHpEKAAzWZ.png" /></figure><p><em>I absolutely love this space. Strategic debate is where real learning happens-it brings out the best of our expertise, experience, and wisdom. Building the Presira platform has been a massive undertaking, demanding an immense amount of time, late nights, and pure engineering passion. But the truth is, reality often bites. We frequently have to redirect our time and energy toward things we may or may not like, just to keep the lights on and put food on the table for our families.</em> <em>I am writing these posts and building in public because, even if this specific product or functionality ultimately dies, the thinking survives. I want to put this out into the world so these ideas stay alive. If this helps just one person carry the work forward, or sparks a new conversation, it is worth it. This is my labor of love.</em></p><p><strong>In this post, we will cover:</strong></p><ul><li><strong>The Enterprise Horizon:</strong> Why we are extending supply chain data from relational databases to Ontology Graph Databases (Neo4j).</li><li><strong>Multi-Agent Dialectics (The Swarm):</strong> How we use LangGraph and Bi-Directional loops to build AI personas (CFO, Logistician, Arbiter) that actively debate operational trade-offs.</li><li><strong>The Council of LLMs &amp; UI Traces:</strong> Our multi-model orchestration pattern and how we expose AI “thought processes” directly in the React workspace.</li><li><strong>The Hidden Context of Decisions:</strong> Using in-stream RLHF to capture the scattered, nuanced intent behind human choices.</li><li><strong>Compliance-as-Code (The Trust Layer):</strong> Why system prompts aren’t enough, and how we enforce GDPR and risk guardrails at the semantic layer.</li><li><strong>Edge Analytics:</strong> Bringing complex what-if simulations directly into the browser using DuckDB-Wasm.</li></ul><p>In Part 3, we established that a Headless Semantic Layer cures AI hallucinations by giving the agent a single source of truth. But a semantic layer is only as good as the design principles guiding it.</p><p>As we built out the Presira MVP, we knew that if we allowed every deployment to use custom, homegrown definitions for a “supplier” or a “return,” our AI agents would have to be retrained for every single client. To build a truly scalable intelligence platform, we anchored our Deep Data Semantic Layer to absolute gold standards: the <strong>SCOR Digital Standard (SCOR-DS)</strong>, <strong>GS1 standards</strong>, and the <strong>GRI Standards</strong> for Sustainability.</p><p>We designed the platform to strictly mirror the SCOR-DS infinity loop (Orchestrate, Plan, Order, Source, Transform, Fulfill, Return).</p><h3>The Enterprise Horizon: Extending with Neo4j</h3><p>For our MVP, Presira powers this model using DuckDB-an incredibly fast analytical engine that gets the job done today for relational data. But supply chains are not simply spreadsheets. They are physical, living networks.</p><p>When a port strike happens in Long Beach, the cascading impact is non-linear. To figure out how a delayed sub-assembly impacts your top-tier retail customers, a standard SQL database can require complex, deeply nested JOINs that become expensive at scale.</p><p>This is why a major evolution in our enterprise roadmap is mapping this foundation directly into an Ontology Graph Database for our Network Digital Twin. (Graph DBs are optimised for multi-hop queries and can be incredibly fast, though we acknowledge performance depends heavily on meticulous modelling, indexing, and cluster sizing). This is still an exploration, the exact storyline and the <a href="https://neo4j.com/blog/supply-chain-and-logistics/demo-build-intelligent-supply-chain-app-neo4j/">details can be found in neo4j documentation</a>. This type of detail can not be outsourced and built as self-serve SaaS. Has to be deeply engrained and work closely to create, update and maintain the self-governing ever changing networks.</p><h3>Multi-Agent Dialectics: The Swarm</h3><p>To make good decisions, high-quality data is vital. That’s why we developed the schematic layer. But early on, even with semantic layers in place, I noticed the LLMs were doing things I wasn’t expecting-making up new data and jumping to totally fabricated conclusions. For the duckdb side data integration we can use dbt and great-expectation etc. However, for a GCP native environment, <a href="https://cloud.google.com/blog/products/data-analytics/data-curation-accelerators-for-google-data-cloud">these data curation and agentic systems for Data Cloud</a> were really good.</p><p>That’s why we built a Multi-Agent Swarm powered by LangGraph. We call this “The Strategic Debate Room.”</p><p>Under the hood, this isn’t a chatbot; it is a sophisticated system of specialized, autonomous agents that collaborate. To ensure robust behavior, we completely decoupled their “personalities” from the Python code. Each agent has a dedicated scda-skills/ directory containing a SKILL.md (System Prompt) and static knowledge injections.</p><ul><li><strong>scda-supervisor (The Planner):</strong> Routes user intent. It has no tools; it relies on pure reasoning to delegate tasks.</li><li><strong>scda-logistician (The Operator):</strong> Focuses on “Where is the stock?” It has access to operational tools like inventory_lookup, shipment_tracker, and network_query.</li><li><strong>scda-cfo (The Analyst):</strong> Focuses on “What is the margin impact?” It relies on financial tools like cost_calculator, revenue_forecast, and financial_query.</li><li><strong>scda-arbiter (The CSCO persona):</strong> A meta-agent node that synthesises the opposing viewpoints. It has no tools, strictly evaluating the trade-offs and outputting a highly concise Markdown executive summary.</li></ul><h4>The Bounded Bi-Directional Loop</h4><p>Here is where the engineering gets deep. To prevent the agents from talking past each other, we engineered a stateful, <strong>bi-directional loop capped at a maximum of 3 extra turns</strong>.</p><p>If the CFO states they cannot perform a financial analysis because they lack data, the Arbiter intercepts, takes the Logistician’s simulation data, and re-routes it back to the CFO (FOLLOWUP_CFO:). If the CFO establishes a strict budget that invalidates the Logistician’s plan, the Arbiter sends it back to the Logistician (FOLLOWUP_LOGISTICIAN:).</p><p>If the 3-turn limit is reached without a clean consensus, the Arbiter forces a convergence, explicitly noting the caveats and risks of the missing information. This creates a true, managerial dialectic without the risk of infinite LLM loops.</p><p>To cut latency in half during this process, we utilize Python’s ThreadPoolExecutor on our GCP backend. Both the Logistician and CFO are invoked in parallel against Google Gemini (1.5 Pro / 2.0 Flash). They autonomously execute their LangChain tool calls simultaneously, and we stream the entire process back to our fully integrated React Agent Workspace via Server-Sent Events (SSE).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IfEGbbyDBfYVRAuuaY3J1Q.png" /></figure><h3>Elevating the Debate: The Council of LLMs and UI Traces</h3><p>While our standard swarm routing works beautifully for most operational trade-offs, the highest-stakes strategic debates expose a fascinating limitation: underlying model bias. If the Arbiter relies purely on a single underlying model family, it can inadvertently inherit that model’s specific analytical biases.</p><p>To combat this, we built a pattern in parallel to our standard skill routing: the Council of LLMs. We run parallel API invocations across diverse providers (eg: Google, Anthropic, Meta, and Mistral).</p><p>In our Next.js frontend, we built an <strong>Interactive Trace UI</strong>. Instead of waiting behind a loading spinner, users see a “Council Active” badge. By clicking it, they open insight modals that expose the underlying model traces, thought processes, peer rankings, and exact tool executions in real-time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JpfFYF68zT0tYG4boafOWA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*4ILO3nQfgbesmIq-wiv6Kg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*6XvBKyUrY9OG5mrrkRHM0Q.png" /></figure><h3>The Hidden Context of Decisions (RLHF)</h3><p>Every organization and process has its own nuances. Proper context management helps improve these decisioning processes. However, discovering and codifying the actual <em>intent</em> remains a massive challenge.</p><p>I did what an engineer would do: I added a reinforcement learning loop (RLHF) directly into the UI. We built <strong>Accept/Reject buttons directly integrated into the debate stream</strong> to capture immediate user feedback on the Arbiter’s synthesis.</p><p>But when I talked to interested users, I realized a hard truth. Even in organizations that have governed data, very few actually have data on <em>how</em> decisions are made. That context is scattered across emails, Slack channels, historical tweaks, and hidden inside code parameters or exception handling. Gathering that nuanced data is incredibly difficult, and the downside of getting it wrong is high. Because of this, accountability, guardrails around failure modes, and human-in-the-loop judgment are more critical than ever.</p><h3>The Opinionated Trust Layer (Compliance-as-Code)</h3><p>Because these are high-value decisions, accuracy and trust are paramount. The single biggest hesitation enterprise executives have about deploying AI agents is risk. It’s one thing to have an AI draft an email; it’s another to have an autonomous agent reallocate inventory.</p><p>Here is a secret most AI startups won’t tell you: You cannot rely on a “System Prompt” to enforce compliance. LLMs easily “forget” rules in long context windows. We solved this from day one by embedding Governance directly into the Semantic Layer. We call it Compliance-as-Code.</p><p>If the Agent asks for data on a customer who has revoked GDPR consent, or attempts to allocate stock on a Quality Hold, the semantic layer physically intercepts the request via Cube hooks and masks/blocks the data before it ever touches the LLM.</p><h3>Edge Analytics: Moving Curated Data to the Browser</h3><p>Finally, there is the issue of exploratory speed. In a crisis, constantly querying a cloud database for “what-if” Monte Carlo simulations introduces latency. To empower planners, we integrated DuckDB-Wasm and Pyodide (Python compiled to WebAssembly) directly into our Next.js frontend architecture.</p><p>Instead of hitting the backend for every exploratory query, the system downloads heavily compressed, relevant subsets of supply chain data directly into the user’s local memory. Planners can then execute complex Python data science scripts locally, providing almost zero network latency for human-in-the-loop decision-making.</p><h3>Why We Build</h3><p>I actually love this space. Strategic debate is where real learning happens-it brings out the best of our expertise, experience, and wisdom. What I build is just a start, adding an organizational brain and outsourced intelligence in a narrow knowledge based analytical decision making process. My plan is to continue adding visibility into how these models can be used to debate and make better decisions, extend the tools they use, their skills, and their context, and then see how it evolves. I would love to hear your thoughts.</p><p>I am writing these posts because, even if this product or functionality ultimately dies, the thinking survives. If reality bites and we have to redirect our energy to something we may or may not like-just to keep the lights on and put food on the table-at least these ideas stay alive here. I want these writings to be available for someone else to carry forward, and for the conversation to continue.</p><p><em>Originally published at </em><a href="https://open.substack.com/pub/najahn/p/part-5-building-the-the-strategic?r=23h2q&amp;utm_campaign=post&amp;utm_medium=web&amp;showWelcomeOnShare=true"><em>https://najahn.substack.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ddb17787783" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Part 2: Death by a Thousand Workflows (Building the NLP Process Mapper & BPMN)]]></title>
            <link>https://medium.com/@data_philosopher/part-2-death-by-a-thousand-workflows-building-the-nlp-process-mapper-bpmn-ecf06e5a5778?source=rss-46e429db0b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/ecf06e5a5778</guid>
            <category><![CDATA[process-improvement]]></category>
            <category><![CDATA[supply-chain]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[bpmn]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Najah Naaji]]></dc:creator>
            <pubDate>Thu, 28 May 2026 14:49:43 GMT</pubDate>
            <atom:updated>2026-05-28T14:49:43.168Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>This is Part 2 of my series documenting the raw journey of building Presira v3.0 MVP.</strong> In conversations with multiple clients, a recurring problem emerged: <strong>low visibility into how work actually happens.</strong> Without that visibility, organizations struggle to re-engineer processes or adapt when ways of working change. Critical details are often buried in documents and tribal knowledge. Large enterprises can buy expensive tools like SAP Signavio; small and medium enterprises usually lack the budget and expertise to do deep process discovery. So I built an <strong>NLP Process Mapper + BPMN</strong> to bridge that gap — to make process discovery conversational, grounded, and executable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y1WZBjjUAaV5SA68.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w1XpbH9XET2mlp-kgMzyEA.png" /></figure><p>Looking into the architectural baseline of how enterprises actually map their operations. Historically, this was a static, documentation-focused exercise. Today, however, the contemporary paradigm has shifted dramatically: the visual diagram acts directly as the deterministic source code for sophisticated workflow automation engines.</p><p>Organizations utilize a structured taxonomy of mapping techniques suited for varying levels of complexity and strategic intent:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*4gRBQej6rApMm3Nj5vdBZg.png" /></figure><p>BPMN gives you visual accessibility plus full XML execution semantics. Pools and Lanes cleanly represent distinct organizational entities and internal roles. Sequence flows govern internal chronological execution, while Message flows strictly manage asynchronous communication across B2B boundaries.</p><p>However, BPMN’s superpowers come with sharp edges. Boundary events let you cleanly handle exceptions-like a non-interrupting timer that escalates a pending invoice approval without disrupting the core sequence. Gateways control splits and joins, but the Inclusive (OR) Gateway creates the notorious OR-Join problem: the engine must perform real-time, complex upstream reachability analysis to synchronize branches, which often causes severe computational overhead and infinite deadlocks if a path evaluates to false.</p><h3>The Selection Mechanism: Where Do You Fit?</h3><p>When mapping out their “as-is” workflows, organizations face a critical strategic divergence regarding the software platforms that execute these models:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*hPhjx_TRsAX5Gz6Klr1fnA.png" /></figure><h3>The Core Problem: The Shift Towards Hybrid Agents &amp; Variance</h3><p>What we found: If you want to sink an enterprise SaaS product, try hardcoding supply‑chain workflows or forcing users to self‑serve.</p><p>The market is aggressively moving toward automated agents that must bridge two worlds: handling non-deterministic tasks (like parsing messy, unstructured emails or interpreting random logistics exceptions) while strictly obeying deterministic processes (like hard financial routing, compliance checkpoints, and multi-level approval thresholds).</p><p>Every enterprise believes their supply chain is a unique snowflake-and they are correct. The order-to-delivery workflow for a pharmaceutical distributor handling cold-chain compliance looks entirely different from an FMCG company routing non-perishables. The standard approach hits a massive wall: <strong>Variance.</strong></p><p>Hardcoding agent logic would turn us into a custom development shop rather than a scalable SaaS. We needed a way for our users to define their own business rules using BPMN 2.0. But traditional tools are clunky. Nobody wants to spend hours manually configuring edges just to get their AI agents to work.</p><p>Furthermore, an abstract workflow diagram isn’t enough. We had to layer <strong>Organizational Knowledge</strong> directly on top of the workflows to ground them in reality. This is where modern process discovery methodologies-like Object-Centric Process Mining (OCPM) extracting unified graphs from event logs, or Task Mining capturing unstructured user interactions. We layered in the customer’s organizational knowledge: approval limits, on-leave routing rules, department hierarchies to find out whether this is something helpful. The goal was to create a grounded, executable functionality that an AI agent could actually follow without going rogue.</p><h3>The Harness: Architecture of the NLP Process Mapper MVP</h3><p>To test this hypothesis and eliminate the friction of traditional tools, we built an MVP: an AI-powered NLP Process Mapper. We wanted to see if users could just talk to the system and let the AI build the deterministic rails it was about to run on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*qCzcq6ZeunxyNgtWBOVIzQ.png" /></figure><p>Here is how we architected the flow for our MVP:</p><h3>1. The Natural Language Intake</h3><p>A logistics manager simply types or speaks:</p><blockquote>“When a high-priority order comes in, check inventory in Warehouse B. If stock is available, route to the expedited fleet. If not, trigger a supplier backorder and alert risk management.”</blockquote><h3>2. The Generative Translation Layer</h3><p>Standard LLMs operate via probabilistic token prediction; they struggle to grasp the strict, deterministic context required for workflow execution. They frequently hallucinate incorrect process pathways, illogical gateways, or output syntactically valid but semantically broken XML.</p><p>We solved this the way cutting-edge research recommends: strict prompting utilizing an intermediate JSON representation. Because JSON structures map cleanly to an LLM’s function-calling capabilities, atomic editing operations become precise, drastically reducing hallucination rates. We use Google’s Gemini 2.5 Flash to generate this logic, which a deterministic programmatic backend then compiles into pristine BPMN 2.0 XML-complete with bpmndi layout coordinates. We also feed it RAG context from the customer’s existing organizational structure so it doesn’t invent approval chains from thin air. However verifying with another model as a judge would provide additional correctness.</p><h3>3. The BPMN-to-Graph Transpiler (The Secret Weapon)</h3><p>An XML file is useless if your AI agents can’t execute it natively. Instead of forcing users to deploy to clunky, external Java-based orchestration engines, we built a custom bpmnTranspiler.js utility.</p><p>When deployed, the backend parses the XML natively using bpmn-moddle. It maps a formal bpmn:ServiceTask directly to a specific AI worker in our system (e.g., mapping an “Invoice Validation” step to our invoice_validation_agent), and translates an ExclusiveGateway into strict conditional logic for our ReactFlow execution core. We get the mathematical formality of BPMN with the lightweight, high-speed execution of an AI-native platform.</p><h3>Deep Dive: UI/UX &amp; The Mechanics of bpmn.io</h3><p>We embedded bpmn-js directly into our React frontend (OrchestrationBuilder.jsx) as our interactive modeler. The core technical challenge was real-time XML serialization-updating the underlying BPMN 2.0 XML string instantly with every canvas interaction.</p><p>To minimize cognitive overhead, we focused on four key actions that balance technical execution with UX psychology:</p><ul><li><strong>Load Example:</strong> Injects predefined XML templates to eliminate “blank canvas paralysis” and provide an immediate mental model.</li><li><strong>Save BPMN:</strong> Saves the current XML state to a Postgres table. This completely isolates design from execution, giving users the psychological safety to iterate.</li><li><strong>Deploy to Engine:</strong> Compiles the XML, registers executable objects, and primes the Kafka event stream. Visually separating this from “Save” ensures explicit intent and prevents accidental deployments.</li><li><strong>Generate Workflow:</strong> Dispatches plain-text prompts to our Gemini-powered backend, which returns complete XML. This democratizes complex architecture by letting users build via natural language.</li></ul><h3>Human-Centric Design: Enterprise Power without Friction</h3><p>Our workspace is structured around three foundational UX choices designed to serve dual audiences:</p><p>We bridge the gap between technical developers (who prefer ReactFlow node chaining) and business analysts (who require formal BPMN notation). Instead of forcing one language, we built a dual-tab layout where both compile down to the exact same execution model via an internal transpiler.</p><p>To prevent context-switching and preserve flow state, we embedded the AI Process Builder directly next to the visual canvas. Users can type updates and watch the visual nodes dynamically draw themselves in real time.</p><p>To overcome the “AI black box” trust barrier, our transpiler maps any bpmn:UserTask (Human-in-the-Loop checkpoint) directly to our platform’s Trust Center Action Feed. This explicitly models the human into the workflow as the ultimate arbiter of truth.</p><h3>The Result: Scale Without the Custom Code</h3><p>Key lessons we learned from this MVP:</p><ul><li>Determinism + natural language is a step forward to get enterprises to trust agentic AI with their core operations.</li><li>BPMN gives us the formal rails; our transpiler gives us speed.</li><li>The real benefit isn’t in the AI agents-it’s the self-documenting, visually verifiable operating system they run on.</li></ul><p>Traditional BPMN tools were built for the old world of rigid orchestration. We built the NLP Process Mapper MVP for the post-BPMN era-where AI doesn’t just execute workflows, it helps define them in plain English, then runs on rails the business actually owns. The future isn’t “replace BPMN.” It’s making BPMN disappear for the user while keeping its mathematical rigor under the hood.</p><p><strong>Building in supply chain/tech? What’s the messiest workflow you’ve had to map? Drop it in the comments.</strong></p><p><strong>#building_for_fun</strong></p><p><em>Originally published at </em><a href="https://open.substack.com/pub/najahn/p/part-2-death-by-a-thousand-workflows?r=23h2q&amp;utm_campaign=post&amp;utm_medium=web&amp;showWelcomeOnShare=true"><em>https://najahn.substack.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecf06e5a5778" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Miro Boards to Distributed Systems: Architecting Presira Version 3.0 (The Enterprise MVP)]]></title>
            <link>https://medium.com/@data_philosopher/from-miro-boards-to-distributed-systems-architecting-presira-version-3-0-the-enterprise-mvp-05fe2d06ecad?source=rss-46e429db0b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/05fe2d06ecad</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[supply-chain]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[semantic-layer]]></category>
            <dc:creator><![CDATA[Najah Naaji]]></dc:creator>
            <pubDate>Tue, 26 May 2026 13:58:40 GMT</pubDate>
            <atom:updated>2026-05-26T13:58:40.454Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/803/0*2AaVL-ZLn7yHGefJ.png" /></figure><p>One year ago, just after launching our SaaS <a href="http://checbox.360insights.ai/">checbox</a> (end-to-end task management solution <strong>Powering Field, Fleet and Logistics</strong>), the market feedback was looking for something advanced. As a result, I was stared a massive Miro board, mapping out 59 supply chain roles I wanted to augment one task at a time as a solo founder riding the first wave of GenAI tools. The MVP details is in <a href="https://presira.ai/">Presira AI</a>.</p><p>Leaning heavily into spec-driven development with AI coding agents like Kiro, the rapid prototyping phase was intense. The majority of the codebase was strictly architecture-dependent, emulating a software “dark factory”-a methodology I sometimes referred to as the AIDLC (Artificial Intelligence Development Lifecycle).</p><p>I wasn’t trying to build another chatbot. I also did not want to build something niche and focused. I wanted to build an end-to-end autonomous workforce which will shape the type of work we do including the shape of Organizations. With these new tools and capabilities it is possible to probably bil the ocean :D. When there is noone saying anything and I am not looking for investments, why not build it! It will be a lot of fun.</p><p>After talking to 2 of the largest Organizations in Australia, What became apparent very quickly, however, was how high the bar is for a Minimum Viable Product (MVP) in this space. In consumer tech, an MVP might be a clever prompt wrapper. In global supply chains, an enterprise MVP requires a semantic lakehouse, secure code sandboxing, a real-time streaming trust engine, and a hardcore distributed systems harness just to survive its first simulated load test.</p><p>To make the initial scope manageable, I structured these 59+ agents into <strong>7 Enterprise Suites</strong> (acting as department operators) and <strong>4 Consulting AI Crews</strong> (acting as strategic problem solvers).</p><p>Here is what was mapped out and built in the early prototyping phases to cover the Order-to-Delivery lifecycle:</p><p><strong>The 7 Enterprise Suites:</strong> <strong>The 4 Consulting AI Crews:</strong></p><p>I spun up these agents, started with simple CopilotKit chat interfaces, wired together CrewAI for orchestration, built a standard RAG pipeline, cleverly created prompts, prompt router and small distilled codels and proudly called it an “AI Operating System.”</p><p>The first agent felt like a breakthrough. By the time 59+ were running concurrently, it felt like a jungle.</p><p>As I simulated real-world enterprise supply chain loads in my development environment, the early architecture buckled:</p><p>Pitching these early builds taught me a humbling lesson: <strong>Enterprises don’t buy commoditized models. They buy process variance, reliability, and trust. </strong>And they even do not want to buy from a solo founder for the risks they bring on-board for a procurement.</p><p>Then the model cost suddenly started to collapse, most of the prompt engineering and versioning we had is actually already within the cloud providers offerings. Then Google dramatically started increasing the context window. Most of what we have built and those clever RAG engineering mostly gone!</p><p>So, I went back to the drawing board. I ripped out the third-party wrappers, threw away the RAG pipelines, and accepted that my true “MVP”-what would become <strong>Presira Version 3.0</strong> -had to be a production-grade distributed system.</p><p>You cannot run deterministic enterprise workflows and non-deterministic LLM reasoning in the same application loop. The architecture demanded a split backend.</p><p><strong>1. The Transactional Core (Node.js):</strong> Handles authentication via GCP Identity-Aware Proxy and database transactions. I built a custom <strong>Google-Native A2UI WebSocket stream</strong> here. Instead of streaming clunky markdown, the AI streams structured function calls that dynamically render React components (tables, interactive maps, forms) mid-thought. <br><strong>2. The Intelligence Engine (Python / FastAPI):</strong> A dedicated microservice strictly hosting the reasoning loops via the <strong>Google Agent Development Kit (ADK)</strong> and Vertex AI, completely isolating the cognitive load from the UI.</p><p>When an AI transitions from generating text to taking action, the infrastructure requirements change overnight.</p><p>For the Tier 4 Consulting Crews to do deep market analysis, I wired them into dedicated <strong>Agent &amp; Research APIs</strong> to autonomously scrape and structure global supply chain trends.</p><p>But what happens when a Data Science Agent needs to run a linear regression on 100,000 rows of logistics data? You can’t just eval() LLM-generated Python code on your main server-that&#39;s a massive security vulnerability.</p><p>To solve this, I integrated <strong>E2B Sandboxes</strong> alongside <strong>Google’s Agent Executor</strong>. <br><em>(In short: rather than letting an AI write and execute code on the main server, the system dynamically spins up a secure, disposable micro-VM to do the math safely, returning only the final visualization to the frontend. Also these agents sometime don’t follow whats in Agent.md file and guides, so the tools can not go crazy)</em></p><p>Even the context is larger, to solve the “math hallucination” problem, the architecture required a Semantic Lakehouse.</p><p>Instead of feeding unstructured text to an LLM, the data was unified through a deep Semantic Layer using <strong>Cube.js</strong> sitting on top of <strong>DuckDB</strong> (a high-performance in-process OLAP database). The entire DuckDB schema was mapped strictly to the standard:</p><p><em>(In short: rather than letting the LLM guess how to calculate a metric from raw text, this setup forces the AI to query a strictly defined database layer that executes deterministic SQL.)</em></p><p>For complex Tier 4 Consulting Crews, a single agent has dangerous confirmation bias. If you ask a Logistics agent how to handle a port strike, it will almost always recommend expensive air freight to maintain SLAs.</p><p>To fix this, I engineered the <strong>Strategic Room</strong>, utilizing Multi-Agent Dialectics:</p><p><em>(In short: instead of trusting a single AI’s first guess, the system forces a Logistics AI and a Finance AI to debate, while a ‘Manager’ AI makes the final call.)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*w-Rrq5WGZPjfnTbkjKGRsA.png" /></figure><p>This loop is closed with <strong>RLHF (Reinforcement Learning from Human Feedback)</strong>. In the UI, a VP can upvote the Arbiter’s logic, or downvote a flawed constraint from the CFO. This updates the feedback_log.json and adjusts graph weights in Shadow Mode, allowing the enterprise to natively &quot;train&quot; the AI&#39;s strategic priorities without writing code.</p><p>As these agents gained autonomy, the ultimate question remained: <em>“How do we mathematically know this AI didn’t just hallucinate a $10,000 route change?”</em></p><p>Enterprises don’t buy agents-they buy provable reliability. So, I built a real-time validation gatekeeper using <strong>Apache Kafka</strong> and <strong>PyFlink</strong>.</p><p>Before any agent action hits the database, it is published to a Kafka topic ( raw-agent-actions). A PyFlink stream processor intercepts the payload and mathematically grades the action across 6 dimensions:</p><p>Simulated load testing showed that without this harness, hallucination rates in complex routing hovered at unacceptable levels. With it, the Flink engine mathematically guarantees a $\ge 95\%$ confidence threshold before auto-approval. Anything lower mutates into a PENDING_REVIEW state and is routed to a Human-in-the-Loop (HITL) dashboard.</p><p><strong>Over the next few weeks, I will be breaking down the exact architecture behind Presira:</strong></p><p>The teams getting production wins right now aren’t the ones with the cleverest prompts. They’re the ones building the best harness. If you’re wrestling with these same architectural challenges, subscribe-I’ll be breaking down each piece over the coming weeks.</p><p><em>Originally published at </em><a href="https://open.substack.com/pub/najahn/p/from-miro-boards-to-distributed-systems?r=23h2q&amp;utm_campaign=post&amp;utm_medium=web&amp;showWelcomeOnShare=true"><em>https://najahn.substack.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05fe2d06ecad" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>