<?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 Madhur Lalit on Medium]]></title>
        <description><![CDATA[Stories by Madhur Lalit on Medium]]></description>
        <link>https://medium.com/@madhur.lalit2409?source=rss-8fe1e0bf522b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Q5V8XteSlUokZIFP2oKsTg.jpeg</url>
            <title>Stories by Madhur Lalit on Medium</title>
            <link>https://medium.com/@madhur.lalit2409?source=rss-8fe1e0bf522b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 06:12:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@madhur.lalit2409/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[Every App Is Shipping an AI Assistant. Nobody Has an Ad Format for It.]]></title>
            <link>https://medium.com/@madhur.lalit2409/every-app-is-shipping-an-ai-assistant-nobody-has-an-ad-format-for-it-7e762bba0ee8?source=rss-8fe1e0bf522b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e762bba0ee8</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[advertising]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[adtech]]></category>
            <dc:creator><![CDATA[Madhur Lalit]]></dc:creator>
            <pubDate>Sat, 18 Jul 2026 20:06:30 GMT</pubDate>
            <atom:updated>2026-07-19T05:51:18.636Z</atom:updated>
            <content:encoded><![CDATA[<h3>I built the first open programmatic ad format for in-app AI surfaces on OpenRTB, in an Android SDK. Here’s the design, the wire protocol, and the trust rules that make or break it.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pF0d3wzVjHmI4p5KYdLmXQ.png" /></figure><p>There’s a $100M-a-year ad business running inside ChatGPT right now, and the entire rest of the app ecosystem every travel app, fintech app, and commerce app that shipped an AI assistant in the last two years cannot buy or sell a single impression like it.</p><p>Think about how strange that is. OpenAI turned on ads in February 2026 and reportedly hit ~$100M annualized almost immediately, at CPMs reported around $60 several multiples of what premium mobile native inventory clears. The demand is real, the surface is proven, and the user-experience pattern (a visually distinct sponsored card, rendered <em>below</em> the answer, never inside it) is settled enough that nobody serious argues about it anymore.</p><p>But that business exists in exactly one place: inside OpenAI’s walls. Meanwhile, the fastest-growing surface in every consumer app is a chat thread with an assistant in it and if you’re the publisher of that app, your monetization options for that surface are: nothing.</p><p>There is no “AdMob for AI surfaces.” No SSP sells assistant inventory. No DSP can target it. OpenRTB doesn’t even have a way to <em>say</em> “this impression renders inside a conversation.”</p><p>That’s not a product gap. That’s a format gap. And format gaps are where ad tech eras begin.</p><h3>The two proofs we already have</h3><p>Before designing anything, it’s worth being honest about what the market has already demonstrated, because both lessons are load-bearing.</p><p><strong>Proof one</strong>: The surface monetizes, spectacularly. ChatGPT’s sponsored cards validated that users tolerate and advertisers will pay a large premium for commercial messages adjacent to AI answers. The intent density of a conversation (“weekend stay in Bengaluru under ₹4,000”) makes a feed impression look like a billboard on an empty highway.</p><p><strong>Proof two</strong>: Trust is the binding constraint, not demand. Perplexity, the other obvious candidate walked away from advertising entirely, citing exactly this: the moment users suspect the <em>answer</em> is for sale, they doubt everything. That’s the whole game. An ad format for conversational surfaces that doesn’t solve trust <em>structurally</em> and not with policy documents, but with architecture will poison its own inventory.</p><p>And one more thing happened in January 2026 that most people read wrong: IAB Tech Lab published its Agentic Advertising roadmap (AAMP) MCP and A2A protocols, buyer and seller agents, machine-speed transaction rails on top of OpenRTB and AdCOM. Everyone framed it as “AI agents will buy media.” Sure. But read what’s <em>not</em> in it: AAMP standardizes how agents transact. It says nothing about what an ad rendered into a conversational surface <em>is </em>its assets, its disclosure contract, its interaction model. The rails got standardized. The format layer is unclaimed. I decided to claim it.</p><h3>Introducing the Conversational Sponsored Suggestion</h3><p>I build ApexAd , an open, full-stack programmatic ad system: an Android SDK (OpenRTB 2.6, VAST 4.0, Native 1.2, TCF/GPP), an ad server with a Go auction engine, and a demand platform with a self-serve DSP. It already had one unusual format: the Intent-to-Action Native Card , a standard Native 1.2 creative that can carry an optional, executable action (like “Save to Google Wallet”) instead of a mere click.</p><p>The Conversational Sponsored Suggestion is the next move, and its core design decision will annoy some people, which is usually a good sign:</p><p><strong>It is not a new media type. It’s one field.</strong></p><pre>&quot;imp&quot;: [{<br>  &quot;native&quot;: { &quot;request&quot;: &quot;...&quot;, &quot;ver&quot;: &quot;1.2&quot; },<br>  &quot;ext&quot;: {<br>    &quot;apex&quot;: {<br>      &quot;surface&quot;: &quot;assistant&quot;,<br>      &quot;intent&quot;: {<br>        &quot;taxonomy&quot;: &quot;apex-commerce-1&quot;,<br>        &quot;category&quot;: &quot;travel.hotel&quot;,<br>        &quot;journey_stage&quot;: &quot;ready_to_act&quot;<br>      },<br>      &quot;actions_supported&quot;: [&quot;save_to_wallet&quot;]<br>    }<br>  }<br>}]</pre><p>A conversational placement is ordinary Native 1.2 inventory that <em>declares its surface</em>. Demand that understands the declaration can price it (assistant impressions should clear far above feed native —the ChatGPT numbers say 3–5×) and copy-fit for it. Demand that doesn’t understand it bids like it’s plain native, and the SDK still renders a correct, disclosed card. No new media type, no adapter rewrite, no chicken-and-egg.</p><p>This is the adoption lesson ad tech keeps having to relearn: formats win on the cheapness of their on-ramp. VAST won because it was XML everyone could emit. Header bidding won because it didn’t ask exchanges for permission. A conversational format that demanded a new OpenRTB object would die in committee. One ext field can ship this quarter.</p><p>On the render side, the SDK re-flows the same assets every DSP already produces like title, image, icon, body, CTA into a compact card contract: title clamped to 60 characters, body to 90, hero image demoted to thumbnail, disclosure header mandatory. The publisher renders it <em>between</em> chat messages, visually distinct, in their own UI. One creative serves the feed and the assistant.</p><p>And because it inherits the Intent-to-Action contract, the bid can come back with an <em>executable</em> action bid.ext.apex.action so the CTA isn&#39;t a link to a landing page, it&#39;s &quot;Save to Google Wallet,&quot; done in two taps, with the ordinary native click as a guaranteed fallback. On a surface defined by intent, the natural pricing model isn&#39;t CPM forever. It&#39;s completed actions.</p><h3>The five trust rules enforced in code, not in policy docs</h3><p>This is the part I’d most like the industry to argue with, because Perplexity’s exit tells us this is where conversational advertising lives or dies. Every rule below is structural , the system <em>cannot</em> violate it, rather than <em>promises</em> not to:</p><p>1. Answer independence, by construction. The SDK renders the card between messages. There is no API through which ad content can enter the assistant’s answer text. The model’s output and the ad slot never touch.</p><p>2. No conversation data leaves the device. Ever. The only targeting signal is a publisher-declared, structured taxonomy : travel.hotel, ready_to_act. The SDK does not read chat text, and its API is deliberately shaped so you <em>can&#39;t</em> pass it: the intent context takes enum-like categories, not strings of user content. Consent-gated under TCF Purpose 4 like every other personalization signal in the stack.</p><p>3. Always disclosed, and the user can see why. The disclosure label is non-nullable in the render contract. The relevance chip “Relevant to your hotel search” shows the user the <em>exact</em> signal that was used, because the signal is coarse enough to show. Try doing that with a behavioral profile.</p><p>4. Renderable or silent. The demand platform refuses to bid a creative into an assistant slot unless its native markup carries a parseable title asset. No HTML fallback ever degrades the surface. A chat thread with a broken banner in it is how you burn a publisher’s trust in one impression.</p><p>5. Compact by contract. The 60/90-character clamps live in the SDK, not in a spec PDF that demand may or may not read. An ad that shouts in a conversation is an ad that ends the conversation.</p><p>Notice what these rules add up to: the trust architecture <em>is</em> the moat. Anyone can add a surface field. Building the consent-gated intent pipeline, the action execution layer, and the render guarantees behind it is the actual work.</p><h3>Where this goes</h3><p>The roadmap writes itself, and parts of it should scare the incumbents:</p><p>Action manifests. Generalize the single wallet action into a signed manifest of typed actions —ADD_TO_CART, BOOK, SUBSCRIBE_TRIAL — that the <em>app&#39;s own agent</em> can execute on the user&#39;s confirmed instruction. The billable event becomes ACTION_COMPLETE, riding an idempotent billing path. That&#39;s genuinely CPA-priced brand demand on the surface where intent is most legible.</p><p>An AAMP seller agent. Expose conversational inventory through an MCP seller-agent endpoint, per the IAB reference architecture, and this becomes the first SSP-shaped thing agentic buyers can actually transact against.</p><p>Standardization. If this pattern is right, surface belongs in OpenRTB proper, and the render contract belongs next to Native 1.2 as a companion spec. I&#39;d rather the industry fight about my field names than have five proprietary variants by 2027.</p><h3>The questions I actually want to argue about</h3><p>I published all of this —SDK, ad server, demand platform, tests, demo — because a format proposed in a blog post is an opinion, and a format running end-to-end is an argument. But there are open questions I am still looking for answers to:</p><ul><li>Who owns the intent taxonomy? Publisher-declared categories keep privacy clean, but a fragmented taxonomy kills buy-side scale. Does this need an IAB Content-Taxonomy-style shared standard on day one?</li><li>Is per-conversation frequency capping a new primitive? A user who sees two ads in one chat thread has a different experience than one who sees two ads in a feed session. I suspect the unit of capping here is the <em>conversation</em>, not the day.</li><li>Should assistant inventory be auctioned at all, or is it deal-first? Trust-sensitive surfaces historically launch with curated PMPs before open auction. The ChatGPT approach is effectively a walled deal. What’s the right sequence for the open version?</li><li>What does viewability even mean in a chat thread? MRC standards assume spatial viewports. A message that scrolls into view during an active conversation is arguably the highest-attention impression in mobile.</li></ul><p>The assistant surface is the first genuinely new inventory class since mobile itself and this time we get to decide <em>before</em> the race to the bottom whether trust is a feature of the format or a casualty of it.</p><p>The spec is open. The code runs. Lets discuss the shortcomings and counter proposals.</p><p><em>ApexAd is an open full-stack programmatic stack — Android SDK, Go auction ad server, and self-serve demand platform. The Conversational Sponsored Suggestion format, the Intent-to-Action cards it builds on, and everything described here is on GitHub: </em><a href="https://github.com/Madroid2/apex-ad-sdk-android"><em>apex-ad-sdk-android</em></a><em>. If you’re building on assistant surfaces —or buying them —I’d genuinely like to compare notes.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e762bba0ee8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Wallet as an Ad Outcome: Skipping the Cold Start Problem]]></title>
            <link>https://medium.com/@madhur.lalit2409/google-wallet-as-an-ad-outcome-skipping-the-cold-start-problem-f1a5b9dc5d96?source=rss-8fe1e0bf522b------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1a5b9dc5d96</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[adtech]]></category>
            <category><![CDATA[advertising]]></category>
            <category><![CDATA[android-development]]></category>
            <category><![CDATA[android-sdk]]></category>
            <dc:creator><![CDATA[Madhur Lalit]]></dc:creator>
            <pubDate>Tue, 16 Jun 2026 23:30:46 GMT</pubDate>
            <atom:updated>2026-06-16T23:30:46.149Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GzuYEeyRPktv6Rxf3XEAYg.png" /></figure><p><strong>An architecture note on shipping Google Wallet pass delivery without creating a new placement type</strong></p><p>When I set out to add Google Wallet pass delivery to ApexAds, the obvious approach was also the wrong one. Build a new ad format called WalletAd, give it its own placement type, and let publishers request it directly.</p><p>That approach would have shipped. It also would have died on arrival.</p><h4>The problem nobody mentions when they pitch a new ad format</h4><p>A new placement type is only as good as the demand behind it. No DSP wakes up with budget allocated to an opaque wallet placement they have never seen before. Fill rate for a brand new, unproven format hovers near zero, because the entire programmatic ecosystem (the bidders, the creative pipelines, the budget allocation logic) is built around a small set of well understood formats: banner, interstitial, native, video.</p><p>So the real engineering question was not how to render a Google Wallet pass. It was how to get demand side platforms to bid on something they have never had to think about.</p><h4>The fix: make it a feature, not a format</h4><p>Instead of a new placement type, I implemented Wallet as an optional capability layer sitting on top of formats that already have deep, liquid demand, specifically Interstitial and MRECT Banner. No new placement type. No new auction category. No DSP integration work required to participate.</p><p>Here is the mechanism. When the SDK’s wallet module is installed, it signals imp.ext.wallet_supported = true inside the existing OpenRTB bid request, the same request, the same auction, the same demand pool that already bids on interstitials and banners every day. If a DSP wants to respond with a wallet offer, it can attach a signed pass JWT inside ext.wallet on its normal bid response. If it does not, nothing changes. The ad renders exactly as a standard interstitial or banner always has.</p><p>kotlin</p><pre>// Application.onCreate() — one line activates wallet CTAs across all eligible ads<br>ApexAds.init(this, config)<br>WalletAdExtension.install()</pre><p>That is the entire integration surface for a publisher. No changes to existing InterstitialAd or BannerAd code. The wallet CTA, a Save to Google Wallet panel, appears automatically when a bid response happens to carry the ext.wallet block, and disappears automatically when it does not.</p><h4>What happens end to end</h4><pre>WalletAdExtension.install() → SDK registers WalletDelegate</pre><pre>Ad load → bid request includes ext.wallet_supported=true<br>        → exchange returns BidResponse with ext.wallet { pass_jwt, cta_text }<br>        → SDK renders the normal ad PLUS a wallet CTA panel</pre><pre>User taps CTA → WalletPassManager.savePassesJwt()<br>             → Google Wallet confirms save<br>             → onWalletPassSaved() fires to the publisher<br>             → save_tracking_url pixel fires for attribution</pre><p>Two things matter about that flow. First, the wallet outcome is additive. The underlying ad still renders and still counts as a normal impression even if the user ignores the CTA entirely. Second, the dependency on Google Play Services Wallet (play-services-wallet) is scoped only to the optional sdk-wallet module. A publisher who never calls WalletAdExtension.install() never pulls that dependency into their app at all. Zero leakage, zero cost for publishers who do not want it.</p><h4>Why this is genuinely useful for engagement, not just a gimmick</h4><p>The advertiser case for this is straightforward once you separate it from another button on an ad. A loyalty card, a coupon, or an event ticket saved to a user’s Google Wallet is something that persists on their device after the ad impression is gone. A standard interstitial’s influence ends the moment the user dismisses it. A saved wallet pass can resurface at checkout, near a store location, near an expiry date, entirely outside the ad experience that originally delivered it.</p><p>That changes what an ad impression can accomplish. Instead of a single moment of attention, it becomes a small persistent object on the user’s phone that the user chose to keep. The action is also opt in and explicit. Tapping save is a clear, deliberate signal of interest, which is a meaningfully stronger engagement signal than a passive impression or even a click through.</p><p>For publishers, the advantage is that this comes for free on inventory they already monetize. No new SKU to sell, no new placement to explain to a sales team, no separate integration. It rides on the interstitial and banner inventory that already exists.</p><p>I want to be careful here and not invent numbers I do not have. I have not run this in production against real advertiser demand, so I am not going to claim a specific lift percentage. Anyone who tells you a precise engagement uplift for a feature that has not shipped to real traffic is making it up. What I can say with confidence is the logical case above. Persistence beyond the impression, explicit opt in intent, and zero new integration cost for the publisher are all real structural advantages, independent of what the eventual numbers turn out to be.</p><h4>What I still need to solve before this is more than a strong prototype</h4><p>I would rather be precise about what is unfinished than oversell a demo as production ready. A few real gaps remain.</p><p><strong>The extension is not a standard yet.</strong> ext.wallet is a non standard OpenRTB extension I defined myself. It works because my own mock exchange and SDK agree on the contract, but a real DSP has no reason to populate that field unless there is an actual standard, or unless I integrate directly with specific demand partners one at a time. Getting from works in my demo exchange to DSPs actually populate this in the wild is a business and standards problem as much as an engineering one.</p><p><strong>No production fill rate data exists.</strong> Everything above about engagement value is a reasoned hypothesis, not a measured result. The honest next step is a real pilot with actual advertiser demand, not just my own mock auction.</p><p><strong>Pass lifecycle after the save is unhandled.</strong> Once a user saves a pass, what happens when the underlying offer expires, or the advertiser wants to push an update to a pass that is already on someone’s device? Google’s Wallet API supports pass updates, but I have not built that update path yet. Today it is save once and done.</p><p><strong>Attribution stops at the save event.</strong> I track onWalletPassSaved and fire a tracking pixel at that moment, but I do not yet close the loop on what happens after, whether the pass was actually redeemed in store or used at all. Without redemption level attribution, advertisers are buying a save event, not a verified outcome.</p><p><strong>No iOS equivalent.</strong> This is an Android only implementation tied to Google Wallet. An Apple Wallet counterpart would need its own pass signing and save flow, and right now that does not exist in this SDK.</p><p><strong>Device and Play Services availability is not fully guarded.</strong> Not every Android device has Google Play Services, and the SDK needs to degrade gracefully, ad renders normally, CTA simply does not appear, rather than risk any failure path. That fallback exists conceptually in the design but deserves more explicit device capability testing than it has had so far.</p><p>None of these are reasons the architecture is wrong. They are the actual distance between an industry first feature in a well designed SDK and something a real ad exchange would deploy to production traffic. I would rather name that distance honestly than imply this is further along than it is.</p><h4>The takeaway</h4><p>The interesting decision here was not the Google Wallet integration itself. It was recognizing that a new capability does not need a new ad format to exist. If you can express a new outcome as an extension on top of formats that already have deep demand, you skip the cold start fill rate problem entirely. That is a pattern I would apply again before reaching for let’s invent a new placement type the next time a new ad outcome needs supporting.</p><p><em>Code and full architecture diagrams for ApexAds, including the wallet module, are available on </em><a href="https://github.com/Madroid2/apex-ad-sdk-android"><em>GitHub</em></a><em>.</em></p><p></p><p></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1a5b9dc5d96" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic Engineering in Ad Tech: From Creative Review Loop to DSP Creative Ops for Apex Ads]]></title>
            <link>https://medium.com/@madhur.lalit2409/agentic-engineering-in-ad-tech-designing-a-creative-review-loop-for-apex-ads-77f9627a34b8?source=rss-8fe1e0bf522b------2</link>
            <guid isPermaLink="false">https://medium.com/p/77f9627a34b8</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[adtech]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Madhur Lalit]]></dc:creator>
            <pubDate>Sat, 06 Jun 2026 00:16:55 GMT</pubDate>
            <atom:updated>2026-07-24T13:47:09.115Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*13UHcWTY5pX53i9Ezzto9A.jpeg" /></figure><blockquote><em>Update note, July 2026: This article originally described the Apex Creative Review Agent as a bounded control-plane loop. The core idea still holds, but Apex Demand has since grown into a larger self-serve creative operations layer: crawler-led creative generation, policy-versioned review, admin queues, replay and evals, bidder eligibility, wallet attribution, Smadex-facing partner endpoints, and Axon-lite VAST video assembly.</em></blockquote><p>Ad tech is full of high-speed systems. An SDK has to be lightweight, an ad server has to be fast, and a demand platform has to make decisions without creating operational chaos.</p><p>When I explored agentic engineering inside my Apex Ads stack, the goal was not to add AI everywhere. The goal was to find the specific workflow where autonomous reasoning improves the product without weakening the parts of the system that must remain deterministic.</p><p>That workflow was creative review.</p><p>But after building more of the Apex Demand Platform, the lesson became broader: creative review is not an isolated feature. It becomes more valuable when it sits beside creative generation, landing-page understanding, brand verification, admin operations, and bidder eligibility.</p><p>The product is no longer just a review agent. It is a creative operations control plane for self-serve demand.</p><h3>The Original Problem</h3><p>Apex Ads has three major components: the Apex Android SDK, the Apex Ad Server, and the Apex Demand Platform. The SDK renders ads and tracks events. The ad server handles delivery and auction logic. The demand platform manages advertisers, campaigns, creatives, budgets, review, and bidding.</p><p>The demand-side workflow creates a natural bottleneck. Self-serve advertisers want to launch quickly. AI can generate more creatives. But every creative still needs to be checked before it becomes eligible for serving.</p><p>That creates a familiar ad-tech tension:</p><ul><li>Manual review does not scale well.</li><li>Unsafe creatives damage publisher trust.</li><li>Low-quality creatives reduce marketplace quality.</li><li>Review delays slow campaign activation.</li><li>Policy decisions need to be traceable.</li><li>Real-time ad serving cannot wait for complex reasoning.</li></ul><p>This is not just a moderation problem. It is a systems design problem.</p><p>The platform needs judgment, but the delivery path needs speed.</p><h3>The Design Constraint</h3><p>The core question became:</p><p>How can Apex review creatives faster and more consistently while keeping ad delivery deterministic, low-cost, and auditable?</p><p>That framing matters. The objective was not to replace the ad server with an AI system, put intelligence inside the SDK, or call a model during every impression.</p><p>The objective was to create a bounded workflow where the demand platform can reason before a creative enters the serving pipeline.</p><p>The control plane can be thoughtful. The auction path has to be boring.</p><h3>What I Rejected</h3><p>I rejected putting an agent inside the SDK. The SDK should request, render, and track ads. It should not make policy decisions about advertiser creatives. That would increase SDK size, create inconsistent device-side behavior, make review harder to centralize, and weaken auditability.</p><p>I also rejected putting an agent inside the auction path. Ad auctions are latency-sensitive. Calling a model during a bid request would introduce cost, failure modes, and response-time variance.</p><p>I also rejected creative generation by itself as the main differentiator. Generation is useful, but incomplete. If a platform generates more creatives without improving review, it simply moves the bottleneck downstream.</p><p>The more useful design is a complete loop: understand the landing page, generate creative assets, review them, route uncertain cases to operators, approve only what is safe, and serve only approved creatives from the bidder cache.</p><h3>The Updated Apex Demand Flow</h3><p>The current Apex Demand flow looks like this:</p><ul><li>Landing page URL and advertiser brief.</li><li>Crawler extracts product context, images, metadata, JSON-LD, Open Graph, Twitter card data, and evidence.</li><li>If the page is blocked or incomplete, OpenAI web discovery can search for the same product from public sources.</li><li>Apex validates product images and rejects logos, sprites, placeholders, infrastructure images, and weak candidates.</li><li>Creative generation creates display, native, interstitial, and VAST-ready variants.</li><li>The review agent evaluates copy, landing URL, brand/domain fit, crawler confidence, policy rules, format compatibility, and evidence.</li><li>Clear safe creatives can be approved. Clear violations are rejected. Ambiguous cases go to admin review.</li><li>Only approved creatives enter bidder eligibility.</li><li>The SDK and ad server keep operating deterministically.</li></ul><p>This is agentic engineering as workflow design, not AI decoration.</p><h3>Crawler First, Generator Second</h3><p>One of the most important changes was making the crawler a first-class part of the creative system.</p><p>A self-serve creative platform cannot simply trust the advertiser’s short prompt. If someone pastes a product URL, the system needs to understand what is actually on that page. The Koenic fan test made this obvious: if the crawler selects the wrong image or mistakes infrastructure branding for the product, the generated ad can look polished but still be wrong.</p><p>That is dangerous because a bad creative can be visually convincing.</p><p>So Apex now treats landing-page evidence as a production input. It stores crawler context, image candidates, rejected-image reasons, evidence, confidence, and findings. The review agent can use that context to decide whether a creative is ready or whether a human should verify the product, image, and landing-page alignment.</p><p>The key rule is simple: do not guess when evidence is weak.</p><p>If the crawler cannot confidently identify the product, the system should escalate or use web discovery. It should not silently fall back to dummy art in production.</p><h3>The Review Agent as a Gate</h3><p>The Creative Review Agent still has three outcomes:</p><ul><li>AUTO_APPROVE</li><li>AUTO_REJECT</li><li>NEEDS_MANUAL_REVIEW</li></ul><p>The agent evaluates creative copy, landing-page signals, ad format, policy rules, campaign context, crawler confidence, brand/domain alignment, and serving details.</p><p>The most important implementation detail is that deterministic checks run first. Model-backed review can be enabled for nuance, but deterministic guardrails still constrain the result. If a deterministic rule finds a high-risk issue, the model cannot casually override it. If the model is uncertain, the creative goes to manual review.</p><p>Every review should leave an audit trail: policy version, outcome, confidence, rationale, findings, and review mode.</p><p>This matters because ad-tech policy is not only about making a decision. It is about explaining why the decision was made and being able to replay it later.</p><h3>Why Admin Queues Matter</h3><p>A self-serve advertiser should not be able to generate creatives and directly push them live without review. That would undermine publisher trust and create marketplace risk.</p><p>In Apex, advertiser generation and admin approval are separate responsibilities. Advertisers can generate drafts and submit them. Admins or review operators approve, reject, replay, or inspect the agent’s decision.</p><p>This creates a better operating model:</p><ul><li>Advertisers move quickly.</li><li>The agent handles obvious cases.</li><li>Humans handle ambiguity.</li><li>The bidder serves only approved creatives.</li><li>The platform keeps a record of decisions.</li></ul><p>That is the real value of agentic review. It is not replacing human judgment. It is reducing the number of cases that require human judgment while making the remaining cases easier to act on.</p><h3>Keeping the Auction Path Deterministic</h3><p>The runtime serving path stays clean:</p><p>SDK -&gt; Ad Server -&gt; Demand Platform Bid Endpoint -&gt; Approved Creative Cache -&gt; Bid Response</p><p>No model call happens during impression delivery.</p><p>That separation of concerns is important. The demand platform owns judgment and creative state. The ad server owns speed and auction logic. The SDK owns rendering and tracking.</p><p>Only approved creatives are eligible for bids. The bidder can return OpenRTB-compatible display, native, interstitial, and VAST responses from cached creative assets. This gives the system room to add intelligence before serving without adding latency during serving.</p><h3>VAST Video Without Blowing Up AI Cost</h3><p>Video is where a lot of ad-tech money moves, but full AI video generation can be expensive and slow. For routine self-serve VAST creation, Apex uses an Axon-lite approach instead.</p><p>The system assembles a short MP4 from available product imagery, brand palette, copy, and CTA using local ffmpeg. If the advertiser provides a finished MP4, Apex can wrap it in VAST with tracking. If the landing page exposes a usable video source, the crawler can help identify it. Otherwise, Apex can produce motion from static assets without calling a paid AI video model for every variant.</p><p>That keeps the economics practical.</p><p>The VAST unit still goes through normal review. A video creative should not enter auctions unless it has a completed hosted MP4 and valid VAST markup. Drafts and failed renders should stay out of bidder eligibility.</p><h3>Why This Matters for a DSP</h3><p>For a DSP, the value is not that Apex uses AI. The value is that Apex reduces creative activation friction while keeping serving deterministic and auditable.</p><p>A DSP needs more advertiser throughput, more compliant creatives, faster approvals, better landing-page understanding, and fewer bad assets entering auctions. It also needs controls that scale: policy versions, eval packs, replay, admin overrides, rate limits, and reporting.</p><p>This is especially useful for mobile demand because creative quality, landing-page fit, ad format compatibility, and event attribution all influence performance.</p><p>Apex now connects the creative workflow to the bidding workflow. That is the important shift.</p><p>A creative is not just generated. It is crawled, assembled, reviewed, audited, approved, cached, bid, rendered, tracked, and attributed.</p><h3>Cost and Safety Guardrails</h3><p>The design keeps model spend bounded:</p><ul><li>Creative generation happens during setup, not during auctions.</li><li>One hero image can be reused across multiple ad sizes.</li><li>Local mock mode exists only for development and demos.</li><li>Production mode should fail closed instead of serving dummy visuals.</li><li>Text-model providers can be configured through environment settings, but image generation and hosted web product discovery remain pinned to OpenAI where those capabilities are required.</li><li>VAST assembly uses local rendering before considering paid AI video generation.</li><li>Review can combine deterministic checks, model-backed reasoning, and human escalation.</li></ul><p>This layered model is what makes the system practical.</p><h3>The Product Differentiator</h3><p>The differentiator is no longer only a creative review agent.</p><p>The stronger differentiator is this:</p><p>Apex uses an agentic creative operations control plane to turn advertiser intent and landing-page evidence into reviewed, auditable, bidder-eligible creatives without putting AI in the SDK or auction path.</p><p>That is the architectural line I would keep drawing.</p><p>AI belongs where the workflow needs judgment, memory, evidence, and escalation. It does not belong everywhere.</p><h3>Final Thought</h3><p>Agentic engineering is most valuable when it is constrained.</p><p>For Apex Ads, the first useful place was creative review. As the platform matured, that review loop became part of a larger demand-side system: crawler-led creative generation, admin review operations, VAST assembly, OpenRTB bidding, wallet attribution, and DSP-facing integration.</p><p>The lesson stayed the same, but the product became larger.</p><p>Not the SDK. Not the auction engine. Not the impression path.</p><p>The right place for intelligence is the demand platform control plane, before the creative reaches the marketplace.</p><p>That is where AI can make the system more useful without making ad delivery slower, more expensive, or less predictable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77f9627a34b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Refactored a Production Android SDK to MVVM Without Breaking a Single Publisher Integration]]></title>
            <link>https://medium.com/@madhur.lalit2409/how-i-refactored-a-production-android-sdk-to-mvvm-without-breaking-a-single-publisher-integration-01fa6ad8baf8?source=rss-8fe1e0bf522b------2</link>
            <guid isPermaLink="false">https://medium.com/p/01fa6ad8baf8</guid>
            <category><![CDATA[mobile-engineering]]></category>
            <category><![CDATA[mvvm]]></category>
            <category><![CDATA[sdk-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Madhur Lalit]]></dc:creator>
            <pubDate>Sat, 02 May 2026 23:35:08 GMT</pubDate>
            <atom:updated>2026-05-02T23:35:08.324Z</atom:updated>
            <content:encoded><![CDATA[<p><em>2,200+ files. 37,000 net lines deleted. Zero publisher migrations required.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9qcrPEMhaOc1w1tP5imt8g.png" /></figure><p>Every engineer has refactored code. Almost none have done it under this constraint: the codebase you’re changing is running inside hundreds of apps you don’t control, and a regression means someone else’s production app crashes at a time you’ll never know about, in a way you can’t reproduce.</p><p>That is the reality of SDK engineering. And it is why the MVVM refactor I led on a production Android ad SDK is the hardest architectural work I have done in 11 years of Android development.</p><h4>What we were working with</h4><p>The SDK before the refactor had no formal architecture. It was a mixture of accumulated design patterns ad loading, state management, event dispatching, and rendering concerns all tangled together in the same classes. There was no separation between what the SDK knew about an ad’s state and how it communicated that state to publishers. The classes that handled network responses were the same classes that fired publisher callbacks. Business logic lived next to UI logic. Tests were sparse because testing any single concern required constructing most of the system.</p><p>The codebase was not bad because engineers were careless. It was the natural result of years of incremental feature additions on top of a foundation that was never designed for the complexity it eventually carried.</p><p>The refactor was not optional. The architecture had become a ceiling on what the team could ship safely.</p><h4>The constraint that changed everything</h4><p>Internal app refactors have a safety net: you control the deployment. You can break something, push a fix, and most users will never know. SDK engineers don’t have that safety net.</p><p>The SDK was integrated into hundreds of publisher apps worldwide. Every public class, every public method, every callback interface was a contract. If a class moved packages, that was a compile error in a publisher’s app. If a method signature changed, that was a build failure at their worst possible moment. If a callback stopped firing in a scenario we hadn’t tested, that was a revenue-impacting bug in their production release one we might only hear about days later through a support ticket.</p><p>The constraint was absolute: the refactor had to be invisible to every existing publisher integration. Not mostly invisible. Completely invisible.</p><h4>The architectural decision: a new internal layer, a frozen external surface</h4><p>The solution was to introduce a dedicated MVVM foundation module an entirely new internal package containing the new architecture, completely hidden behind the existing public API surface.</p><p>This module introduced three core abstractions:</p><p><strong>Base ViewModel </strong>the parent ViewModel for every ad format. Because an SDK has no Activity or Fragment to provide Android&#39;s standard ViewModelStore, we couldn&#39;t use ViewModelProvider. Instead, we used a delegate pattern: the ViewModel&#39;s lifecycle was scoped to the ad unit object that the publisher already held a reference to. When the publisher&#39;s ad object was destroyed, the ViewModel was destroyed with it. No custom lifecycle owner required the existing SDK object graph provided the scope naturally.</p><p><strong>Repository layer</strong> the data abstraction separating network operations, cache, and configuration from the ViewModel. Previously, ad loading logic reached directly into network and storage layers from wherever it needed them. The Repository became the single point of truth for ad data, independently testable and independently replaceable.</p><p><strong>Ad state machine </strong>a sealed class representing every stage of an ad’s lifecycle: idle, loading, loaded, rendering, shown, clicked, expired, failed. Previously, ad state was tracked through scattered boolean flags and implicit ordering of callback calls. The state machine made every possible state explicit, exhaustive, and auditable. Invalid state transitions became impossible by construction.</p><h4>The bridge: mapping new state to old callbacks</h4><p>The hardest engineering problem was not building the new MVVM layer. It was wiring it to the existing public API without exposing any of the new structure to publishers.</p><p>The solution was an internal listener interface and an event notification bridge per ad format. Every ViewModel emitted state changes through this internal interface. A thin facade layer the existing public ad objects that publishers already held references to implemented this interface and translated each state change into the appropriate existing public callback.</p><p>From a publisher’s perspective, nothing changed. onAdLoaded() still fired when it always fired. onAdFailedToLoad() still received the same error codes. The objects they had instantiated still behaved identically. Underneath, every one of those callbacks was now driven by a clean state machine rather than imperative code scattered across a God class.</p><p>The facade pattern was the architectural keystone. It was also the most painstaking part of the refactor every existing callback path had to be mapped, tested, and verified to fire under exactly the same conditions as before.</p><h4>Why video was the hardest format</h4><p>Every ad format received its own ViewModel banner, interstitial, rewarded, and native each had accompanying repository and test classes. But video required the most work by a significant margin.</p><p>VAST video ads carry state that no other format has. The skip button appears after a configurable delay that can be overridden by remote config. Companion Ads must overlay the video player at specific timestamps. Quartile tracking events 25%, 50%, 75%, completion must fire exactly once per viewing, survive configuration changes, and not double-fire if the video is paused and resumed. The native video player emits state through a listener interface that doesn’t map cleanly to a ViewModel’s event model.</p><p>The video ViewModel introduced a VAST state validator a utility that enforced valid state transitions and ensured the state machine couldn’t enter invalid combinations. Skip button visibility became a discrete state in the ad state machine rather than a timer firing a direct UI call. Companion Ad overlay timing was decoupled from the video player listener and driven instead by position observations flowing through the ViewModel. Every quartile event became an idempotent state transition rather than an imperative callback call so replaying state, surviving configuration changes, and testing exhaustively all became straightforward.</p><h4>The result in numbers</h4><p>The refactor shipped across multiple SDK versions. When the dust settled:</p><p><strong>2,200+ files changed.</strong> This was not a localised improvement it touched every module, every format, every test.</p><p><strong>37,000 net lines deleted.</strong> More code was removed than added. The new architecture was not just cleaner it was smaller. Separation of concerns eliminated duplication that had accumulated invisibly for years.</p><p><strong>Full test coverage alongside every new ViewModel.</strong> A ViewModel test class was written in parallel with every production ViewModel, each covering the state machine exhaustively. The old code was hard to test because concerns were tangled. The new code was testable by design.</p><p><strong>Zero publisher migrations.</strong> Not a single existing integration required a code change. The refactor was invisible to everyone outside the SDK which was the entire point.</p><h4>What I would do differently</h4><p>The delegate-based ViewModel scoping worked, but it required discipline to ensure no ViewModel outlived its owning ad object. A more explicit lifecycle contract even a simple interface would have made this clearer to engineers joining the codebase later.</p><p>I would also design the state machine first. It was one of the last pieces formalized, when it should have been the first. Defining the complete state machine upfront forces every subsequent design decision to be evaluated against it and surfaces edge cases before they become production bugs.</p><h4>The broader lesson</h4><p>The constraint that made this refactor hard the frozen public API, the invisible migration is also what made the result meaningful. Any engineer can refactor a codebase they fully control. The discipline of changing everything internally while guaranteeing nothing changes externally forces architectural clarity that no code review checklist can replicate.</p><p>You cannot hide complexity behind a leaky abstraction when the abstraction is the only thing standing between your refactor and hundreds of broken publisher apps.</p><p>The new architecture was not just cleaner code. It was a system that could be understood, tested, and extended without fear by engineers who hadn’t written it, on devices they couldn’t test on, in apps they’d never seen.</p><p>That is what good SDK architecture is for.</p><p><em>Madhur Lalit is a Staff Android Engineer with 11 years of experience in Android SDK engineering. He specialises in mobile SDK architecture, ad tech infrastructure, and privacy-first mobile solutions. Published on Medium · github.com/Madroid2/apex-ad-sdk-android</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01fa6ad8baf8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why I Built an Android Ad SDK with Zero Third-Party Dependencies]]></title>
            <link>https://medium.com/@madhur.lalit2409/why-i-built-an-android-ad-sdk-with-zero-third-party-dependencies-e0954f7fe05f?source=rss-8fe1e0bf522b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0954f7fe05f</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile-development]]></category>
            <category><![CDATA[sdk]]></category>
            <category><![CDATA[adtech]]></category>
            <dc:creator><![CDATA[Madhur Lalit]]></dc:creator>
            <pubDate>Thu, 30 Apr 2026 11:48:24 GMT</pubDate>
            <atom:updated>2026-05-02T22:45:16.213Z</atom:updated>
            <content:encoded><![CDATA[<p><em>And what it taught me about the hidden cost of every library you ship</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p0SreeK7PXRMBo1uRBX6aw.png" /></figure><p>Every dependency you add to an SDK is a tax you charge your publishers.</p><p>Not a metaphorical tax. A real one paid in APK size, build time, version conflict debugging, and the occasional 2 AM production crash because your OkHttp version collided with theirs. I’ve been on both sides of that transaction: as the SDK engineer shipping the dependency, and as the engineer receiving the call when it broke.</p><p>After 11 years building Android SDKs in production most recently two ad SDKs at Smaato (Verve Group) serving a global publisher network I decided to build a reference SDK the way I actually believe SDKs should be built: with zero third-party runtime dependencies. No OkHttp. No Gson. No Timber. No Dagger. No Sentry SDK.</p><p>Here’s what I learned.</p><h4>The problem nobody talks about in SDK design</h4><p>When you build an app, your dependency tree is your own problem. Ship what you want.</p><p>When you build an SDK, your dependency tree becomes <em>your publisher’s</em> problem. Every library you include gets merged into their app. If they’re already using OkHttp 4.x and you’ve compiled against OkHttp 3.x, you’ve just handed them a version conflict that will surface not in your test suite, not in your demo app, but in their production build at 11pm before a release deadline.</p><p>This is not a hypothetical. In ad tech, where SDKs are integrated into thousands of publisher apps spanning every Android version from API 21 onwards, dependency conflicts are a leading cause of integration support tickets. I’ve handled enough of them to know the pattern: publisher integrates SDK, build succeeds, runtime crash on a device running a specific OEM Android flavour, root cause is a transitive dependency the publisher didn’t know they were inheriting.</p><p>The industry’s answer has been compileOnly scoping and careful version management. My answer was to eliminate the problem at the source.</p><h4>What “zero dependencies” actually means in practice</h4><p>Zero third-party runtime dependencies doesn’t mean zero dependencies. It means every dependency is an Android platform API something guaranteed to be on every device your SDK will ever run on.</p><p>Here’s what the substitution table looks like in practice:</p><p><strong>OkHttp → </strong><strong>java.net.HttpURLConnection</strong> HttpURLConnection is verbose. It lacks OkHttp&#39;s interceptor chain, its connection pooling is less sophisticated, and the API was designed in 2004. But for the request patterns an ad SDK makes fetch bid response, fire tracking pixels, deliver crash envelopes it is entirely sufficient. I wrapped it in a 200-line HttpAdNetworkClient class. No transitive deps. No version drift.</p><p><strong>Gson → </strong><strong>org.json.JSONObject</strong> org.json ships on every Android device. It&#39;s not as ergonomic as Gson or Moshi there&#39;s no annotation-based serialization, no type adapters. But OpenRTB bid requests and responses are well-defined JSON structures. Writing explicit serializers and parsers is more code, but it&#39;s code you fully control, and it adds zero bytes to the publisher&#39;s APK.</p><p><strong>Timber → </strong><strong>android.util.Log</strong> A thin AdLog wrapper with a single boolean DEBUG flag. Twelve lines of code. Done.</p><p><strong>Sentry SDK → Raw HTTP envelope protocol</strong> This one surprised even me. The Sentry Android SDK is a significant dependency. But Sentry publishes an open envelope protocol. A crash reporter that catches Thread.UncaughtExceptionHandler, serializes the stack trace into a Sentry envelope, and POSTs it to a DSN endpoint using HttpURLConnection with 3× exponential retry is about 150 lines of Kotlin. No Sentry SDK on the classpath. Full crash visibility in production.</p><p><strong>Hilt/Dagger → </strong><strong>ServiceLocator (40 lines)</strong> Annotation processors from DI frameworks conflict with host app DI graphs and slow incremental builds. My ServiceLocator is a ConcurrentHashMap&lt;Class, Any&gt; with register, get, and unregister methods. It handles SDK initialization, module wiring, and test mock injection. In test code, swapping the real HttpAdNetworkClient for a MockAdExchange is one line. No generated code. No annotation processing. No interference with whatever DI framework the publisher is using.</p><h4>The numbers that made it worth it</h4><p>The ApexAd SDK my open-source reference implementation of these principles adds under 150KB to a publisher’s APK. A comparable SDK built with OkHttp, Gson, Timber, Dagger, and the Sentry SDK would be 2–4x larger before a single line of ad tech logic is written.</p><p>Build time impact for publishers using the SDK in a multi-module project: zero annotation processing, zero kapt configuration, zero generated source directories.</p><p>Integration support tickets related to dependency conflicts: zero, by construction.</p><h4>What you lose and whether it matters</h4><p>I’m not arguing that OkHttp, Gson, or Dagger are bad libraries. They’re excellent libraries, built by exceptional engineers, appropriate for many contexts.</p><p>For SDK engineering specifically, the tradeoffs look different. The features you lose OkHttp’s interceptor chain, Gson’s annotation-based mapping, Dagger’s compile-time graph validation are features that primarily benefit complex applications. An SDK’s networking layer doesn’t need interceptor chains. Its data layer doesn’t need annotation-based serialization for a known JSON schema. Its DI needs to wire a handful of services at init time, not manage a complex application object graph.</p><p>The question isn’t “is this library good?” It’s “does this library’s benefits outweigh the cost I’m passing to my publishers?” For most ad SDK use cases, the honest answer is no.</p><h4>The broader principle</h4><p>Every architectural decision in an SDK is a decision you’re making on behalf of every engineer who will ever integrate your SDK. The zero-dependency constraint forced me to think about each dependency not as a convenience for me, but as an obligation I was placing on someone else.</p><p>That discipline improved the SDK in ways that went beyond dependency management. Explicit JSON parsers meant the OpenRTB model was fully visible and auditable. A hand-rolled HTTP client meant the request lifecycle was completely understood, not abstracted away. A 40-line ServiceLocator meant the dependency graph was human-readable.</p><p>The constraint became a design philosophy.</p><h4>The code</h4><p>The full SDK including all format modules (banner, interstitial, VAST 4.0 video, MRAID 3.0, native, app-open, in-app bidding), the AdMob mediation adapter, and a demo app with a mock ad exchange is open source:</p><p><strong>github.com/Madroid2/apex-ad-sdk-android</strong></p><p>If you’re building SDKs and you’ve wrestled with dependency conflicts, version hell, or publisher integration issues I’d genuinely like to hear how you approached it.</p><p><em>Madhur Lalit is a Staff Android Engineer with 11 years of experience in Android SDK engineering, currently at Smaato (Verve Group) in Hamburg. He specialises in ad tech infrastructure, mobile SDK architecture, and privacy-first mobile solutions.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0954f7fe05f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>