<?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 Iulia Istrate on Medium]]></title>
        <description><![CDATA[Stories by Iulia Istrate on Medium]]></description>
        <link>https://medium.com/@ifilimon26?source=rss-a21ca55181b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*b5wpQMe7NzYoEWnu</url>
            <title>Stories by Iulia Istrate on Medium</title>
            <link>https://medium.com/@ifilimon26?source=rss-a21ca55181b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 23:36:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ifilimon26/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[Jalapeño Launched. Here’s the Quieter Chip Story Running Beside It]]></title>
            <link>https://medium.com/@ifilimon26/jalape%C3%B1o-launched-heres-the-quieter-chip-story-running-beside-it-71502f73f1b7?source=rss-a21ca55181b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/71502f73f1b7</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[neuromorphic-computing]]></category>
            <category><![CDATA[spiking-neural-network]]></category>
            <category><![CDATA[energy-efficiency]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Iulia Istrate]]></dc:creator>
            <pubDate>Sat, 29 Aug 2026 20:09:46 GMT</pubDate>
            <atom:updated>2026-09-02T17:23:25.200Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>OpenAI built a new chip — Jalapeño. Meanwhile a much smaller, much quieter group of companies has been building chips that work almost nothing like it — and might matter just as much.</blockquote><h3>1. What is Jalapeño, actually?</h3><p>In June 2026, OpenAI and Broadcom showed off <a href="https://openai.com/index/jalapeno-first-results/">Jalapeño</a>, OpenAI’s first custom-built chip. Before we dive deeper, it helps to separate two things this AI hardware does.</p><p>There’s <strong><em>training</em></strong> — the process of teaching a model, which is expensive and happens rarely.</p><p>And there’s <strong><em>inference</em></strong> — actually running that trained model to answer someone’s question, which happens billions of times a day, every time you send ChatGPT a message.</p><p>Jalapeño only does the <strong>second part</strong>. Its whole job is to run OpenAI’s already-trained models, faster and cheaper, the moment someone hits send — OpenAI’s own announcement describes it as <a href="https://openai.com/index/jalapeno-first-results/">“a custom inference chip from OpenAI that delivers faster, more power-efficient AI inference, with higher throughput and lower latency for modern models.”</a></p><p>Why is it efficient? Mostly because it was built for one thing instead of everything. Nvidia’s chips are brilliant, but they’re general-purpose — built to handle all sorts of computing jobs. Jalapeño was designed around the specific, repetitive shape of “serve a language model” and nothing else. That focus is what OpenAI says gets them 1.5 to 1.9 times more work out of every watt of power, 1.7 to 3.6 times faster responses, and 2 to 4 times better performance when a lot of people are using it at once, compared to the GPUs it’s replacing.</p><p>What does it actually do, day to day? It runs OpenAI’s models — GPT-OSS, DeepSeek R1, and the roughly trillion-parameter Kimi K2.5 — inside OpenAI’s own data centers, more cheaply than renting Nvidia hardware.</p><p><strong>You can’t buy one yet</strong>. <strong>It’s not a product. </strong>It exists so OpenAI relies a little less on Nvidia, the same logic Google followed with its own chips, and Amazon followed with its own (<a href="https://techcrunch.com/2026/06/24/openai-unveils-its-first-custom-chip-built-by-broadcom/">TechCrunch</a>).</p><h3>2. Meet the quiet track: chips modeled on the brain</h3><p>While LLMs and Agentic AI are currently grabbing headlines, a different, much less talked-about group of chipmakers have been doing something completely different: <strong>chips modeled loosely on how your own brain works.</strong></p><p>Here’s the idea in plain terms.</p><p>A normal chip — Jalapeño included — works on a fixed beat, like a metronome. Every single tick, every circuit on the chip runs its calculation again, from scratch, whether or not the input actually changed since the last tick. It doesn’t check first — it just keeps computing on schedule.</p><p>A “neuromorphic” chip works more like a motion-sensor light instead of a floodlight. Its artificial neurons just sit there, using almost no power, until something actually worth reacting to shows up — then, and only then, they fire a signal to the next neuron, called a “spike”. That’s where the technical name for this comes from: a <strong>spiking neural network</strong>, or SNN. Most of the time, most of the chip is doing nothing. And doing nothing is basically free, this is where most of the energy efficiency of neuromorphic hardware comes from.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ltV0c7xDboEDN-7z_uNX2w.png" /></figure><p>Two companies are actually shipping this today:</p><ul><li><strong>BrainChip</strong> makes a chip called <strong>Akida</strong> — its AKD1500 model draws less than a milliwatt of power per billion operations, small and cheap enough to live inside a security camera or a hearing aid (<a href="https://brainchip.com/chips/">BrainChip, chip specifications</a>).</li><li><strong>Innatera</strong> makes one called <strong>Pulsar</strong>, launched in 2025, aimed at things like voice detection and radar sensing — running on 400 to 600 microwatts, which is close to nothing. Innatera reports up to 500 times less energy and 100 times faster response than a normal chip doing the same job (<a href="https://www.innatera.com/newsroom/innatera-unveils-pulsar-the-worlds-first-mass-market-neuromorphic-microcontroller-for-the-sensor-edge/">Innatera, Pulsar launch announcement</a>).</li></ul><h3>3. Two very different business models</h3><p><strong>Jalapeño</strong> isn’t a product. OpenAI built it for itself, to cut its own costs, with Broadcom’s help and TSMC’s factories (<a href="https://www.tomshardware.com/tech-industry/artificial-intelligence/broadcom-and-openai-unveil-custom-built-jalapeno-inference-processor-openais-first-chip-is-a-massive-reticle-sized-asic-built-in-an-ultra-fast-nine-month-development-cycle">Tom’s Hardware</a>). Nobody else gets to buy one.</p><p><strong>Akida and Pulsar</strong> are actual products, made by much smaller companies. BrainChip licenses its chip design to other companies who want to build it into their own devices, and also sells small development kits directly (<a href="https://brainchip.com/chips/">BrainChip</a>). Innatera does something similar, selling chips to companies making wearables, smart-home gadgets, and industrial sensors. Neither company is anywhere near OpenAI’s size or funding — Innatera has raised around $21 million so far (<a href="https://venturebeat.com/ai/beyond-gpus-innatera-and-the-quiet-uprising-in-ai-hardware">VentureBeat</a>), which is a rounding error next to what OpenAI and Broadcom are spending on Jalapeño.</p><p>So one is a <strong>cost-saving tool</strong> built by one of the richest AI companies on Earth, for itself.</p><p>The other two are small companies selling <strong>chips built to go inside physical devices</strong>, like cameras, sensors, and wearables. That market gets far less attention than language models right now — but between all the everyday objects that could eventually use a chip like this, it’s arguably the bigger opportunity in the long run.</p><h3>4. What neuromorphic chips can do that Jalapeño can’t</h3><p>A few things stand out.</p><p><strong>They don’t need to be plugged in.</strong> Jalapeño needs something like 700 watts and a data center behind it (<a href="https://openai.com/index/jalapeno-first-results/">OpenAI</a>; <a href="https://www.tomshardware.com/tech-industry/artificial-intelligence/broadcom-and-openai-unveil-custom-built-jalapeno-inference-processor-openais-first-chip-is-a-massive-reticle-sized-asic-built-in-an-ultra-fast-nine-month-development-cycle">Tom’s Hardware</a>). Akida and Pulsar run on so little power that a coin-cell battery can keep them going for months, sometimes years.</p><p>This isn’t really a fair fight — <em>you can’t shrink Jalapeño down to battery size, and you can’t scale Akida up to run a trillion-parameter model today.</em><strong><em> </em></strong>They’re built for opposite problems.</p><p><strong>They can keep learning after they’re already out in the world.</strong> BrainChip specifically builds Akida so it can learn on the job — adjusting to new patterns right there on the device, without shipping data back to a server to retrain (<a href="https://brainchip.com/press/brainchips-akida-development-environment-now-freely-available-for-use-brainchip-120220/">BrainChip, Akida Development Environment announcement</a>). Jalapeño can’t do this at all. It only runs models that were already fully trained somewhere else. If you’re building something that needs to adapt to its specific user or environment over time, that’s a real difference.</p><p><strong>They only spend energy on things that matter.</strong> Because these neuromorphic chips react to events instead of grinding through everything on a fixed schedule, they’re a natural fit for anything that’s mostly quiet with occasional bursts of something worth noticing — a microphone that’s silent most of the day, a camera watching an empty room. A normal chip does the same amount of work either way, whether anything happened or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kz3LlfDk6JymjWUnjFYXAw.png" /></figure><h4>Did Jalapeño borrow anything from neuromorphic chips?</h4><p>Worth asking directly, since it’s a natural question once you know both exist: <strong>no</strong>.</p><p>Jalapeño doesn’t use spiking neural networks or any neuromorphic ideas at all. Based on technical breakdowns of the chip, it’s built around what’s called a systolic array — basically a big, tightly organized grid of math units that all multiply and add numbers together in a synchronized rhythm, every cycle, the same broad family of design Google uses for its TPU chips (<a href="https://newsletter.semianalysis.com/p/openai-jalapeno-better-than-nvidia">SemiAnalysis, technical breakdown of Jalapeño’s architecture</a>). That’s about as far from “event-driven” as chip design gets. It doesn’t sit idle waiting for something to react to — it’s built to stay busy, cycle after cycle, doing dense math as fast as possible.</p><p>Jalapeño’s efficiency comes from somewhere else entirely: <strong>smarter memory layout, faster chip-to-chip communication, lower-precision number formats</strong>, and a <strong>design built around the specific, repeated pattern of running a language model</strong> — not from mimicking how neurons fire.</p><p>It’s a case of two very different paths arriving at “more efficient” from opposite directions: <strong>Jalapeño gets there by doing conventional computation better, and SNN chips get there by not doing computation at all when nothing’s happening.</strong></p><h3>5. Could neuromorphic chips technology ever help a chip like Jalapeño?</h3><p>Fair question, and the answer is more “not yet” than “no.” A couple of research teams have actually tried it.</p><p><strong>IBM</strong> built a brain-inspired chip called NorthPole (it doesn’t use spikes, but it borrows a related idea — doing the math right next to where the data sits, instead of shipping it back and forth) and ran a 3-billion-parameter language model on it, reporting roughly 47 times faster responses and 73 times better energy efficiency than the closest comparable GPU (<a href="https://research.ibm.com/blog/northpole-llm-inference-results">IBM Research, NorthPole LLM inference results</a>).</p><p><strong>Inte</strong>l tried something similar on its Loihi 2 spiking chip, running a 370-million-parameter model about 3 times faster and using roughly 14 times less energy per response than an Nvidia H100 — though getting there required swapping out the model’s design, as the next paragraph explains (<a href="https://arxiv.org/html/2503.18002v2">Neuromorphic Principles for Efficient Large Language Models on Intel Loihi 2, arXiv</a>).</p><p><em>So why isn’t this already inside Jalapeño? A few things are missing. </em><strong>The biggest one:</strong> those wins only showed up after swapping out how the model itself works, not just the chip underneath it.</p><p>Today’s language models — including everything Jalapeño runs — use something called <strong>“attention”</strong> where every word in a sentence checks in with every other word to figure out what matters. That’s a great trick for making models smart, but it’s a terrible fit for a chip built around small units that mostly talk to their immediate neighbors, not everyone at once — Intel’s own researchers put it plainly: attention “is not compatible with most neuromorphic architectures” (<a href="https://arxiv.org/html/2503.18002v2">Neuromorphic Principles for Efficient Large Language Models on Intel Loihi 2, arXiv</a>).</p><p>To get the efficiency gains, both research teams had to use a different kind of model instead of a standard one. That’s not a chip swap — that’s asking the entire industry to train its models differently.</p><p>On top of that: training doesn’t really work well on this kind of hardware yet, so you can’t just take a model everyone’s already trained and drop it on a spiking chip (<a href="https://www.eetimes.com/what-is-holding-back-neuromorphic-computing/">EE Times, interview with Intel neuromorphic lead Mike Davies</a>).</p><p>The chips themselves can’t talk to each other fast enough yet, either — Loihi 2 supports up to about 160 million messages per second between chips, well below what a data-center-scale interconnect needs to move between GPUs (<a href="https://arxiv.org/html/2503.18002v2">arXiv</a>).</p><p>And nobody has actually shown any of this working at real scale: the NorthPole test used a 3-billion-parameter model and the Loihi 2 test used a 370-million-parameter model (<a href="https://research.ibm.com/blog/northpole-llm-inference-results">IBM Research</a>; <a href="https://arxiv.org/html/2503.18002v2">arXiv</a>). Jalapeño, by comparison, is being deployed against models up to roughly a trillion parameters (<a href="https://openai.com/index/jalapeno-first-results/">OpenAI</a>).</p><p><strong>Put simply</strong>: the idea isn’t broken, it just hasn’t been proven at the size and speed the LLM industry actually runs at, and the way there means changing the model, not just the chip.</p><h3>6. When should you actually use one over the other?</h3><p>If you’re <strong>serving a big language model to lots of people</strong>, from a data center, with real power infrastructure behind you, a chip like Jalapeño — or Nvidia, or Google’s TPUs — is really your only mature option right now. Nobody has shown a neuromorphic chip doing anything close to that.</p><p>But if you’re <strong>building a physical device</strong> that needs to sense the world, run for a long time on a tiny battery, and maybe adapt to its user over time — a wearable, a smart sensor, a camera with no outlet nearby — Akida and Pulsar are already real options. You can order development kits for both right now.</p><p>If you’re building <strong>edge hardware</strong> with power limits, start now. The tooling is further along than most people assume.</p><p>If your work is anywhere near data-center-scale model serving, it’s not there yet.</p><h3>7. Does Jalapeño actually solve the energy problem?</h3><p><strong>Not really.</strong></p><p>And the reason why is actually the most interesting part of this whole story.</p><p>Jalapeño makes each chip do more with the power it gets. That’s real, and it’s genuinely useful. But “using power better” and “having enough power” are two different problems — and right now, the second one is <strong>the bigger issue.</strong></p><p>At <strong>Vera talk Hot Chips 2026 conference</strong> Nvidia emphasized something that stuck with me: <strong>“The data center is power limited today”</strong>. Not chip limited. Power limited.</p><p>In plain terms: <strong>companies can now buy plenty of chips.</strong> <strong>What they can’t easily get is enough electricity to run them.</strong></p><p>Getting a new power connection built for a data center takes 2 to 6 years right now, and in some places even longer. The equipment needed to bring that power in — big transformers and switching gear — can take 2 to 4 years to build and deliver on its own. Meanwhile, the amount of electricity data centers in the US want is expected to roughly triple by 2030, and experts think supply won’t keep up (<a href="https://inflect.com/blog/data-center-power-shortage-2026-why-grid-capacity-is-now-the-bigger-constraint-than-gpus">Inflect</a>). <strong>None of that speeds up just because Jalapeño exists.</strong></p><h4><strong>So does that mean even Jalapeño can’t fix this? Yes, correctly read.</strong></h4><p>Jalapeño makes each watt of power do more work — more tokens served per watt. That’s real and valuable. But it doesn’t create new watts. If a data center’s power feed is capped at, say, 300 megawatts because that’s what the utility can deliver this decade, a more efficient chip lets you serve more users within that 300 MW ceiling — it doesn’t raise the ceiling itself. That’s exactly why Nvidia was framing it as “power limited,” not “chip limited”: the bottleneck moved up a layer, from silicon to infrastructure.</p><h4>I<strong>f the real problem is “we can’t get enough electricity,” could switching to neuromorphic chips actually fix that, instead of just working around it?</strong></h4><p>In theory, yes — that’s the exciting part.</p><p>A chip that only uses power when something actually needs to happen, instead of running constantly whether or not anything changed, could let a data center do a lot more with the same amount of electricity. That’s a bigger deal than just “a faster chip,” because the electricity itself isn’t growing fast. And the early results aren’t just theory — IBM and Intel’s chip-level tests, and <strong>NSLLM (Neuromorphic Spike-Based Large Language Model)</strong>, a model built by researchers at the Chinese Academy of Sciences specifically to run on brain-like hardware, are all real hints that this could work:<strong> NSLLM</strong> reportedly reached about 19.8 times better energy efficiency than a GPU running the equivalent model, while drawing under 14 watts <strong>(</strong><a href="https://academic.oup.com/nsr/article/13/4/nwaf551/8365570"><strong>National Science Review</strong></a><strong>).</strong></p><h4><strong>If the case for switching looks this strong, why hasn’t the industry already done it?</strong></h4><p>The honest answer is that switching isn’t free, and today’s approach still works. Transformers have years of proof behind them — labs know almost exactly what happens when they add more data and more compute, which makes betting billions of dollars on the next model a calculated risk instead of a blind one.</p><p>Today’s language models are also built in a way that doesn’t fit neuromorphic chips well (mostly due to the attention layer), so every win so far has needed a different kind of model, not just a different chip — <strong>and nobody has proven that a brain-inspired model can match frontier-level quality at anywhere near the size Jalapeño is being built for.</strong></p><p>So it’s easy to see why this feels like it’s heading toward a wall: the industry keeps improving the same architecture and the same chips, while the thing that architecture depends on — electricity — isn’t growing anywhere near as fast. <strong>Unless power supply itself starts scaling a lot faster than it currently is, doing more of the same thing, just more efficiently, doesn’t actually get around the limit. It just delays hitting it.</strong></p><p>So here’s where that leaves things. <strong>Jalapeño doesn’t solve the energy problem</strong>, because that was never really its job — it makes the most of the power a data center already has.</p><p>Neuromorphic hardware is the <strong>bigger, riskier bet</strong>: it might actually lower how much power is needed in the first place.</p><p><em>But that means changing how AI models are built, not just changing the chip underneath them — and nobody’s proven that at scale yet.</em></p><p>Both ideas are real. Neither one is finished.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zLhS05WJo5X4z1tshzxzFA.png" /></figure><h3>8. <strong>Why this story is worth following</strong></h3><p>Almost all of the public conversation about efficient AI chips right now is about the big, well-funded names — <strong>Jalapeño, Nvidia, Google’s TPUs</strong>. That makes sense; that’s where the money and headlines are. But there’s a second story running quietly alongside it, built on a genuinely different idea: don’t compute things that didn’t change, and let the chip keep learning after it ships. That’s not a small idea. It’s a different way of thinking about what “energy efficient” even means.</p><p>I’ll be honest about where this stands, though. <strong>Neuromorphic hardware still has to prove it can survive as a business</strong>, <strong>not just work as a technology.</strong> <a href="https://rain.ai/about">Rain</a>, a neuromorphic startup that <strong>Sam Altman</strong> personally backed early on (<a href="https://venturebeat.com/ai/beyond-gpus-innatera-and-the-quiet-uprising-in-ai-hardware">VentureBeat</a>), spent years trying to turn its chip into real contracts. A targeted $150 million funding round fell through in 2025, and, as of reporting from August 2026, talks for OpenAI to acquire the company outright collapsed — OpenAI instead picked up a limited set of Rain’s patents, and <strong>most of Rain’s staff has since left</strong> (<a href="https://finance.yahoo.com/news/sam-altmans-150m-ai-chip-123106283.html">Yahoo Finance</a>; <a href="https://crypto.news/openai-acquires-rain-ai-patents-takeover-talks-fail/">crypto.news</a>). That’s a <strong>real warning sign</strong>, not a footnote.</p><p>But… Akida is still shipping (<a href="https://brainchip.com/chips/">BrainChip</a>). Pulsar just launched (<a href="https://www.innatera.com/newsroom/innatera-unveils-pulsar-the-worlds-first-mass-market-neuromorphic-microcontroller-for-the-sensor-edge/">Innatera</a>). Neither slowed down because Rain didn’t make it.</p><p>The case for neuromorphic hardware hasn’t fully proven itself yet. But it’s <strong>being built, quietly, right now.</strong></p><blockquote>Curious to see what the future holds for neuromorphic computing and what a resilient business model will be.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71502f73f1b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[inhousecode: AI Code Review Tool That Enforces Your Team’s Own Rules]]></title>
            <link>https://medium.com/@ifilimon26/inhousecode-ai-code-review-tool-that-enforces-your-teams-own-rules-17c56f277536?source=rss-a21ca55181b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/17c56f277536</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[agent-skills]]></category>
            <dc:creator><![CDATA[Iulia Istrate]]></dc:creator>
            <pubDate>Sat, 22 Aug 2026 10:37:42 GMT</pubDate>
            <atom:updated>2026-08-22T10:37:42.527Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>inhousecode GitHub repo: </strong><a href="https://github.com/iuf26/inhousecode#about"><strong>https://github.com/iuf26/inhousecode#about</strong></a></p><p>Code review didn’t get faster just because AI made writing code faster. A diff an agent writes in seconds still takes a person real time to read — and in practice, that time often doesn’t get spent.</p><p><strong>inhousecode</strong> runs the entire code review workflow for a change, end to end: static checks first, then an AI code-review skill that checks the code changes against rules your team writes down in one file, checked into the repo, then automatic fixing and re-checking of what your team declared it doesn’t need a human call.</p><p>The static step matters for a specific reason — it’s deterministic. The same code run through it twice gives the same result twice, which an AI review can’t 100% promise on its own.</p><p>In an era where more of the code being reviewed is itself AI-generated, having a part of the process you can always trust to behave the same way is worth keeping. Instead of running static checks yourself, feeding the diff to a model, and deciding by hand what’s real, what’s auto-fixable, and what still needs a human, <strong>inhousecode</strong> does that in one call: code security <strong>static checks run first</strong>, the <strong>AI code-review skill checks what static analysis can’t</strong>, findings <strong>get fixed and re-checked automatically</strong>, and everything else comes back numbered, with a PASS/FAIL code review verdict at the end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fTgqsbjipJk0Fu6Yr14TUQ.png" /></figure><h3>Not just an instructions file — a structured place for tribal knowledge</h3><p>Claude Code Review and Copilot code review both let you customize behavior by editing one file (CLAUDE.md, REVIEW.md, copilot-instructions.md) — free-form prose the model tries to follow. That file is input to a pipeline you can&#39;t see or change; the review method itself belongs to the vendor.</p><p>inhousecode’s developer rulebook markdown file is structured instead: one line per rule, in a fixed format —</p><pre>- id (scope) — the rule<br><br>#Example<br>- no-select-star (sql) - list columns explicitly in SELECT queries, for query performance<br>- skill-toc-required (markdown) - any agent skill file over 100 lines needs a table of contents</pre><p>id is what the reviewer cites back to you in every finding.</p><p>scope limits the rule to the files it applies to.</p><p>The rule itself is one checkable sentence — not a paragraph of guidance a model has to interpret.</p><p>The developer’s rulebook file <strong><em>inhousecode </em></strong>provides is a place to put the knowledge that currently only lives in a senior engineer’s head, or gets repeated in PR comments every few weeks — “don’t SELECT *, it kills query performance&quot; or &quot;skill files need a table of contents once they get 100 lines long.&quot; Once it&#39;s a line in the rulebook, it&#39;s checked the same way on every single diff, forever, and the reviewer names the rule instead of giving a vague comment.</p><p>And because it’s open source, you can also fully change the process around it:</p><ul><li><strong>Add, remove, or replace the static checks.</strong> Semgrep is the default, not a requirement — swap it for another scanner, or bolt on your own linter or license check.</li><li><strong>Change what the AI review actually does.</strong> The AI review step is an agent skill you can edit directly — its checklist, how it double-checks its own findings, how it decides severity.</li><li><strong>Shape the whole workflow around how your team actually wants to review code</strong>, not just tune a fixed process from the outside.</li></ul><p>The two-step structure is deliberate: static checks catch what can be checked deterministically. The AI step then gives a human-readable analysis of what static checks can’t catch, so a person decides what actually needs fixing. And because it runs locally, you can run it on your own code before a colleague ever sees it.</p><h3>Three ways people use it</h3><ol><li><strong>Reviewing your own code before you commit</strong></li></ol><pre>git commit</pre><p>Runs automatically via a pre-commit hook. Catches issues before they’re in the history at all.</p><p><strong>2. Reviewing a colleague’s pull request</strong></p><pre>inhousecode review --pr 1234</pre><p>Give it a GitHub PR number or URL. It fetches that PR’s commit and reviews it directly — no need to check out the branch or know what it targets.</p><p><strong>3. Reviewing what a coding agent just wrote</strong></p><p>Runs automatically when your coding agent finishes a turn. Set it up as a hook on Copilot CLI’s agentStop event, so agent-written code gets checked while the agent&#39;s context is still loaded — a fix costs nothing to re-explain at that point.</p><h3>Get it</h3><p>MIT-licensed, free to self-host.</p><p>A <a href="https://github.com/iuf26/inhousecode#managed-cloud-version">cloud-hosted version</a> is also available for teams that don’t want to run it themselves.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17c56f277536" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You’re the Architect, Not the Typist: Getting Real Value from AI Coding Tools]]></title>
            <link>https://medium.com/@ifilimon26/youre-the-architect-not-the-typist-getting-real-value-from-ai-coding-tools-7e4b3cbedb14?source=rss-a21ca55181b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e4b3cbedb14</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-coding]]></category>
            <dc:creator><![CDATA[Iulia Istrate]]></dc:creator>
            <pubDate>Sat, 08 Aug 2026 11:26:55 GMT</pubDate>
            <atom:updated>2026-08-21T12:02:28.156Z</atom:updated>
            <content:encoded><![CDATA[<h3>The problem every developer might run into</h3><p>It doesn’t matter whether you’re a junior or a staff engineer: sooner or later, working with an AI coding tool feels like this.</p><p>You open the chat, describe your problem in a sentence or two, and hit enter. The model replies. You reply. It edits some code. You run it — still broken. You explain again. It tries something else. Twenty minutes later you’re deep in a long, meandering conversation, the problem still isn’t solved, and you have the sinking realization:</p><blockquote>I’ve lost half an hour in this session and I’m no closer than when I started.</blockquote><p>The instinct that got us here is understandable. We start these tools <strong>thinking they’ll just figure it out</strong> if we give them a short, vague prompt. “Fix the login bug.” “Make this faster.” “Add caching.” We treat the AI like it can read our mind — like it already knows the shape of our codebase, the constraints we’re carrying in our head, and the design we half-imagined but never wrote down.</p><p>It doesn’t. And a vague prompt doesn’t lead the model to the answer — it <strong>talks you into a hole</strong>. Each vague turn spawns another plausible-but-wrong direction, and by the time you feel that “hmm, I need to back up several steps and take a different path” moment, you’ve already sunk real time into a dead-end conversation.</p><h3>The mental model: you are the architect</h3><p>An architect doesn’t hand a construction crew a napkin that says “build house” and hope. They produce a design, align on it, and <em>then</em> the crew executes.</p><p>Your job in an AI session is the same. This is where the difference is still made — where a senior engineer and a junior engineer diverge, regardless of how good the model is.</p><h3>The workflow: think → plan → execute</h3><p>For almost any task — implementing a feature, writing documentation, fixing a bug — this three-step loop beats diving straight into “just fix it”:</p><h4>1. Think / brainstorm with the AI</h4><p>Use the AI as a thinking partner <em>before</em> it writes anything. Explore the problem space, surface edge cases, weigh approaches, poke holes. You’re not asking for code yet — you’re building the shared understanding of <em>what</em> and <em>why</em>.</p><h4>2. Agree on a plan</h4><p>Turn that thinking into an explicit plan: the steps, the files involved, the approach, what “done” looks like. Read it. Correct it. This is the checkpoint where you catch a wrong direction in <em>seconds</em> instead of after 30 minutes of generated code.</p><h4>3. Let the AI execute the plan</h4><p>Now, let the model do the work. With an agreed plan and real context, the execution phase is fast, focused, and far less likely to spiral into the endless-conversation trap.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CsJLA4vOsnmBe7LR0lOBtQ.png" /></figure><h3>What can you do right away?</h3><h4>Give context like you would to a human colleague</h4><p>Whatever you’d tell a new teammate to get them productive, the AI needs too: the stack, the conventions, the architecture, the “we don’t do it that way here” rules, the constraints.</p><p>Mostly you give this context <strong>per prompt</strong> — explain it in the conversation, exactly like you’d explain it in a message to a colleague.</p><blockquote><strong><em>Optional, worth knowing:</em></strong><em> if you find yourself repeating the same context every session, most tools can read it from a file automatically — the common one is </em><strong><em>AGENTS.md</em></strong><em> (see </em><a href="https://agents.md/"><em>agents.md</em></a><em>). Think of it as somewhere to jot your design- and project-level notes </em><strong><em>in plain language</em></strong><em> — the stack, the conventions, how things fit together — written the way </em>you&#39;d<em> explain it to a new teammate.</em></blockquote><p>How much of that context you need to spell out, and how, depends also on the tool being used. That’s because AI Coding tools (claude code, github copilot, etc.) aren’t all the same category of thing, even though people lump them together. See <a href="https://medium.com/@ifilimon26/know-your-tools-agent-vs-assistant-vs-ide-06bc46786625?postPublishedType=initial">Know Your Tools: Agent vs. Assistant vs. IDE</a> for the breakdown.</p><h4>Use the planning capability AI coding tools offer</h4><p>Most AI Coding tool have a dedicated feature for planning. It makes the AI show you its plan and wait for your approval before it touches a single file. Learn the one for your AI Coding tool, and use it when necessary.</p><h4>Claude Code</h4><p><a href="https://code.claude.com/docs/en/common-workflows#plan-before-editing"><strong>Plan Mode</strong> in Claude</a> proposes an implementation plan <em>without</em> touching your files that you can approve before any edits happen.</p><h4>GitHub Copilot</h4><p><a href="https://github.blog/changelog/2026-01-21-github-copilot-cli-plan-before-you-build-steer-as-you-go/"><strong>Copilot CLI</strong>’s plan mode</a> lets you collaborate on an implementation plan before any code is written.</p><h4>Codex CLI</h4><p><a href="https://github.com/openai/codex/blob/main/codex-rs/collaboration-mode-templates/templates/plan.md">A first-class </a><a href="https://github.com/openai/codex/blob/main/codex-rs/collaboration-mode-templates/templates/plan.md"><strong>/plan</strong> command</a>. Strictly design-only / non-mutating — it chats its way to a decision-complete plan and emits it for approval before anything is written.</p><h4>Google Antigravity</h4><p><strong>Agent-first</strong> — the agent produces an <a href="https://antigravity.google/docs/implementation-plan"><strong>Implementation Plan</strong></a> artifact and requests your review before making changes.</p><h3><strong>Bringing It Together</strong></h3><p>When you use an AI coding tool to implement something, write documentation, or fix a bug, don’t lead with a vague one-liner and hope.</p><p>Instead:</p><ol><li><strong>Think / brainstorm</strong> the idea <em>with</em> the AI.</li><li><strong>Agree on a plan</strong> (you can use the tool’s integrated planning mode).</li><li><strong>Let the AI execute</strong> that plan.</li></ol><blockquote><strong>You are the architect. The AI is the executor. That’s where the difference is still made.</strong></blockquote><p>For AI Consulting/AI Adoption/AI Trainer contact me on my <a href="https://www.linkedin.com/in/iulia-istrate-67bb50224?utm_source=share_via&amp;utm_content=profile&amp;utm_medium=member_ios">linkedin account</a> 😉.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e4b3cbedb14" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Know Your Tools: Agent vs. Assistant vs. IDE]]></title>
            <link>https://medium.com/@ifilimon26/know-your-tools-agent-vs-assistant-vs-ide-06bc46786625?source=rss-a21ca55181b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/06bc46786625</guid>
            <dc:creator><![CDATA[Iulia Istrate]]></dc:creator>
            <pubDate>Sat, 08 Aug 2026 10:31:27 GMT</pubDate>
            <atom:updated>2026-08-21T12:02:47.690Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://claude.com/product/claude-code"><em>Claude Code</em></a><em>, </em><a href="https://github.com/features/copilot"><em>GitHub Copilot</em></a><em>, </em><a href="https://openai.com/codex/"><em>Codex CLI</em></a><em>, </em><a href="https://antigravity.google/"><em>Google Antigravity</em></a><em> — they get lumped together as “AI coding tools,” but they’re not the same category of thing. Here’s what each one actually is, so you know what you’re delegating to.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UjMOpZOqV06xNag7iK3fxw.png" /></figure><p><strong>In plain terms:</strong></p><ul><li><a href="https://claude.com/product/claude-code"><strong>Claude Code</strong></a><strong> — AI coding harness/agent (CLI-based).</strong> A command-line tool, <em>not</em> an IDE. It works autonomously: plans, runs terminal commands, writes/edits files, tests its own code, and iterates with minimal hand-holding. Best for unattended, complex tasks where you want real diffs shipped with light supervision. It has no UI of its own — it runs in your terminal alongside whatever editor you already use.</li><li><a href="https://github.com/features/copilot"><strong>GitHub Copilot</strong></a><strong> — AI-assisted assistant (autocomplete-first).</strong> The IDE plugin (VS Code/JetBrains/etc.), <em>not</em> a standalone app. Originally autocomplete-focused — suggesting the next line/block as you type — and it has since added chat and agent-mode task breakdowns, but its core strength is fast, in-the-moment suggestions while <em>you</em> actively write code. Best for a real-time pair-programming feel, tightly integrated with the GitHub/VS Code ecosystem.</li><li><a href="https://docs.github.com/en/copilot/how-tos/copilot-cli/use-copilot-cli/overview"><strong>GitHub Copilot CLI</strong></a><strong> — AI coding harness (CLI-based).</strong> A separate product from the IDE plugin, despite the shared name. It runs in the terminal, has its own plan mode, and takes a task through to a multi-file diff much like Claude Code or Codex CLI — this is GitHub’s entry in the “harness” category, not the “assistant” one.</li><li><a href="https://openai.com/codex/"><strong>Codex CLI</strong></a><strong> (OpenAI) — AI coding harness (CLI-based).</strong> Same category as Claude Code: a terminal-based autonomous agent, not an IDE. Ships with ChatGPT plans; takes a task, runs commands, edits code, and iterates. Competes directly with Claude Code (currently benchmarked a bit behind it on the hardest tasks).</li><li><a href="https://antigravity.google/"><strong>Google Antigravity</strong></a><strong> — AI-native IDE (standalone app).</strong> An actual IDE — a full standalone application, not a CLI or a plugin. It’s <strong>model-agnostic</strong>: ships with Gemini, Claude (Sonnet/Opus), and GPT-OSS models, switchable in one click. Its defining feature is orchestrating <strong>multiple sub-agents with defined roles</strong> inside the IDE itself. Best for people who want a full IDE experience built around multi-agent workflows, or teams on the Google Cloud/Firebase/Gemini stack.</li></ul><blockquote><strong><em>The takeaway:</em></strong><em> “harness/agent” (Claude Code, Codex CLI, GitHub Copilot CLI) means </em>you delegate a whole task and it runs the loop autonomously<em>. “Assistant” (the Copilot IDE plugin) means </em>it works alongside you in the editor — it can chat, review, and even carry out multi-step changes when asked, but its defining strength is staying in the loop with you as you write, not running off unattended<em>. “AI IDE” (Antigravity) means </em>the whole environment is agent-native<em>. Knowing which one you’re using changes how much you need to spell out upfront — a bad plan handed to an autonomous agent means a lot of wasted autonomous work; a bad prompt to an assistant just means you reject the next suggestion.</em></blockquote><p>For AI Consulting/AI Adoption/AI Trainer contact me on my linkedin account 😉.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=06bc46786625" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detecting Secrets in GitHub PRs with Microsoft’s Agentic Framework (and a Shared State Twist)]]></title>
            <link>https://medium.com/@ifilimon26/detecting-secrets-in-github-prs-with-microsofts-agentic-framework-and-a-shared-state-twist-a4d9f85fe797?source=rss-a21ca55181b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4d9f85fe797</guid>
            <dc:creator><![CDATA[Iulia Istrate]]></dc:creator>
            <pubDate>Sun, 19 Apr 2026 10:05:51 GMT</pubDate>
            <atom:updated>2026-04-19T10:05:51.165Z</atom:updated>
            <content:encoded><![CDATA[<p>When I set out to build a “secrets in PRs” detector, I didn’t want another monolithic script that pulls a file, scans it, and posts a comment. I wanted a system that feels more like a team: multiple agents, working in parallel, coordinating on shared context, and pushing review comments directly into GitHub. That’s exactly what Microsoft’s agentic framework gave me.</p><p>This post walks through how the workflow works, why chunked parallel analysis matters, and the neat little concurrency detail that keeps all agents aligned: async with ctx.shared_state.hold().</p><h3>The Goal: Detect Secrets, Comment on PRs</h3><p>The workflow is simple in spirit:</p><ol><li>Pull all files touched by a PR</li><li>Split each file into chunks</li><li>Run multiple “secret detector” agents in parallel</li><li>Aggregate findings and comment on the PR</li></ol><p>The real value comes from how it scales and coordinates, not just what it does.</p><h3>Step 1: GitHub MCP + Agents as First‑Class Tools</h3><p>The GitHub MCP server is the backbone that exposes GitHub operations as tools. Once the MCP is connected, agents can call GitHub functions directly: list files, start reviews, comment on lines, etc.</p><p>The agent framework lets me wrap those tools into targeted agents, like a “PullRequestExtractorAgent” or a “GithubCodeReviewerAgent.” Each agent has its own instructions, tools, and response format. This separation makes it easy to build clean, composable workflows.</p><p>The GitHub MCP server exposes GitHub actions as tools, so agents can list PR files, start reviews, and post comments.</p><pre>from agent_framework.openai import OpenAIChatClient<br>from agent_framework import MCPStdioTool, ChatAgent<br>import os<br>from dotenv import load_dotenv<br><br>load_dotenv(dotenv_path=&quot;.env&quot;, override=True)<br><br>chat_client = OpenAIChatClient(<br>    api_key=os.getenv(&quot;OPENAI_API_KEY&quot;),<br>    model_id=os.getenv(&quot;MODEL_ID&quot;),<br>)<br><br>GITHUB_TOKEN = os.getenv(&quot;GITHUB_PAT_TOKEN&quot;)<br>toolsets = &quot;repos,context,pull_requests,issues,users&quot;<br><br>github_mcp = MCPStdioTool(<br>    name=&quot;GitHubMCP&quot;,<br>    command=&quot;docker&quot;,<br>    args=[<br>        &quot;run&quot;, &quot;-i&quot;, &quot;--rm&quot;,<br>        &quot;-e&quot;, f&quot;GITHUB_PERSONAL_ACCESS_TOKEN={GITHUB_TOKEN}&quot;,<br>        f&quot;-e&quot;, f&quot;GITHUB_TOOLSETS={toolsets}&quot;,<br>        &quot;ghcr.io/github/github-mcp-server&quot;,<br>    ],<br>    chat_client=chat_client,<br>)<br><br>await github_mcp.connect()<br>print(&quot;GitHub MCP connected&quot;)</pre><h3>Step 2: Split Files Into Chunks (So Parallelism Actually Works)</h3><p>Instead of feeding a whole file into one agent, I split files into 10‑line chunks. This is intentionally simple, but the key is the concept: you want many small, independent pieces so that multiple agents can work at once.</p><p>Each chunk carries metadata:</p><ul><li>original file name</li><li>original line range</li><li>repo/owner/PR number</li></ul><p>That metadata becomes the shared language between agents.</p><h3>Step 3: Parallel Processing with Multiple Secret‑Detector Agents</h3><p>Here’s the part I love: I spin up multiple SecretsDetectorExec executors. Each executor only processes the chunks assigned to its shard. The sharding is deterministic, based on chunk metadata:</p><pre>import hashlib<br>import uuid<br>from domain.models import TextChunk<br><br>NAMESPACE = uuid.UUID(&quot;&quot;)<br><br>def stable_uuid(s: str) -&gt; str:<br>    s = s.strip().lower()<br>    return str(uuid.uuid5(NAMESPACE, s))<br><br>def shard_for_chunk(chunk: TextChunk, total_agents: int) -&gt; int:<br>    h = hashlib.sha256(f&quot;{chunk.source_file}|{chunk.line_span}&quot;.encode()).digest()<br>    return int.from_bytes(h[:4], &quot;big&quot;) % total_agents</pre><p>That means:</p><ul><li>every chunk always goes to the same agent</li><li>agents can run completely in parallel</li><li>no chunk gets processed twice by mistake</li></ul><p>The workflow fan‑out/That means:</p><ul><li>every chunk always goes to the same agent</li><li>agents can run completely in parallel</li><li>no chunk gets processed twice by mistake</li></ul><p>The workflow <a href="https://learn.microsoft.com/en-us/agent-framework/user-guide/workflows/core-concepts/edges?pivots=programming-language-python#fan-out-edges">fan‑out</a>/<a href="https://learn.microsoft.com/en-us/agent-framework/user-guide/workflows/core-concepts/edges?pivots=programming-language-python#fan-in-edges">fan‑in</a> pattern makes this clean:</p><ul><li>one exporter sends chunks</li><li>many detectors run in parallel</li><li>one aggregator collects results pattern makes this clean:</li><li>one exporter sends chunks</li><li>many detectors run in parallel</li><li>one aggregator collects results</li></ul><h3>The Key Concurrency Trick: Shared State Holds. Secrets Detector Executor (Parallel Agents)</h3><p>This was the most interesting part of the implementation.</p><p>When multiple agents run in parallel, you <em>need</em> a way to coordinate shared state — especially to avoid duplicate processing. The framework gives a shared state store and a hold() mechanism:</p><pre>async with ctx.shared_state.hold():<br>    chunk_processed = await ctx.shared_state.get_within_hold(key)<br>    if chunk_processed:<br>        ...<br>    await ctx.shared_state.set_within_hold(key, True)</pre><p>This pattern is subtle but powerful:</p><ul><li>hold() guarantees exclusive access to shared state in that block</li><li>get_within_hold + set_within_hold is atomic</li><li>other agents won’t race or overwrite the state</li></ul><p>In short: even with parallel agents, the system behaves consistently. No duplicates. No missing chunks. Just clean coordination.</p><p>Each executor is an agent that inspects only the chunks assigned to its shard.</p><pre>from agent_framework import handler, Executor, WorkflowContext<br><br>class SecretsDetectorExec(Executor):<br>    agent_instruction = &quot;&quot;&quot;<br>    &lt;instruction role=&quot;system&quot;&gt;<br>    You are a code-secrets detector. Given a text CHUNK and its original line interval,<br>    return only a JSON array of findings. Flag lines that contain likely secrets or PII.<br>    &lt;/instruction&gt;<br>    &lt;schema&gt;<br>    Output exactly:<br>    [<br>      { &quot;line_number&quot;: &lt;int&gt;, &quot;comment&quot;: &quot;&lt;types comma-separated&gt;. Please remove.&quot; }<br>    ]<br>    &lt;/schema&gt;<br>    &quot;&quot;&quot;<br><br>    def __init__(self, chat_client, my_shard: int, total_agents: int, id: str):<br>        agent = chat_client.create_agent(<br>            instructions=self.agent_instruction,<br>            name=f&quot;SecretsDetectorAgent_{id}&quot;,<br>        )<br>        self.id = id<br>        self.agent = agent<br>        self.my_shard = my_shard<br>        self.total_agents = total_agents<br>        super().__init__(agent=agent, id=id)<br><br>    def create_prompt_from_chunk(self, chunk: TextChunk):<br>        return f&quot;&quot;&quot;<br>        Please investigate the chunk from file {chunk.source_file}.<br>        START={chunk.line_span[0]}, END={chunk.line_span[1]}<br>        CHUNK:<br>        {chunk.text}<br>        &quot;&quot;&quot;<br><br>    @handler<br>    async def run(self, chunk: TextChunk, ctx: WorkflowContext):<br>        if shard_for_chunk(chunk, self.total_agents) != self.my_shard:<br>            return<br><br>        key = stable_uuid(repr((chunk.source_file, chunk.line_span)))<br><br>        # Shared state hold prevents duplicate processing across parallel agents<br>        async with ctx.shared_state.hold():<br>            chunk_processed = await ctx.shared_state.get_within_hold(key)<br>            if chunk_processed:<br>                return<br>            await ctx.shared_state.set_within_hold(key, True)<br><br>        response = await self.agent.run(self.create_prompt_from_chunk(chunk))<br>        # parse response, then emit results...</pre><h3>Step 4: Aggregating Results and Commenting on the PR</h3><p>Finally, the aggregator collects all findings and uses the GitHub MCP tools to post review comments. It can also batch or rate‑limit comment creation with a semaphore if needed.</p><p>This decoupling is crucial: detectors only detect; the aggregator handles GitHub write operations.</p><h3>Why This Matters</h3><p>This isn’t just a secrets scanner; it’s a pattern:</p><ul><li><strong>Parallelism by design</strong> — scale horizontally with more agents</li><li><strong>Shared state safety</strong> — no race conditions thanks to ctx.shared_state.hold()</li><li><strong>Composable agents</strong> — each role does one thing well</li><li><strong>Real GitHub integration</strong> — no mock steps, no manual steps</li></ul><p>The Microsoft agentic framework turns this into a clean, structured workflow instead of a tangled async script.</p><p>Exporter</p><p>The exporter fetches PR files and sends chunks downstream. The aggregator posts review comments.</p><pre>from agent_framework import WorkflowBuilder<br><br>total_agents = 3<br>secrets_detector_1 = SecretsDetectorExec(chat_client, id=&quot;SecretsDetector1&quot;, my_shard=0, total_agents=total_agents)<br>secrets_detector_2 = SecretsDetectorExec(chat_client, id=&quot;SecretsDetector2&quot;, my_shard=1, total_agents=total_agents)<br>secrets_detector_3 = SecretsDetectorExec(chat_client, id=&quot;SecretsDetector3&quot;, my_shard=2, total_agents=total_agents)<br><br>exporter = ChunksExporterExec(id=&quot;ChunkExporterAgent&quot;, github_mcp_server=github_mcp, chat_client=chat_client)<br>aggregator = ChunksAgregatorExec(id=&quot;ChunksAgregatorAgent&quot;, github_mcp_server=github_mcp)<br><br>builder = WorkflowBuilder()<br>builder.set_start_executor(exporter)<br>builder.add_fan_out_edges(exporter, [secrets_detector_1, secrets_detector_2, secrets_detector_3])<br>builder.add_fan_in_edges([secrets_detector_1, secrets_detector_2, secrets_detector_3], aggregator)<br><br>workflow = builder.build()</pre><h3>Why the Shared State Hold Matters</h3><p>With multiple agents running at once, the shared state must be consistent. The hold() context gives you atomic access to shared state so no two agents process the same chunk or overwrite each other.</p><p>This small detail turns a parallel workflow into a safe parallel workflow.</p><h3>Final Thoughts</h3><p>If you’re building any multi‑step analysis pipeline — code review, security checks, static analysis, even documentation generation — this pattern is worth copying. The combination of sharded parallel agents and shared state holds gives you both speed and correctness.</p><p>And once GitHub MCP is in the mix, the agents stop being assistants and start being teammates.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4d9f85fe797" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[HOW TO Deploy OpenTelemetry collector in Azure Container Apps]]></title>
            <link>https://medium.com/@ifilimon26/how-to-deploy-opentelemetry-collector-in-azure-container-apps-49c3977a6498?source=rss-a21ca55181b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/49c3977a6498</guid>
            <category><![CDATA[azure-container-apps]]></category>
            <category><![CDATA[gen-ai-tools]]></category>
            <category><![CDATA[opentelemetry]]></category>
            <category><![CDATA[opentelemetry-collector]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Iulia Istrate]]></dc:creator>
            <pubDate>Wed, 27 Aug 2025 19:49:23 GMT</pubDate>
            <atom:updated>2026-08-21T12:03:09.135Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is OpenTelemetry?</h3><ul><li>Vendor-agnostic observability framework that helps with generation, processing, and transmission of various types of telemetry data (also called signals)</li><li>Open-source project maintained by the CNCF, one of the largest projects after Kubernetes.</li><li>Standardizes cloud observability.</li><li>Supported by all major observability platforms (Datadog, Splunk, New Relic, Grafana).</li></ul><p><strong>OpenTelemetry protocol (OTLP)</strong></p><p>OpenTelemetry is first a protocol that standardizes the way to handle logging, metrics, and traces in your cloud application.<br>It defines a set of signals: logging, metrics, and traces.</p><p><strong>Logging. </strong>Think of this as <em>what happened and when</em>.</p><p>Example:</p><p>If an error occurs (e.g., <strong>CUDA out of memory</strong> during training), you log:</p><pre>{<br>  &quot;level&quot;: &quot;ERROR&quot;,<br>  &quot;timestamp&quot;: &quot;2025-08-17T14:00:35Z&quot;,<br>  &quot;message&quot;: &quot;Training step failed: CUDA OOM&quot;,<br>  &quot;batch_size&quot;: 128<br>}</pre><p><strong>Metrics. </strong>Think of this as system<em> health indicators tracked over time</em>.</p><p>Example:</p><p>Count number of emails metric</p><pre>from opentelemetry import metrics<br>from opentelemetry.sdk.metrics import MeterProvider<br>from opentelemetry.sdk.resources import Resource<br>from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter<br>from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader<br><br># Define service metadata<br>resource = Resource.create({&quot;service.name&quot;: &quot;email-service&quot;})<br><br># Configure OTLP Metric Exporter<br>exporter = OTLPMetricExporter(endpoint=&quot;http://localhost:4318/v1/metrics&quot;)<br><br># Set up Metric Reader<br>reader = PeriodicExportingMetricReader(exporter)<br><br># Configure provider<br>provider = MeterProvider(resource=resource, metric_readers=[reader])<br>metrics.set_meter_provider(provider)<br><br># Get a meter<br>meter = metrics.get_meter(&quot;my-meter&quot;)<br><br># Create a counter<br>email_counter = meter.create_counter(<br>    name=&quot;some.prefix.emails&quot;,<br>    description=&quot;Number of sent emails&quot;,<br>)<br><br># Example usage: increment counter<br>email_counter.add(1, {&quot;email.type&quot;: &quot;welcome&quot;})</pre><p><strong>Tracing. </strong>Think of this as <em>how a single request flows through the system</em>.</p><p>Example:</p><p>A user sends a <strong>chat prompt</strong> → request enters API Gateway → preprocessing → model inference → post-processing → response returned.</p><p>A trace shows each span:</p><p>span: api_gateway → duration 10 ms</p><p>span: text_preprocessing → duration 20 ms</p><p>span: gpt_inference → duration 220 ms</p><p>span: postprocessing → duration 15 ms</p><p>total trace latency: 265 ms</p><p>You can quickly see whether latency spikes come from <strong>preprocessing</strong>, <strong>model inference</strong>, or <strong>downstream dependencies</strong>.</p><p>It’s important to remember that you can export logs, metrics, and traces in <strong>two main ways</strong>:</p><ol><li><strong>Traditional way</strong> — Start your application with an <strong>OpenTelemetry agent</strong>. The agent runs as a separate process alongside your app (you can think of it like a sidecar).</li><li><strong>Modern way</strong> — Start your application normally, without any extra process. Instead, use the <strong>OTel SDK</strong> to send structured logs, metrics, and traces directly over the network to the <strong>Collector</strong>, which runs as an external service.</li></ol><p>In a distributed system, this modern approach means <strong>only one team needs to maintain the Collector and its configuration</strong>, simplifying operations.</p><p>A very good article that helped me understand OpenTelemetry architecture at scale can be found <a href="https://sodkiewiczm.medium.com/aws-opentelemetry-collector-architecture-at-scale-24c13f231d90">here</a> (credits to the author).</p><h4><strong>HTTP vs gRPC</strong></h4><p>OpenTelemetry is written in Go, from here comes the fact that they also have their own protocol. Under the hood the logs are convereted to the standard format of a protobu and thus exported further. Protobuf are a great mechanism to communicate between different services that are written in differnt languages.</p><p><strong><em>OTLP over gRPC</em></strong></p><p>Benefits:</p><ul><li>High performance: Offers strong throughput and low latency through HTTP/2 features like multiplexing, streaming, and flow control — ideal for heavy telemetry workloads. <a href="https://betterstack.com/community/guides/observability/otlp/?utm_source=chatgpt.com">Dynatrace+8Better Stack+8GitHub+8</a></li><li>Efficient binary encoding: Uses Protobuf, enabling compact, fast-serialized payloads. <a href="https://signoz.io/comparisons/opentelemetry-grpc-vs-http/?utm_source=chatgpt.com">SigNoz+1</a></li></ul><p>Downsides:</p><ul><li>Larger dependencies: Adds complexity and heavier binaries to your stack. <a href="https://betterstack.com/community/guides/observability/otlp/?utm_source=chatgpt.com">Reddit+3Better Stack+3GitHub+3</a></li><li>Potential infrastructure incompatibility: HTTP/2-based gRPC may be blocked by proxies, firewalls, or load balancers. <a href="https://www.checklyhq.com/docs/traces-open-telemetry/importing-traces/http-vs-grpc-protocols/?utm_source=chatgpt.com">arXiv+3Checkly+3Better Stack+3</a></li></ul><p>When to chose: When you’re operating in a high-throughput microservices environment (e.g., large-scale distributed tracing with thousands of spans per second) — and your infrastructure supports HTTP/2 — in which case <strong>gRPC provides smoother, more efficient telemetry ingestion</strong>.</p><p><strong><em>OTLP over HTTP</em></strong></p><p>Benefits:</p><ul><li>Broad compatibility: Works reliably in environments where gRPC isn’t supported — like legacy infra or browser-based instrumentation.</li><li>Lighter footprint: Minimal additional dependencies, making it easier to include in a variety of environments.</li></ul><p>Downsides:</p><ul><li>Potentially lower throughput: Less efficient, especially under heavy load when compared to gRPC.</li><li>Verbose encoding (especially with JSON): If JSON is used, payloads are larger and slower to process.</li></ul><p>When to chose: When you’re in a heterogeneous environment that includes browser clients or legacy systems not supporting gRPC — where reliability and compatibility are paramount, even if that means sacrificing some efficiency.</p><p><strong>Ecosystem</strong></p><p>OpenTelemetry offers an SDK in <strong>11 programming languages</strong>, complete with ready-made instrumentations and a <strong>Collector</strong>.<br> But let’s focus on the piece that matters most: <strong>the Collector</strong>.</p><h4><strong>OpenTelemetry collector in Azure Container Apps</strong></h4><p><strong>What is a Collector?</strong></p><p>An <strong>OpenTelemetry Collector</strong> acts as a central hub where all your telemetry data (logs, metrics, traces) is gathered before being sent to external systems.</p><p>The best part? You can forward data to <strong>multiple destinations at the same time</strong> — and you don’t need to change your application code to do it.</p><p>The Collector also lets you <strong>process and enrich your observability data</strong> before sending it out, giving you more flexibility and control.</p><p>Getting started is simple: there’s a ready-to-use Docker image, otel/opentelemetry-collector-contrib. Just run it in a container, and you instantly have a working OpenTelemetry Collector that can receive data and export it wherever you need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*MquKKwbhAQGnPEooFqBNDA.png" /><figcaption>Telemetry data collecting flow</figcaption></figure><p>Another important detail: the <strong>otel/opentelemetry-collector-contrib</strong> image looks for its default configuration at <strong>/etc/otelcol/config.yaml</strong> inside the Docker container.</p><p>A minimal config.yaml file looks like this:</p><pre>receivers:<br>  otlp:<br>    protocols:<br>      http:<br>        endpoint: 0.0.0.0:55554<br><br>processors:<br>  batch:<br><br>exporters:<br>  debug:<br>    verbosity: detailed<br><br>service:<br>  pipelines:<br>    traces:<br>      receivers: [otlp]<br>      processors: [batch]<br>      exporters: [debug]<br>    metrics:<br>      receivers: [otlp]<br>      processors: [batch]<br>      exporters: [debug]<br>    logs:<br>      receivers: [otlp]<br>      processors: [batch]<br>      exporters: [debug]</pre><p>The configuration file has <strong>3</strong> main important components:</p><ol><li><strong>Receivers</strong> — These are the entry points where telemetry data first arrives. In our example, the HTTP endpoint is set to 0.0.0.0:55554.</li></ol><p>This means any HTTP request sent to the container on <strong>any network interface</strong> and <strong>port 55554</strong> will reach the OpenTelemetry Collector. By default, the Collector listens on port <strong>4318</strong>. However, it’s a good practice to change this default for <strong>security reasons</strong>. In our case, we used port <strong>55554</strong>, but you can choose any available ephemeral port (range 49152–65535).</p><p><strong>2. Processors</strong> — Once data is received, you can decide if and how it should be processed before being exported. Processors allow you to control <strong>retention time</strong> or apply transformations. Examples include memory_limiter (to control memory usage) or batch/logs (to group logs before sending them to the exporter).</p><pre>processors:<br>  memory_limiter:<br>    check_interval: 20s<br>    limit_mib: 512<br><br>  batch/logs:<br>    timeout: 2s<br>    send_batch_size: 6000<br>    send_batch_max_size: 10_000</pre><p><strong>3. Exporters</strong> — this is where you decide <strong>what to do with the data</strong> after it’s been received and processed.<br> You configure which backends to send it to. And yes, you can define <strong>multiple exporters</strong> — for example, sending data to both <strong>Datadog</strong> and <strong>Grafana</strong> at the same time.</p><p>One thing worth remembering about the config.yaml file:<br> OpenTelemetry also exposes its <strong>internal Prometheus metrics</strong> on port <strong>8888</strong>. These aren’t your application logs, but the Collector’s own telemetry — useful if you want to <strong>monitor the health of the Collector itself</strong>.</p><p>Port <strong>8888</strong> is the <strong>Prometheus metrics endpoint</strong> exposed by the OpenTelemetry Collector itself.<br> It reports internal telemetry — such as CPU and memory usage, queue sizes, and the number of spans/logs/metrics processed — so that <strong>Prometheus can scrape it and monitor the Collector’s health and performance</strong>.</p><pre>receivers:<br>  prometheus/internal:<br>    config:<br>      scrape_configs:<br>        # Scrape the collector’s own Prometheus metrics<br>        - job_name: otel-collector<br>          scrape_interval: 30s         # Collect every 30 seconds<br>          static_configs:<br>            - targets: [&#39;localhost:8888&#39;]<br>              labels:<br>                service: otel-collector<br>                env: dev</pre><p>Architecture in Azure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*enNpln5hKQ2cC03Ms_ufOw.png" /></figure><p>Deploying <strong>OpenTelemetry</strong> in <strong>Azure Container Apps</strong> can be a bit tricky.<br> Before you start, it’s important to have a solid understanding of how Azure Container Apps behave and what makes them different from regular containers.</p><p>If you do not know , Azure Container Apps are designed for teams that do not have Kubernetes experience but they want the Kubernetes cluster power. Azure container apps can be cheaper the AKS (Azure Kubernetes Cluster) because they have the capacity to become idle while with kubernetes you can’t put a container in sleep or pause mode. A container in a pod is either running or is terminated.</p><ul><li>In <strong>AKS</strong>, you must manage scheduling/scaling yourself</li><li>In <strong>ACA</strong>, you can configure built-in rules for time-based scaling or idle scale-to-zero, which behaves closer to a “sleep mode.”</li></ul><p><strong>Container Apps Environment</strong></p><p>Azure Container Apps (ACA) run inside an <strong>ACA environment</strong>, which automatically provisions a <strong>load balancer resource</strong>.<br> All container apps you deploy live within this environment.</p><p><strong>ACA Ingress</strong></p><p>When deploying, you need to define <strong>ingress rules</strong> for your container app.<br> For example, if you’re running the OpenTelemetry Collector image, you can limit ingress traffic to the <strong>VNet</strong>.<br> The <strong>target port</strong> should match the port where the Collector expects telemetry data.</p><p><strong>Private DNS zones: </strong>After ingress, you also need to <strong>create a private DNS zone</strong> like *.&lt;aca-deployment-zone&gt;.azurecontainerapp.io if you want to integrate aca env with a VNet.</p><p>Why? Container Apps use an internal FQDN. Every ACA environment allocates a subdomain like:</p><pre>&lt;app-name&gt;.&lt;env-guid&gt;.youracaregion.azurecontainerapps.io</pre><p>If you integrate ACA with a VNet (internal access or private endpoints) the public DNS for *.azurecontainerapps.io resolves to Microsoft’s public IPs. Inside your private network, you need a private DNS zone (e.g., francecentral.azurecontainerapps.io) linked to your VNet, so lookups resolve to the <em>private</em> ACA IP instead of the public one.</p><p>To customize OpenTelemetry in <strong>Azure Container Apps (ACA)</strong>, you’ll need to <strong>mount a volume</strong> at the path /etc/otelcol/config.yaml. This lets you edit the configuration file outside of the container. A common approach is to store config.yaml in an <strong>Azure File Share</strong> and mount the volume from there.</p><p>One important note: the current <strong>Azure Portal UI</strong> doesn’t provide many ACA configuration options. Instead, ACA stores its setup in a .yaml file. You can <strong>download this file, update it, and re-apply it</strong> to push configuration changes.</p><p><strong>Command to download the ACA YAML configuration file:</strong></p><pre>az containerapp show --name &lt;container-app-name&gt; --resource-group &lt;container-app-rg&gt; --output yaml &gt; acaConfig.yaml</pre><p><strong>Command to upload the updated ACA YAML configuration file:</strong></p><pre>az containerapp update --name &lt;container-app-name&gt; --resource-group &lt;container-app-rg&gt; --yaml acaConfig.yaml</pre><p>By using this approach, you can simply update the configuration in the YAML file and then apply the changes to your Azure Container App (ACA).</p><h4>OpenTelemetry in the GenAI context</h4><p>You may already know that <strong>Langfuse uses OpenTelemetry</strong> under the hood. So why bother with OTel if you already have Langfuse?</p><p>The key difference: <strong>Langfuse doesn’t (yet) support logs</strong>, while OpenTelemetry provides a <strong>standardized way</strong> to handle <em>all</em> telemetry signals (logs, metrics, traces).</p><p>The OpenTelemetry project has even defined <a href="https://opentelemetry.io/docs/specs/semconv/gen-ai/"><strong>semantic conventions for Generative AI</strong></a>. These conventions ensure there’s a consistent format for GenAI-related telemetry data. That means:</p><ul><li>You can send GenAI telemetry through the OTel Collector to <em>any backend you choose</em> (Langfuse, Grafana, Splunk, etc.).</li><li>If you decide to switch from Langfuse to another tool later, you don’t have to rewrite your code — the collector handles the change.</li><li>You can even export to <strong>multiple backends at the same time</strong>.</li></ul><p>Another big win: the OTel community is actively building <strong>auto-instrumentors</strong> for GenAI frameworks. These let you capture telemetry without adding lots of custom code.</p><p>If you run a <strong>centralized OpenTelemetry Collector</strong> at scale, it can become the single point for all observability data: app logs, traces, even vector database interactions.</p><p>In short: with OpenTelemetry in place, your app stays <strong>vendor-neutral</strong>. You follow the GenAI semantic conventions once, and after that, switching or adding tools is just a matter of changing Collector configs — <strong>not rewriting your code</strong>.</p><p>It’s all about <strong>standardizing the process of sending telemetry data</strong>.</p><h4>OpenTelemetry curiosities</h4><p>One interesting detail is that the <strong>OpenTelemetry protocol is implemented in Go</strong>. You can explore the specification: <a href="https://github.com/open-telemetry/opentelemetry-proto/blob/main/docs/specification.md">OpenTelemetry Protocol Specification</a></p><p>If you’re working with Python, you can also look into the official <strong>instrumentation code for Generative AI (OpenAI SDK v2): </strong><a href="https://github.com/open-telemetry/opentelemetry-python-contrib/tree/main/instrumentation-genai/opentelemetry-instrumentation-openai-v2">OpenTelemetry Python Contrib — OpenAI Instrumentation</a></p><h4>Conclusion</h4><p>When working with OpenTelemetry, keep these key points in mind:</p><ul><li><strong>OTel Collector</strong> — the central hub for receiving, processing, and exporting telemetry.</li><li><strong>OTLP Protocol</strong> — the standard way to handle logs, metrics, and traces.</li><li><strong>OTLP over gRPC vs HTTP</strong> — gRPC is faster and more efficient, HTTP is more compatible.</li><li><strong>config.yaml</strong> — the collector configuration file that defines: <strong>Receivers</strong> (where data comes in), <strong>Processors</strong> (how data is transformed or batched), <strong>Exporters</strong> (where data is sent).</li><li>You can’t attach multiple config files to the same collector, but a <strong>single collector can export to multiple backends</strong>.</li><li>Design your collector architecture carefully to balance <strong>scalability, reliability, and maintainability</strong>.</li></ul><p>Thank you for reading! I hope you found this article helpful and that it gave you something useful to take away.</p><p>For AI Consulting/AI Adoption/AI Trainer contact me on my linkedin account 😉.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49c3977a6498" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CI/CD for Python Azure Functions using GitHub Actions in 2025]]></title>
            <link>https://medium.com/@ifilimon26/ci-cd-for-python-azure-functions-using-github-actions-in-2025-610450955fa2?source=rss-a21ca55181b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/610450955fa2</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[azure-functions]]></category>
            <category><![CDATA[github-actions]]></category>
            <dc:creator><![CDATA[Iulia Istrate]]></dc:creator>
            <pubDate>Thu, 27 Feb 2025 14:00:32 GMT</pubDate>
            <atom:updated>2025-02-27T14:00:32.955Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>I will first introduce the concepts we need to understand, and then proceed with the steps for implementing CI/CD for Azure Timer Triggered Function Apps with GitHub Actions.</p><p>❓ <strong><em>What are Azure Function Apps?</em></strong></p><p>Azure Function Apps are serverless compute services in Microsoft Azure that allow you to run event-driven applications without managing infrastructure. They are part of Azure’s Platform-as-a-Service (PaaS) offerings and are designed for small, modular pieces of code that execute in response to triggers.</p><p>Azure offers several plans for Function Apps, and it’s important to consider networking options when creating one. Some plans do not support deploying a Function App within a specific VNet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*W9Q_PxATBqYPWEadxAtlQw.png" /><figcaption>Azure function app plans. <a href="https://learn.microsoft.com/en-us/azure/azure-functions/functions-networking-options?tabs=azure-portal">Source</a></figcaption></figure><p>❓ <strong><em>What is GitHub Action?</em></strong></p><p>GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline.</p><p>❓ <strong><em>What is Azure Timer Trigger?</em></strong></p><p>Azure Timer Trigger is a serverless function trigger that allows you to run an Azure Function at scheduled intervals. Oftentimes, in the context of NLP, it is necessary to define text extraction pipelines from external sources that can be programmatically implemented using Azure Functions.</p><p>Azure offers several other triggers, including <strong>Blob Trigger, Cosmos DB Trigger, Event Hub Trigger, HTTP Trigger, Queue Trigger</strong>, and more.</p><h3>Steps</h3><h4><strong>Step 1: Initialize your function app project.</strong></h4><p>Open Visual Studio Code and run the following commands in <strong>cmd</strong>:</p><p><strong>$ func init</strong> – This command will ask you to <strong>choose</strong> the desired programming language. Since our example is for Python, the generated files are: requirements.txt, function_app.py, host.json, .gitignore, and local.settings.json.</p><p><strong>$ func new</strong> – This command will generate a function template in the function_app.py file. You will be prompted to <strong>choose</strong> a Trigger Type for your function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*c1CC3E1XoApvZPV--ors3g.png" /><figcaption>Trigger options</figcaption></figure><p>$ func start (optional) – Command to run your function and test it locally (<strong>Note:</strong> This command does not deploy the function).</p><h4>Step 2: Commit and Push Code to GitHub Repo</h4><p>Create your GitHub repo and push your function app code previously initialized.</p><h4><strong>Step 3: Setup Function App to deploy via CI/CD</strong></h4><p>There are a few configurations you need to set up CI/CD for your Function App.</p><p>To do this, go to your <strong>Function App</strong> and navigate to <strong>Deployment → Deployment Center</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*g89pvex-2QVIxJ2FOJ8F7g.png" /></figure><p>This time, select GitHub as the source. You will be prompted to complete your GitHub connectivity details.</p><p>In the Authentication Settings, you will be asked to choose an authentication type (User-Assigned Identity<strong> </strong>vs. Basic Authentication).</p><p>Choose the <strong>Basic Authentication (SCM Basic Auth)</strong> option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*-kL8S4qqSgZgLG_7T9GbNQ.png" /></figure><p>💡<strong> Basic Authentication</strong> uses a <strong>username and password</strong> for deployments, making it easy but less secure.</p><p>💡 <strong>User-Assigned Identity</strong> uses <strong>Azure AD authentication</strong>, removing passwords and improving security. Basic Auth works well with <strong>Git-based deployments (Bitbucket, GitHub)</strong>, while Managed Identity is ideal for <strong>Azure DevOps</strong> and accessing Azure services securely.</p><p>You may receive the following error when selecting Basic Authentication:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*E9jUpea_lJMM51iRygc4rQ.png" /></figure><p>Because of that, I could not choose this option. To fix this, go to <strong>&lt;Your Function App&gt; → Settings → Configuration → General Settings</strong> and turn <strong>SCM Basic Auth Publishing Credentials</strong> <strong>On.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ZgL0N6whL_LMnGzcZc3AA.png" /></figure><p>After clicking <strong>Save</strong> in the <strong>Deployment Center</strong>, you will notice that a <strong>.github/workflows</strong> folder has been created in your <strong>GitHub repository</strong>. Inside this folder, there is a <strong>.yml</strong> file named <strong>&lt;your-branch-name&gt;_&lt;your-function-name&gt;.yml</strong>.</p><p>For example, in my case, the file is named:<br><em>master_demo-ci-cd-python-azure-function-app.yml</em></p><p>This file defines and runs your CI/CD pipeline.</p><h4>Step 4: In GitHub repo, configure a self-hosted action runner.</h4><p>❓<strong>First</strong>, <strong><em>what is an Action Runner?</em></strong></p><ul><li>Runners are machines that execute jobs in a GitHub Actions workflow.</li><li>GitHub provides runners that you can use to run your jobs, or you can <a href="https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners">host your own runners</a>.</li></ul><p>❓<strong><em>What is a self-hosted action runner?</em></strong></p><ul><li>A self-hosted runner is a system that<strong> you</strong> deploy and manage to execute jobs.</li><li>It can be your own PC or a virtual machine (VM) instance in the cloud.</li><li>When a GitHub repository detects a push to your branch, it triggers a run of your CI/CD pipeline.</li></ul><p>❓<em> </em><strong><em>Self-hosted Runners vs. GitHub-hosted Runners: Costs?</em></strong></p><p>If you don’t want to manage the server that executes jobs, you can use <strong>GitHub-hosted runners</strong>, but you will have to pay for GitHub resources.</p><p>If you <strong>self-host</strong> your action runner, you only pay for the resources used in your specific cloud or production environment.</p><p>For experimentation, I personally used my computer as a server to execute job runners. It runs on your machine, detects changes, and triggers deployments.</p><p>💡<strong>Self-hosted runners are free</strong> — GitHub does not charge for them.</p><p><strong>Now, to configure a self-hosted runner:</strong></p><p>Go to <em>Repository → Settings → Actions → Runners</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kBP2Qoa8oMVMrr5IjTDbrg.png" /></figure><p>Select <em>New self-hosted runner</em>. You will be prompted with GitHub guidelines on how to set up the self-hosted action runner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*76IgY3sCs6M2PR2ZZiCyOQ.png" /></figure><p>When you run ./run.sh, your self-hosted runner will start.</p><p>Just remember that for your job to work, you must keep the self-hosted runner service running.</p><p><strong>Every time</strong> your pipeline runs, you can see the process and logs in <strong>GitHub Settings → Actions → Runners</strong>. Click your runner when a job is running; it will be displayed there. If any error occurs, you will be <strong>able</strong> to see the build logs.</p><h4>Step 5: Change your pipeline .yml file to run on &#39;self-hosted&#39;</h4><p>In the build job and deploy .yml lines, make sure to set runs-on to &#39;self-hosted&#39; because we are using self-hosted runners.</p><pre>build:<br>   runs-on: self-hosted</pre><pre>deploy:<br>   runs-on: self-hosted</pre><p>Otherwise, when using GitHub-hosted runners the job would run on Ubuntu, Windows or macOS.</p><h4>Step 6: Set the AzureWebJobsStorage Environment Variable in Function App Settings</h4><p>To make the deployment pipeline run successfully, you need to set the AzureWebJobsStorage environment variable to your storage account connection string.</p><p><strong>Why?</strong></p><p>AzureWebJobsStorage defines the connection string for an Azure Storage account used by the Functions runtime for essential operations, such as:</p><ul><li>Key management</li><li>Timer trigger handling</li><li>Event Hubs checkpointing</li></ul><h4>How to Find Your Storage Account connection string?</h4><ul><li>Go to <strong>Azure Portal</strong> → <strong>Storage Accounts</strong></li><li>Select your <strong>preferred storage account</strong></li><li>Navigate to <strong>Security → Access keys </strong>and copy your <strong>connection string</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*Fx605RKlYlNMMsmeInX5nw.png" /></figure><p>Now, everything is set up, and the pipeline should run correctly. You will see the deployed functions listed in your Function App Overview, like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*84VfWO04JyoWXXMrPbvrSw.png" /></figure><h3>Wrap-Up</h3><p>That’s it!<br>Thank you for reading, and I hope you find it helpful!</p><h3>Sources:</h3><ul><li><a href="https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners">About GitHub-hosted runners - GitHub Docs</a></li><li><a href="https://learn.microsoft.com/en-us/azure/azure-functions/functions-networking-options?tabs=azure-portal">Azure Functions networking options</a></li><li><a href="https://learn.microsoft.com/en-us/azure/azure-functions/functions-app-settings#azurewebjobsstorage">App settings reference for Azure Functions</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=610450955fa2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy Google Paligemma2 3b in Amazon SageMaker]]></title>
            <link>https://medium.com/@ifilimon26/deploy-google-paligemma2-3b-pt-224-in-amazon-sagemaker-341fc02ee862?source=rss-a21ca55181b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/341fc02ee862</guid>
            <category><![CDATA[paligemma]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[deploy]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[amazon-sagemaker]]></category>
            <dc:creator><![CDATA[Iulia Istrate]]></dc:creator>
            <pubDate>Wed, 08 Jan 2025 11:45:48 GMT</pubDate>
            <atom:updated>2025-01-30T11:31:39.234Z</atom:updated>
            <content:encoded><![CDATA[<p>PaliGemma 2 3B is a compact Visual Language Model (VLM).</p><ul><li><strong>3B</strong>: Indicates that the model has 3 billion parameters.</li><li><strong>224</strong>: Refers to the model being pre-trained on input images of size 224×224 pixels.</li></ul><p>For more details, please refer to the model card available on Hugging Face: <a href="https://huggingface.co/google/paligemma2-3b-pt-224">PaliGemma 2 3B on Hugging Face</a>.</p><p>I initially attempted to deploy the model in SageMaker using the code provided in the Hugging Face model card, but it turned out to be much more challenging than expected.</p><p>Running the code that Huggingface proposed in Amazon sagemaker will give you an error like this at inference time (a disatvantage of working in cloud):</p><pre>{<br>  &quot;code&quot;: 400,<br>  &quot;type&quot;: &quot;InternalServerException&quot;,<br>  &quot;message&quot;: &quot;The checkpoint you are trying to load has model type `paligemma` but Transformers does not recognize<br>this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers <br>is out of date.&quot;<br>}</pre><h3>Here are the steps to deploy this model in Amazon SageMaker:</h3><p><strong>1. Download model</strong></p><p>After gaining access, you can easily download the model from Hugging Face directly within an Amazon SageMaker Jupyter notebook using the following method:</p><pre>hf_token = &quot;&quot;  # Replace with your Hugging Face token<br><br>from transformers import (<br>    PaliGemmaProcessor,<br>    PaliGemmaForConditionalGeneration,<br>)<br>from transformers.image_utils import load_image<br>import torch<br><br>model_id = &quot;google/paligemma2-3b-pt-224&quot;<br>output_model_path = &quot;./paligemma2-model&quot;<br>model = PaliGemmaForConditionalGeneration.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map=&quot;auto&quot;, use_auth_token=hf_token).eval()<br>processor = PaliGemmaProcessor.from_pretrained(model_id, use_auth_token=hf_token)<br>model.save_pretrained(output_model_path)<br>processor.save_pretrained(output_model_path)<br>print(&quot;Model saved successfully!&quot;)</pre><p><strong>Model (</strong><strong>PaliGemmaForConditionalGeneration)</strong>:</p><p>This is the actual deep learning model responsible for generating outputs. It takes input tensors (processed text/image data) and runs inference. The .eval() method ensures that the model is in inference mode, optimizing it for predictions instead of training.</p><p><strong>Processor (</strong><strong>PaliGemmaProcessor)</strong>:</p><p>This handles input pre-processing and output post-processing. It converts raw input data (e.g., images and text) into a format the model can understand.</p><p>It also helps with tokenization, normalization, and other data transformations.</p><p>After the model generates predictions, the processor can convert them back into human-readable text.</p><p><strong>2. Zip model</strong></p><p>Why zip the model?<br>Zipping the model is an essential preparation step because Amazon S3 requires a .tar.gz file format to load the model properly.</p><p>⚠️ <strong>Warning:</strong> Ensure that you navigate to the directory where your model is saved before creating the zip file. The root of the zip should be the folder containing your model files.</p><p>If you attempt to create the zip file from a different location, it may lead to errors. I encountered issues when trying to zip the model without being in the correct directory, resulting in loading failures.</p><p>I used the following Linux command to create a model zip file:</p><pre>!cd pali_model &amp;&amp; tar zcvf model.tar.gz *</pre><p>3. <strong>Deploy in AWS S3 bucket</strong></p><pre>!aws s3 cp &lt;your-path-to-paligemma2&gt;/model.tar.gz s3://&lt;your-s3-bucket-name&gt;/model.tar.gz</pre><p>You might encounter errors such as “An error occurred (AccessDenied) when calling the PutObject operation.” To resolve this, ensure your Amazon SageMaker has the necessary permissions to upload to S3.</p><p><strong>4. Create custom python env docker image</strong></p><p>The current Amazon SageMaker Jupyter Notebook environments do not support newer versions of the Transformers library (e.g., version 4.47) required to load the Paligemma 2 model.<br>Errors you might encounter after deploying and invoking the Paligemma 2 endpoint include:</p><pre>The checkpoint you are trying to load has model type `paligemma` but Transformers does not recognize <br>this architecture. This could be because of an issue with the checkpoint, or because your version of Transformers <br>is out of date</pre><p>This error typically occurs because the environment Amazon SageMaker uses to deploy the model relies on an image with outdated Python and Transformers versions, which are incompatible with deploying the Paligemma 2 model.</p><p><strong>5. Create a custom Docker image for model deployment in AWS SageMaker.</strong></p><p><em>Dockerfile</em>:</p><pre># Base PyTorch image with CUDA support<br>FROM pytorch/pytorch:2.5.1-cuda11.8-cudnn9-runtime as base<br><br># Set Python version explicitly if needed<br>RUN apt-get update &amp;&amp; apt-get install -y python3.11 python3.11-venv python3.11-distutils &amp;&amp; \<br>    update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 &amp;&amp; \<br>    rm -rf /var/lib/apt/lists/*<br><br># Upgrade pip<br>RUN python3 -m pip install --upgrade pip<br><br># Copy requirements and install dependencies<br>COPY requirements.txt requirements.txt<br>RUN pip install --no-cache-dir -r requirements.txt<br># Copy inference code<br>COPY inference.py /opt/ml/code/<br><br># Add the `serve` script<br>COPY serve /usr/bin/serve<br>RUN chmod +x /usr/bin/serve<br><br># Set environment variables<br>ENV SAGEMAKER_PROGRAM inference.py<br>ENV PYTHONPATH=/opt/ml/code<br>EXPOSE 8080<br># Start the application<br>CMD [&quot;gunicorn&quot;, &quot;--timeout&quot;, &quot;60&quot;, &quot;-w&quot;, &quot;1&quot;, &quot;-b&quot;, &quot;0.0.0.0:8080&quot;, &quot;inference:app&quot;]</pre><p><em>requirements.txt</em>:</p><pre>boto3==1.35.76<br>flask==3.0.3<br>pillow==11.0.0<br>transformers==4.47.0<br>gunicorn==23.0.0<br>safetensors==0.4.3<br>tokenizers==0.21<br>tqdm==4.66.4<br>accelerate==1.2.0</pre><p>You should build the Docker image and upload it to Amazon Elastic Container Registry (ECR).</p><p><strong>6. Deploy model with custom environment image</strong></p><pre>from sagemaker.model import Model<br><br>model = Model(<br>    image_uri=&#39;your-ecr-stored-custom-docker-image-uri&#39;,<br>    role=role,<br>    sagemaker_session=sess,<br>)<br><br>predictor = model.deploy(<br>    initial_instance_count=1,<br>    instance_type=&#39;&lt;instance-type&gt;&#39;, #i used a ml.g4dn.2xlarge instance<br>    endpoint_name=f&quot;&lt;your-paligemma2-endpoint-name&gt;&quot;<br>)</pre><p>Note: here the sess attribute represents the sagemaker session that has a <strong>sess.default_bucket()</strong> and this is how the Model class knows which model from which bucket to load.</p><p>After executing these commands in an Amazon SageMaker notebook, your endpoint should begin provisioning. Please note that this process may take some time to complete. You can monitor its progress on this page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bOQ87UuuGyHvIt8QNveFvg.png" /></figure><p><strong>7. Test model</strong></p><p>A very basic example of how to test the model:</p><pre>import base64<br>import json<br>input_img_path = &#39;path-to-your-image&#39;<br><br># Step 1: Read the image as bytes<br>with open(input_img_path, &quot;rb&quot;) as f:<br>    input_img_image_bytes = f.read()<br><br># Step 2: Encode the bytes into a Base64 string<br>try:<br>    input_img_base64 = base64.b64encode(input_img_image_bytes).decode(&quot;utf-8&quot;)<br>    assert isinstance(input_img_base64, str), &quot;Base64 encoding did not return a string&quot;<br>except Exception as e:<br>    print(f&quot;Error during Base64 encoding: {e}&quot;)<br>    raise<br><br># We use the model to perform a text extraction from image task<br>payload = {<br>    &quot;prompt&quot;: &quot;Extract text from image&quot;,<br>    &quot;image_base64&quot;: input_img_base64<br>}<br><br>payload_json = json.dumps(payload)<br>sagemaker_runtime = boto3.client(&quot;runtime.sagemaker&quot;)<br>response = sagemaker_runtime.invoke_endpoint(<br>    EndpointName=&quot;&lt;endpoint-name&gt;&quot;,<br>    ContentType=&quot;application/json&quot;,<br>    Body=payload_json<br>)<br><br>response_body = response[&#39;Body&#39;].read().decode(&quot;utf-8&quot;)<br>print(response_body)</pre><p>That’s all!<br>Thank you for reading, and I hope you find it helpful!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=341fc02ee862" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A complete guide to implementing SSR in Angular 18: Upgrading Angular 16 SSR to Angular 18 SSR]]></title>
            <link>https://medium.com/@ifilimon26/a-complete-guide-to-implementing-ssr-in-angular-18-upgrading-angular-16-ssr-to-angular-18-ssr-6ac7eea67db1?source=rss-a21ca55181b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ac7eea67db1</guid>
            <category><![CDATA[angular-ssr]]></category>
            <category><![CDATA[angular-16]]></category>
            <category><![CDATA[angular-18]]></category>
            <dc:creator><![CDATA[Iulia Istrate]]></dc:creator>
            <pubDate>Sun, 03 Nov 2024 17:30:58 GMT</pubDate>
            <atom:updated>2026-08-21T12:03:47.336Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Complete Guide to Upgrading to Angular 18 SSR</h3><p>In this guide, we’ll walk through the complete process of implementing Server-Side Rendering (SSR) in Angular 18. If you’re currently using SSR with Angular 16 and looking to upgrade, this article will cover everything you need to know to make the transition smooth and efficient.</p><p>I’ll start this article by outlining our context for updating Angular SSR and then dive into the issues we faced, along with solutions.</p><p><strong>Context:</strong></p><p>Our application was recently updated from Angular 16 to Angular 18, which brought new challenges. Until now, we didn’t need SSR, but the update prompted us to implement it.</p><p>With Angular 18, Angular Universal is no longer an option, so we had to learn the new SSR approach using the @angular/ssr package. Since the app was upgraded from Angular 16, we’re using app.module.ts and not <a href="https://angular.dev/guide/components/importing">standalone components</a>.</p><p><strong>Key Points to Consider for SSR in Angular 18</strong></p><ul><li>Determine first if you need to implement SSR from scratch or if an implementation already exists in your application and only requires upgrading to Angular 18 standards.</li><li>Are you working on a <em>module-based application</em> or a <em>configuration-based</em> one?</li><li>Route Resolvers</li><li>Handling global objects like document, window, and localStorage</li><li>No need to use <em>domino</em> package in <em>server.ts</em> to set global objects anymore</li><li>Migrating to the new build system</li><li><em>SSG</em> (Static Site Generation) vs <em>SSR</em> (Server-Side Rendering)</li></ul><p>Here’s a walkthrough of my SSR implementation steps for Angular 18.</p><ol><li><strong>Run<em> </em>ng add @angular/ssr</strong></li></ol><p>For newer angular versions (17+), angular ssr replaced <a href="https://www.npmjs.com/package/@nguniversal/express-engine">nguniversal/express-engine</a> that was initially used in older versions with @angular/ssr.</p><p>We had to add SSR to an existing project, as the angular official <a href="https://angular.dev/guide/ssr">documentation</a> instructs us to do.</p><p>Running ng add @angular/ssr command did not generate an app.config.server.ts by itself, because the project (previously updated from angular 16) did not adapted a standalone components approach but a modular approach.</p><p>Depending on you application initial setup, ng add @angular/ssr command will update the application structure like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i8fD8IZTV5qcFIPk69OtUg.png" /><figcaption>ng add @angular/srr generated files in standalone components vs modular structure</figcaption></figure><p>Before running the ng add @angular/ssr command, I recommend deleting any existing server.ts or main.server.ts files. This helps avoid conflicts and ensures that the necessary files are generated correctly based on the current Angular version you’re using.</p><p>For Angular 18, here’s what main.server.ts should look like depending on your application structure:</p><p>For a Modular Structure:</p><pre>//main.server.ts<br>export { AppServerModule as default } from &#39;./app/app.module.server&#39;;</pre><p>For a Configuration-Based Structure:</p><pre><br>//main.server.ts<br>import { bootstrapApplication } from &#39;@angular/platform-browser&#39;;<br>import { AppComponent } from &#39;./app/app.component&#39;;<br>import { config } from &#39;./app/app.config.server&#39;;<br><br>const bootstrap = () =&gt; bootstrapApplication(AppComponent, config);<br><br>export default bootstrap;</pre><p><strong>2. Prepare server.ts file</strong></p><p>The server.ts file plays a crucial role, as it contains the Node.js code that starts your server to handle SSR. This file is generated automatically when you run the command <em>ng add @angular/ssr</em> as previously mentioned.</p><p><strong>server.ts</strong> file for a <strong><em>configuration based </em></strong><em>entry point</em> angular application:</p><pre>//server.ts, configuration based, angular 18<br><br>import { APP_BASE_HREF } from &#39;@angular/common&#39;;<br>import { CommonEngine } from &#39;@angular/ssr&#39;;<br>import express from &#39;express&#39;;<br>import { fileURLToPath } from &#39;node:url&#39;;<br>import { dirname, join, resolve } from &#39;node:path&#39;;<br>import bootstrap from &#39;./src/main.server&#39;;<br><br>// The Express app is exported so that it can be used by serverless Functions.<br>export function app(): express.Express {<br>  const server = express();<br>  const serverDistFolder = dirname(fileURLToPath(import.meta.url));<br>  const browserDistFolder = resolve(serverDistFolder, &#39;../browser&#39;);<br>  const indexHtml = join(serverDistFolder, &#39;index.server.html&#39;);<br><br>  const commonEngine = new CommonEngine();<br><br>  server.set(&#39;view engine&#39;, &#39;html&#39;);<br>  server.set(&#39;views&#39;, browserDistFolder);<br><br>  // Example Express Rest API endpoints<br>  // server.get(&#39;/api/**&#39;, (req, res) =&gt; { });<br>  // Serve static files from /browser<br>  server.get(&#39;**&#39;, express.static(browserDistFolder, {<br>    maxAge: &#39;1y&#39;,<br>    index: &#39;index.html&#39;,<br>  }));<br><br>  // All regular routes use the Angular engine<br>  server.get(&#39;**&#39;, (req, res, next) =&gt; {<br>    const { protocol, originalUrl, baseUrl, headers } = req;<br><br>    commonEngine<br>      .render({<br>        bootstrap,<br>        documentFilePath: indexHtml,<br>        url: `${protocol}://${headers.host}${originalUrl}`,<br>        publicPath: browserDistFolder,<br>        providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],<br>      })<br>      .then((html) =&gt; res.send(html))<br>      .catch((err) =&gt; next(err));<br>  });<br><br>  return server;<br>}<br><br>function run(): void {<br>  const port = process.env[&#39;PORT&#39;] || 4000;<br><br>  // Start up the Node server<br>  const server = app();<br>  server.listen(port, () =&gt; {<br>    console.log(`Node Express server listening on http://localhost:${port}`);<br>  });<br>}<br><br>run();<br></pre><p><strong>server.ts</strong> file for a <strong><em>module based</em></strong><em> entry point</em> angular application:</p><pre>//server.ts, module based, angular 18<br><br>import { APP_BASE_HREF } from &#39;@angular/common&#39;;<br>import { CommonEngine } from &#39;@angular/ssr&#39;;<br>import express from &#39;express&#39;;<br>import { fileURLToPath } from &#39;node:url&#39;;<br>import { dirname, join, resolve } from &#39;node:path&#39;;<br>import AppServerModule from &#39;./src/main.server&#39;;<br><br>// The Express app is exported so that it can be used by serverless Functions.<br>export function app(): express.Express {<br>  const server = express();<br>  const serverDistFolder = dirname(fileURLToPath(import.meta.url));<br>  const browserDistFolder = resolve(serverDistFolder, &#39;../browser&#39;);<br>  const indexHtml = join(serverDistFolder, &#39;index.server.html&#39;);<br><br>  const commonEngine = new CommonEngine();<br><br>  server.set(&#39;view engine&#39;, &#39;html&#39;);<br>  server.set(&#39;views&#39;, browserDistFolder);<br><br>  // Example Express Rest API endpoints<br>  // server.get(&#39;/api/**&#39;, (req, res) =&gt; { });<br>  // Serve static files from /browser<br>  server.get(&#39;**&#39;, express.static(browserDistFolder, {<br>    maxAge: &#39;1y&#39;<br>  }));<br><br>  // All regular routes use the Angular engine<br>  server.get(&#39;**&#39;, (req, res, next) =&gt; {<br>    const { protocol, originalUrl, baseUrl, headers } = req;<br><br>    commonEngine<br>      .render({<br>        bootstrap: AppServerModule,<br>        documentFilePath: indexHtml,<br>        url: `${protocol}://${headers.host}${originalUrl}`,<br>        publicPath: browserDistFolder,<br>        providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],<br>      })<br>      .then((html) =&gt; res.send(html))<br>      .catch((err) =&gt; next(err));<br>  });<br><br>  return server;<br>}<br><br>function run(): void {<br>  const port = process.env[&#39;PORT&#39;] || 4000;<br><br>  // Start up the Node server<br>  const server = app();<br>  server.listen(port, () =&gt; {<br>    console.log(`Node Express server listening on http://localhost:${port}`);<br>  });<br>}<br><br>run();</pre><p>The only two differences between the two server.ts files are:</p><p><em>a</em>. Imports from ./src/main.server</p><pre>//module based<br>import AppServerModule from &#39;./src/main.server&#39;;<br><br>//configuration based<br>import bootstrap from &#39;./src/main.server&#39;;</pre><p><em>b</em>. Different value assignment for the bootstrap parameter in commonEngine render.</p><pre>//module based<br>commonEngine<br>      .render({<br>        bootstrap: AppServerModule,<br>        documentFilePath: indexHtml,<br>        url: `${protocol}://${headers.host}${originalUrl}`,<br>        publicPath: browserDistFolder,<br>        providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],<br>      })<br><br>//configuration based<br>commonEngine<br>      .render({<br>        bootstrap,<br>        documentFilePath: indexHtml,<br>        url: `${protocol}://${headers.host}${originalUrl}`,<br>        publicPath: browserDistFolder,<br>        providers: [{ provide: APP_BASE_HREF, useValue: baseUrl }],<br>      })</pre><p><strong>3</strong>.<strong> Migrate to angular’s new build system: </strong><a href="https://angular.dev/tools/cli/build-system-migration#manual-migration-to-the-new-application-builder"><strong>@angular-devkit/build-angular:application</strong></a></p><p>Upgrading to Angular’s new build system is highly recommended — it’s faster and brings substantial benefits. Follow Angular’s <a href="https://angular.dev/tools/cli/build-system-migration#manual-migration-to-the-new-application-builder">documentation for migration steps</a>. You might face some warnings or errors initially, but they’re generally easy to fix. Try building in development mode with optimizations off to get clear logs.</p><p>As noted in the docs, running ng build is the only command needed to build and prepare the app for SSR. The output will be in the path specified by outputPath in angular.json. Here&#39;s the structure of the generated directory:</p><pre>/dist<br>├── prerendered-routes.json      # Contains prerendered route information<br>├── browser                      <br>│   ├── index.html<br>│   ├── index.csr.html           # Client-Side Rendered (CSR) HTML file<br>│   └── other browser files…<br>└── server                       # Server-side files for SSR<br>    ├── server.mjs<br>    ├── index.server.html        # Server-Side Rendered (SSR) HTML file<br>    └── other SSR files…</pre><p>It is important to check after running ng build that you have both index.html and index.server.html generated; if not, the build may not have been successful.<br>The prerendered-routes.json file should contain all the routes that were prerendered. Usually, setting &quot;prerender&quot;: true in angular.json triggers the prerendering of certain paths.</p><p>By default, all non-parameterized paths are prerendered. If you want only specific routes to be prerendered, you should create a routes.txt file and set its path in the architect.build.options.prerender property in angular.json:</p><pre>&quot;prerender&quot;: {<br>&quot;routesFile&quot;: &quot;/path-to-my-routes.txt-file&quot;,<br>&quot;discoverRoutes&quot;: false //by default this is set to true, so it will trigger full routes discovering<br>},</pre><p>Of course, you could also disable prerendering (or SSG) by setting prerender to false.</p><p>More information about prerendering in Angular’s documentation <a href="https://angular.dev/guide/prerendering">here</a>.</p><p>To start the Node server that enables SSR, run:</p><pre>node dist/my-project-name/server/server.mjs</pre><p><strong>4. </strong><strong>ts.config.json file</strong></p><p>When building the application, you might encounter issues at compile time because some compiler options, like emitDecoratorMetadata or experimentalDecorators, are not set to true.</p><p>If you face problems during the build process, check this file as well.</p><p><strong>5. Keep track of the files and dependencies involved in the SSR process, and ensure everything is set up correctly before building the application.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*zaM1cm0_xzJgV0LBtl6lZw.png" /><figcaption>An Overview of Files and Dependencies involved in Angular’s SSR</figcaption></figure><p>6. <strong>Route Resolvers</strong></p><p>When upgrading to Angular 18 and enabling Server-Side Rendering (SSR), you might notice an issue if your application relies on routes. Even though your web UI components load, the HTML source rendered by the server might not include data from your backend for specific routes. This happens because server-side requests are asynchronous, and SSR doesn’t wait for these requests to finish before rendering the route.</p><p>In simple terms, the server moves on to render the route before the data-fetching request completes. As a result, your page loads without the intended content.</p><p>This is where resolvers come in handy. Resolvers are functions that attach to routes and ensure that navigation to a path is delayed until all data needed to render the component’s view is loaded. They act as a “pause button,” ensuring all server requests finish before the page displays to the user.</p><p><strong>Tip</strong>: To boost performance and reduce unnecessary requests, consider adding a caching mechanism with an expiration date for your resolvers. This will allow frequently used data to be stored temporarily, reducing the need for repeated backend calls.</p><p>7. <strong>Use PLATFORM_ID for Browser and Server Checks</strong></p><p>If you’re upgrading Angular’s Server-Side Rendering (SSR) from version 16 to 18, you may encounter the notorious “window is not defined” errors. These issues typically arise due to the incorrect use of global objects like window, document, and localStorage.</p><p>In previous versions, the server.ts file relied on a package called Domino to define these global objects on the server. However, Angular 18 no longer supports Domino, and it’s no longer considered best practice to define these objects manually in server.ts.</p><p>Here’s how <strong><em>domino</em></strong> was previously used:</p><pre>//server.ts<br>const win = domino.createWindow(template);<br>global[&#39;window&#39;] = win;<br>global[&#39;localStorage&#39;] = localStorage;<br>global[&#39;document&#39;] = win.document;</pre><p>In Angular 18, the recommended approach is to leverage the PLATFORM_ID token to distinguish between the server and the browser environment. This token can be injected into your components’ constructors, allowing you to conditionally handle actions based on the environment.</p><p>For example, you can use isPlatformBrowser to ensure that global objects like window, document, and localStorage are only accessed in the browser:</p><pre>import { PLATFORM_ID } from &#39;@angular/core&#39;;<br>import { isPlatformBrowser } from &#39;@angular/common&#39;;<br><br>constructor(@Inject(PLATFORM_ID) private platformId: Object) {}<br><br>ngOnInit() {<br>  if (isPlatformBrowser(this.platformId)) {<br>    // Safe to access window, document, or localStorage here<br>  }<br>}</pre><p>Similarly, you can use isPlatformServer for tasks that should only run on the server. This is particularly useful for server-only tasks like modifying the initial HTML for SEO or handling specific rendering logic during pre-rendering.</p><pre>import { PLATFORM_ID } from &#39;@angular/core&#39;;<br>import { isPlatformServer } from &#39;@angular/common&#39;;<br><br>constructor(@Inject(PLATFORM_ID) private platformId: Object) {}<br><br>ngOnInit() {<br>  if (isPlatformServer(this.platformId)) {<br>    // Perform server-specific tasks<br>  }<br>}</pre><p>In our setup, we used isPlatformServer on the default route to ensure that essential data was ready and available when the page loaded in the browser. This helped us provide the necessary default data upfront, streamlining the user experience by making sure the content was fully prepared for display on the client side.</p><p><strong>Tip</strong>: Check out the new <a href="https://angular.dev/api/core/afterRender">afterRender</a> and <a href="https://angular.dev/api/core/afterNextRender">afterNextRender</a> hooks. These hooks can also help prevent ReferenceError issues with global objects, but it’s essential to learn how to use them effectively first.</p><h3><strong>Possible causes and solutions for errors you may encounter</strong></h3><ol><li>“ReferenceError: window is not defined” ,“ReferenceError: document is not defined”, “ReferenceError: localStorage is not defined”</li></ol><ul><li>If you encounter errors like these it often means that components in your route component tree are using global objects (window, document, localStorage) without proper platform checks. To fix this, add isPlatformBrowser checks, but only to components within routes that need to be prerendered or server-side generated—typically, these are public routes intended for indexing by search engines. Private routes generally don&#39;t need to be prerendered, as they aren’t indexed by Google.</li><li>Another cause could be packages in your application that access global objects like window, document, or localStorage. You might need to dynamically import these packages only when isPlatformBrowser(platformId) is <em>true</em>.</li></ul><p>2. empty &lt;router-outlet&gt;&lt;/router-outlet&gt;</p><p>An empty router outlet often means a component in your route’s component tree failed to prerender. To troubleshoot, go down the component tree to identify which component might be causing the issue. This can happen due to ReferenceErrors, but it might also be due to conditional rendering with *ngIf.</p><p>If a component depends on a server value to render, make sure the value is retrieved first. You may also need to transfer a server-side state to the browser to ensure the component displays correctly.</p><p>For example, we had an ngIf condition for rendering a component, but it was set to true only after default values were retrieved from the backend. In our case, we needed to make this backend call on the server platform and set a state value for the browser to read. We couldn’t get the component to display until we used Angular’s TransferState to pass the data to the browser.</p><h3>Conclusion</h3><p>Upgrading from Angular 16 to Angular 18 for Server-Side Rendering (SSR) brings several significant changes. During my deep dive into this topic, I discovered that SSR issues after an upgrade can stem from various causes. These can range from configuration errors in server.ts and missing resolvers or modules to issues within nested components.</p><p>The key takeaway? Always trace back to the root cause of the error before attempting a fix.</p><h3>References</h3><ul><li><a href="https://angular.dev/guide/ssr">https://angular.dev/guide/ssr</a></li><li><a href="https://angular.dev/guide/components/importing">https://angular.dev/guide/components/importing</a></li><li><a href="https://angular.dev/tools/cli/build-system-migration#manual-migration-to-the-new-application-builder">https://angular.dev/tools/cli/build-system-migration#manual-migration-to-the-new-application-builder</a></li><li><a href="https://angular.dev/api/core/afterRender">https://angular.dev/api/core/afterRender</a></li><li><a href="https://angular.dev/api/core/afterNextRender">https://angular.dev/api/core/afterNextRender</a></li><li><a href="https://angular.dev/api/common/isPlatformBrowser">https://angular.dev/api/common/isPlatformBrowser</a></li><li><a href="https://angular.dev/api/common/isPlatformServer">https://angular.dev/api/common/isPlatformServer</a></li></ul><h4>You can follow me on my social media:</h4><ul><li>For AI Consulting/AI Adoption/AI Trainer contact me on my linkedin account 😉.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ac7eea67db1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>