<?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 Badr Kacimi on Medium]]></title>
        <description><![CDATA[Stories by Badr Kacimi on Medium]]></description>
        <link>https://medium.com/@badrkacimi?source=rss-e28ee0b5617c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cTueMgQ48Q1-FNOY_ColOg.jpeg</url>
            <title>Stories by Badr Kacimi on Medium</title>
            <link>https://medium.com/@badrkacimi?source=rss-e28ee0b5617c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 16:06:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@badrkacimi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[One Workload, Three Hosts: Choosing Azure Compute for AI Workloads]]></title>
            <link>https://medium.com/@badrkacimi/one-workload-three-hosts-choosing-azure-compute-for-ai-workloads-c619296d6875?source=rss-e28ee0b5617c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c619296d6875</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[azure-compute]]></category>
            <category><![CDATA[microsoft]]></category>
            <dc:creator><![CDATA[Badr Kacimi]]></dc:creator>
            <pubDate>Tue, 06 Oct 2026 09:05:19 GMT</pubDate>
            <atom:updated>2026-10-06T09:10:19.447Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Functions Flex Consumption vs Container Apps vs AKS: same code, same load test, and the trade-offs nobody puts on the pricing page.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SDFyo_d6NZQnNXMn.jpg" /></figure><p>Most compute debates start with the platform.</p><blockquote>The good ones start with the workload.</blockquote><p>Over the past months I’ve written a lot about Microsoft Foundry: model routing, AI gateways, agents reasoning over enterprise data.</p><p>Every one of those agents eventually calls <strong>something you have to host</strong>. A tool API. An MCP server. An ingestion worker that chunks documents before they hit the index.</p><p>And when that moment comes, the conversation in most teams sounds like this:</p><blockquote><em>Just put it on AKS.</em></blockquote><p>Sometimes that’s right. Often it isn’t.</p><p>So I ran an experiment. I took <strong>one workload</strong>, kept the <strong>business logic identical</strong>, and deployed it to <strong>three Azure compute hosts</strong>. Same code. Same load test. Same infrastructure-as-code discipline.</p><p>This article is what I learned.</p><h3>TL;DR</h3><p>• <strong>Azure Functions Flex Consumption</strong> → event-driven or bursty HTTP APIs where you want scale-to-zero, VNet support, and zero infrastructure to babysit.</p><p>• <strong>Azure Container Apps</strong> → when you already think in containers and want serverless scaling without owning a cluster. Also your on-ramp to serverless GPUs.</p><p>• <strong>AKS</strong> → when you need the Kubernetes API itself: custom operators, service mesh, multi-tenant platform teams, strict node-level control.</p><ul><li>The deciding factor is rarely performance. It’s <strong>operating model</strong>: who is on call, and for what.</li></ul><h3>The Workload: A RAG Chunking Service</h3><p>Before any document reaches your vector index, it gets split into chunks. It’s boring, CPU-bound, bursty and absolutely everywhere in GenAI architectures.</p><p>Perfect candidate.</p><p>The core logic lives in one place and knows <strong>nothing</strong> about Azure:</p><pre>def chunk_text(text: str, chunk_size: int = 200, overlap: int = 40) -&gt; list[Chunk]:<br>    if not isinstance(text, str) or not text.strip():<br>        raise ValueError(&quot;text must be a non-empty string&quot;)<br>    if overlap &lt; 0 or overlap &gt;= chunk_size:<br>        raise ValueError(&quot;overlap must be &gt;= 0 and &lt; chunk_size&quot;)<br> <br>    words = _WORD_RE.findall(text)<br>    step = chunk_size - overlap<br>    chunks = []<br> <br>    for i, start in enumerate(range(0, len(words), step)):<br>        window = words[start : start + chunk_size]<br>        body = &quot; &quot;.join(window)<br>        chunks.append(Chunk(<br>            index=i,<br>            text=body,<br>            word_count=len(window),<br>            approx_tokens=round(len(window) * 1.33),<br>            sha256=hashlib.sha256(body.encode()).hexdigest(),<br>        ))<br>        if start + chunk_size &gt;= len(words):<br>            break<br>    return chunks</pre><p>Each host is just a thin adapter around this function.</p><p>That’s the first lesson, and honestly the most important one:</p><p><strong><em>If your business logic knows where it’s running, you’ve already lost the ability to choose.</em></strong></p><h3>Host 1: Azure Functions Flex Consumption</h3><blockquote><em>“I just want an endpoint that scales and costs nothing at night.”</em></blockquote><p>If you’ve used the classic Consumption plan, Flex is the upgrade you were waiting for: VNet integration, configurable instance memory, per-instance concurrency, and <strong>always-ready instances</strong> to kill cold starts where it matters.</p><p>It’s also no longer optional for Linux users. Microsoft has announced that <strong>hosting function apps on Linux Consumption retires on 30 September 2028</strong>, with no new features or language versions in the meantime. Flex is the migration path.</p><h3>The code</h3><p>Python v2 programming model, no function.json, just decorators:</p><pre>app = func.FunctionApp(http_auth_level=func.AuthLevel.FUNCTION)<br> <br>@app.route(route=&quot;chunk&quot;, methods=[&quot;POST&quot;])<br>def chunk(req: func.HttpRequest) -&gt; func.HttpResponse:<br>    try:<br>        payload = req.get_json()<br>        chunks = chunk_text(<br>            payload.get(&quot;text&quot;, &quot;&quot;),<br>            int(payload.get(&quot;chunk_size&quot;, 200)),<br>            int(payload.get(&quot;overlap&quot;, 40)),<br>        )<br>    except (ValueError, TypeError) as exc:<br>        return _json({&quot;detail&quot;: str(exc)}, status=400)<br> <br>    return _json({&quot;chunk_count&quot;: len(chunks),<br>                  &quot;chunks&quot;: [c.to_dict() for c in chunks]})</pre><h3>The infrastructure</h3><p>The interesting part of Flex in Bicep is the new functionAppConfig block. This is where scaling, runtime and deployment storage live now:</p><pre>functionAppConfig: {<br>  deployment: {<br>    storage: {<br>      type: &#39;blobContainer&#39;<br>      value: &#39;${storage.properties.primaryEndpoints.blob}${deploymentContainer}&#39;<br>      authentication: { type: &#39;SystemAssignedIdentity&#39; }<br>    }<br>  }<br>  scaleAndConcurrency: {<br>    instanceMemoryMB: 2048<br>    maximumInstanceCount: 100<br>    alwaysReady: [ { name: &#39;http&#39;, instanceCount: 1 } ]<br>  }<br>  runtime: { name: &#39;python&#39;, version: &#39;3.11&#39; }<br>}</pre><p>Notice three things:</p><p>• <strong>No connection strings.</strong> The storage account has allowSharedKeyAccess: false. The app authenticates with its managed identity.</p><p>• <strong>`maximumInstanceCount` is a cost guardrail</strong>, not a performance setting. Set it deliberately.</p><ul><li><strong>`alwaysReady`</strong> gives you one warm instance for HTTP triggers. Set it to 0 for pure scale-to-zero.</li></ul><h3>Host 2: Azure Container Apps</h3><p><em>“I have a container. I don’t want a cluster.”</em></p><p>Container Apps runs on Kubernetes under the hood, with KEDA-based scaling and scale-to-zero, but you never see a node, a kubelet or an upgrade window.</p><h3>The infrastructure</h3><p>Scaling is declared on the app, based on HTTP concurrency:</p><pre>scale: {<br>  minReplicas: 0<br>  maxReplicas: 10<br>  rules: [<br>    {<br>      name: &#39;http-concurrency&#39;<br>      http: { metadata: { concurrentRequests: &#39;50&#39; } }<br>    }<br>  ]<br>}</pre><p>And the registry pull uses a <strong>user-assigned managed identity</strong>:</p><pre>registries: [<br>  { server: acr.properties.loginServer, identity: pullIdentity.id }<br>]</pre><p>Why user-assigned and not system-assigned? Because a system-assigned identity doesn’t exist until the app exists, yet the app can’t start until it can pull its image. User-assigned breaks the chicken-and-egg problem. The ACR admin user stays <strong>disabled</strong>.</p><h3>The GenAI angle</h3><p>Here’s why Container Apps deserves extra attention from AI teams.</p><p>Today our chunker is CPU-bound. Tomorrow someone will ask: <em>“Can we generate embeddings with our own open-source model in the same pipeline?”</em></p><p>On Container Apps, that’s the same hosting model with a different workload profile. <strong>Serverless GPUs (NVIDIA A100 and T4) are generally available</strong>, with per-second billing and scale-to-zero. No GPU node pool to provision and forget about over the weekend 😅</p><h3>Host 3: Azure Kubernetes Service</h3><p><em>“We need control.”</em></p><p>Fair. Sometimes you do.</p><h3>The infrastructure</h3><p>A production-shaped baseline, not a tutorial cluster:</p><pre>networkProfile: {<br>  networkPlugin: &#39;azure&#39;<br>  networkPluginMode: &#39;overlay&#39;<br>}<br>oidcIssuerProfile: { enabled: true }<br>securityProfile: { workloadIdentity: { enabled: true } }<br>workloadAutoScalerProfile: { keda: { enabled: true } }<br>autoUpgradeProfile: { upgradeChannel: &#39;patch&#39; }</pre><p>Then the Kubernetes side: a Deployment with non-root containers and a read-only filesystem, a PodDisruptionBudget, topology spread, and an HPA:</p><pre>spec:<br>  minReplicas: 2<br>  maxReplicas: 20<br>  metrics:<br>    - type: Resource<br>      resource:<br>        name: cpu<br>        target: { type: Utilization, averageUtilization: 60 }</pre><p>On AKS you scale at <strong>two layers</strong>: the HPA scales pods, the cluster autoscaler scales nodes. When they disagree (pods pending, nodes still booting) your p95 tells you about it.</p><h3>The Decision Guide</h3><p>Ask these questions <strong>in order</strong>. Stop at the first <strong>yes</strong>.</p><p>1. <strong>Do you need the Kubernetes API itself</strong> (operators, CRDs, mesh, platform team serving many tenants)? → <strong>AKS</strong></p><p>2. <strong>Do you need GPUs, sidecars, or arbitrary containers, but no cluster ownership?</strong> → <strong>Container Apps</strong></p><p>3. <strong>Is the workload event-driven or bursty, triggered by HTTP, queues, blobs or timers?</strong> → <strong>Functions Flex Consumption</strong></p><p>4. <strong>None of the above?</strong> → Start with Container Apps. It’s the easiest host to move away from in either direction, because your artifact is a standard container image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ddbYQPTcQkaoR-P9lSt1nQ.png" /></figure><h3>The Real Pattern Behind All This</h3><blockquote><em>Compute is not a platform choice. It’s an </em><strong><em>operating model</em></strong><em> choice.</em></blockquote><p>Functions, Container Apps and AKS can all run the same chunker. The real question is <strong>how much of the platform you want to own</strong> and whether your team can carry that ownership on a bad day.</p><p>Choose the host that lets your team sleep. Then measure, and be willing to move.</p><p>If you’re exposing these services to AI agents across many teams, put a gateway in front of them. I covered that in <a href="https://medium.com/@badrkacimi/azure-api-management-as-an-ai-gateway-for-microsoft-foundry-enterprise-model-governance-at-scale-64953cbf3da0"><strong>Azure API Management as an AI Gateway for Microsoft Foundry</strong></a>.</p><p><strong><em>Thanks for reading my article and I hope you can take something away.</em></strong></p><p>💯 Don’t forget to <em>follow me on</em> <strong><em>medium</em></strong> <em>for more</em></p><p>💯 Don’t forget to <em>follow me on</em> <a href="https://www.linkedin.com/in/badr-kacimi/"><strong>LinkedIn</strong></a> <em>for more</em></p><p>💯 <strong><em>leave some feedback</em></strong></p><h3><a href="https://mvp.microsoft.com/">MVP Communities — Microsoft</a></h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c619296d6875" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Grok 4.6 on Microsoft Foundry: Building AI Agents That Reason Across Long-Context Workloads]]></title>
            <link>https://medium.com/@badrkacimi/grok-4-6-on-microsoft-foundry-building-ai-agents-that-reason-across-long-context-workloads-185badd786c2?source=rss-e28ee0b5617c------2</link>
            <guid isPermaLink="false">https://medium.com/p/185badd786c2</guid>
            <category><![CDATA[microsoft-foundry]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[grok]]></category>
            <dc:creator><![CDATA[Badr Kacimi]]></dc:creator>
            <pubDate>Mon, 31 Aug 2026 21:18:44 GMT</pubDate>
            <atom:updated>2026-08-31T21:18:44.918Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/617/0*EO4rxOu5gnnTFfhu" /></figure><h3><em>A practical guide to deploying a multimodal, tool-using model through Microsoft Foundry’s OpenAI-compatible APIs.</em></h3><p>The gap between “we can call a model” and “we can build a reliable AI system” is wider than it first appears. A production application needs more than text generation. It needs reasoning, long-context understanding, tool use, observability, authentication, governance, and a clear path from experimentation to deployment.</p><p>Grok 4.6 is now available in the Microsoft Foundry model catalog as a model sold directly by Azure. It is designed for coding, engineering, research, knowledge work, and agentic workflows. The model accepts text and image inputs, generates text outputs, supports tool calling, and provides a context window of up to 200,000 tokens.</p><p>This article explores what Grok 4.6 brings to Microsoft Foundry and walks through the main steps required to deploy and use it in an AI application.</p><blockquote><strong><em>Important:</em></strong><em> Grok 4.6 is currently listed as a public preview. Preview services do not have a service-level agreement, so evaluate the model carefully before using it in production or high-impact workloads.</em></blockquote><h3>Why Grok 4.6 Is Interesting</h3><p>Many enterprise AI scenarios are not simple question-and-answer interactions. They require the model to inspect a large amount of information, reason through multiple steps, choose the right tool, and return an actionable result.</p><p>Grok 4.6 is aimed at this type of workload.</p><p>The model provides:</p><ul><li>A 200,000-token context window for large documents, codebases, specifications, and multi-step conversations.</li><li>Multimodal input with support for text and images.</li><li>Reasoning controls that allow applications to trade off latency, cost, and depth of analysis.</li><li>Function calling for selecting tools and coordinating multi-step workflows.</li><li>Support for both the Chat Completions API and the Responses API.</li><li>Global Standard deployment through Microsoft Foundry.</li></ul><p>The important point is not only the size of the context window. The larger opportunity is combining long-context reasoning with an enterprise application layer that already provides authentication, deployment management, quota controls, and Azure governance.</p><h3>Architecture: Grok 4.6 as the Reasoning Layer</h3><p>An AI agent usually contains several distinct components:</p><ol><li>The user or application submits a request.</li><li>The model interprets the request and decides what needs to happen.</li><li>The agent calls a tool, searches a knowledge source, or performs an action.</li><li>The result is returned to the model for additional reasoning.</li><li>The model produces a final answer or structured output.</li></ol><p>Grok 4.6 fits into the reasoning layer of this architecture. Microsoft Foundry provides the managed endpoint and deployment boundary, while the application controls the tools, business rules, permissions, and human approval steps.</p><p>This separation is useful because the model should not be responsible for enforcing enterprise authorization on its own. The application and connected services should decide which data and actions are available. The model can recommend or request a tool call, but your application should validate the request before executing it.</p><h3>Prerequisites</h3><p>Before deploying Grok 4.6, you need:</p><ul><li>An Azure subscription with a valid payment method.</li><li>A Microsoft Foundry project in a supported region.</li><li>Permission to create and manage model deployments. Microsoft’s deployment guidance lists the Cognitive Services Contributor role for this operation.</li><li>An authentication method. Microsoft Entra ID is recommended for managed enterprise environments, while an API key can be useful for initial testing.</li><li>Python, JavaScript, or REST tooling, depending on how you plan to build the application.</li></ul><p>For the Python examples in this article, install the OpenAI and Azure Identity packages:</p><pre>pip install --upgrade openai azure-identity</pre><h3>Deploy Grok 4.6 in Microsoft Foundry</h3><p>The first step is to create a deployment. Open the model catalog in Microsoft Foundry, search for grok-4.6, and select the deployment option.</p><p>Choose a deployment name that your application will use later. For example:</p><pre>grok-46-prod</pre><p>Grok 4.6 currently uses the Global Standard deployment type. The deployment name is important because API requests use the deployment name rather than the underlying model name.</p><p>You can also deploy the model through the Azure CLI:</p><pre>az cognitiveservices account deployment create \<br>  --name &lt;ACCOUNT_NAME&gt; \<br>  --resource-group &lt;RESOURCE_GROUP&gt; \<br>  --deployment-name &lt;DEPLOYMENT_NAME&gt; \<br>  --model-name &quot;grok-4.6&quot; \<br>  --model-format &quot;xAI&quot; \<br>  --model-version &quot;1&quot; \<br>  --sku-name GlobalStandard \<br>  --sku-capacity 1</pre><p>Replace the placeholder values with the name of your Foundry resource, resource group, and deployment.</p><p>After deployment, your endpoint follows this pattern:</p><pre>https://&lt;resource-name&gt;.services.ai.azure.com</pre><h3>Call Grok 4.6 with the Responses API</h3><p>The Responses API is a good starting point for agentic applications because it provides a simple interface for multi-turn interactions and tool orchestration.</p><p>The following example uses Microsoft Entra ID authentication:</p><pre>import os<br>from azure.identity import DefaultAzureCredential, get_bearer_token_provider<br>from openai import OpenAI<br><br>token_provider = get_bearer_token_provider(<br>    DefaultAzureCredential(),<br>    &quot;https://ai.azure.com/.default&quot;,<br>)<br>client = OpenAI(<br>    base_url=f&quot;{os.environ[&#39;AZURE_ENDPOINT&#39;]}/openai/v1&quot;,<br>    api_key=token_provider,<br>)<br>response = client.responses.create(<br>    model=os.environ[&quot;DEPLOYMENT_NAME&quot;],<br>    instructions=(<br>        &quot;You are an enterprise engineering assistant. &quot;<br>        &quot;Explain your assumptions and return actionable recommendations.&quot;<br>    ),<br>    input=&quot;Review the main risks in adopting an agentic coding workflow.&quot;,<br>    reasoning={&quot;effort&quot;: &quot;high&quot;},<br>)<br>print(response.output_text)</pre><p>Set the required environment variables before running the script:</p><pre>export AZURE_ENDPOINT=&quot;https://&lt;resource-name&gt;.services.ai.azure.com&quot;<br>export DEPLOYMENT_NAME=&quot;&lt;your-deployment-name&gt;&quot;</pre><p>The Responses API supports low, medium, and high reasoning effort levels. A higher setting can help with complex tasks, but it can also increase latency and token usage. The right setting depends on the workload rather than on the model alone.</p><h3>Chat Completions Is Also Available</h3><p>If your application already uses the Chat Completions API, Grok 4.6 exposes a compatible interface:</p><pre>response = client.chat.completions.create(<br>    model=os.environ[&quot;DEPLOYMENT_NAME&quot;],<br>    messages=[<br>        {<br>            &quot;role&quot;: &quot;system&quot;,<br>            &quot;content&quot;: &quot;You are a concise technical assistant.&quot;,<br>        },<br>        {<br>            &quot;role&quot;: &quot;user&quot;,<br>            &quot;content&quot;: &quot;List three checks for a production AI agent.&quot;,<br>        },<br>    ],<br>    reasoning_effort=&quot;medium&quot;,<br>)</pre><pre>print(response.choices[0].message.content)</pre><p>For Chat Completions, the available reasoning effort values are low, medium, high, and xhigh. This makes it possible to use one deployment for different classes of work, such as quick classification on one path and deeper analysis on another.</p><h3>Add Tools with Function Calling</h3><p>An agent becomes useful when it can interact with the systems around it. That might include a ticketing system, a database, a document repository, an internal API, or a business workflow.</p><p>Grok 4.6 can request a function call by returning the function name and structured arguments. Your application then validates the arguments, executes the function, and sends the result back to the model.</p><p>Here is a simplified tool definition using the Chat Completions API:</p><pre>tools = [<br>    {<br>        &quot;type&quot;: &quot;function&quot;,<br>        &quot;function&quot;: {<br>            &quot;name&quot;: &quot;get_incident_status&quot;,<br>            &quot;description&quot;: &quot;Retrieve the current status of an incident.&quot;,<br>            &quot;parameters&quot;: {<br>                &quot;type&quot;: &quot;object&quot;,<br>                &quot;properties&quot;: {<br>                    &quot;incident_id&quot;: {<br>                        &quot;type&quot;: &quot;string&quot;,<br>                        &quot;description&quot;: &quot;The incident identifier.&quot;,<br>                    }<br>                },<br>                &quot;required&quot;: [&quot;incident_id&quot;],<br>            },<br>        },<br>    }<br>]</pre><pre>response = client.chat.completions.create(<br>    model=os.environ[&quot;DEPLOYMENT_NAME&quot;],<br>    messages=[<br>        {<br>            &quot;role&quot;: &quot;user&quot;,<br>            &quot;content&quot;: &quot;Check the status of incident INC-1042.&quot;,<br>        }<br>    ],<br>    tools=tools,<br>    reasoning_effort=&quot;high&quot;,<br>)</pre><p>At this point, the model has only requested a tool. It has not executed anything. The application must inspect the returned tool call, validate the incident identifier, apply authorization checks, invoke the backend system, and then provide the result to the model.</p><p>That boundary is essential for secure agent design. Tool calling should be treated as a controlled interface, not as unrestricted access to your environment.</p><h3>What the 200K Context Window Changes</h3><p>A 200,000-token context window is useful when the task depends on relationships across a large amount of information.</p><p>Examples include:</p><ul><li>Reviewing a large software repository.</li><li>Comparing technical specifications with implementation details.</li><li>Analyzing a long set of operational reports.</li><li>Summarizing multiple documents while preserving cross-document context.</li><li>Investigating an incident using logs, runbooks, tickets, and architecture diagrams.</li></ul><p>However, a large context window does not remove the need for good information architecture. Sending every available document to every request can increase cost, latency, and the chance of irrelevant context influencing the answer.</p><p>A practical design usually combines retrieval, metadata filtering, document chunking, and selective context assembly. The model should receive the information needed for the current task, not an uncontrolled export of the entire enterprise.</p><h3>Multimodal Inputs for Technical Workflows</h3><p>Grok 4.6 accepts text and image inputs. This makes it possible to combine written instructions with visual material such as:</p><ul><li>Architecture diagrams.</li><li>Screenshots of application errors.</li><li>Dashboard images.</li><li>Scanned forms or technical drawings.</li><li>User interface designs.</li></ul><p>For example, an engineering assistant could receive an incident description together with a screenshot of the failing dashboard. A support agent could use a product screenshot alongside a written troubleshooting guide.</p><p>As with text, images should be treated as evidence to analyze rather than as automatically trustworthy instructions. Applications should define what the model is allowed to infer and which conclusions require human review.</p><h3>Streaming for Better User Experiences</h3><p>Long-running reasoning tasks can take time. Streaming allows the application to display output incrementally instead of waiting for the complete response.</p><p>With the Responses API, the application can listen for output text delta events:</p><pre>stream = client.responses.create(<br>    model=os.environ[&quot;DEPLOYMENT_NAME&quot;],<br>    input=&quot;Explain how to introduce evaluation into an AI agent project.&quot;,<br>    stream=True,<br>)</pre><pre>for event in stream:<br>    if event.type == &quot;response.output_text.delta&quot;:<br>        print(event.delta, end=&quot;&quot;, flush=True)</pre><p>Streaming improves perceived responsiveness, especially in chat interfaces and applications where users need to see progress while a larger answer is being generated.</p><h3>Production Considerations</h3><p>The model catalog describes Grok 4.6 as a preview model, so a production evaluation should include more than a few successful playground prompts.</p><p>Before adopting it for a real workload, test:</p><ul><li>Accuracy on representative tasks and documents.</li><li>Tool-selection quality and argument correctness.</li><li>Performance at different reasoning effort levels.</li><li>Latency and token consumption.</li><li>Behavior with incomplete, conflicting, or malicious inputs.</li><li>Failure handling when a tool or dependency is unavailable.</li><li>Human approval requirements for high-impact actions.</li></ul><p>Microsoft’s responsible AI guidance also recommends validating model behavior on realistic prompts, monitoring failures, applying content safety controls, and using human oversight for high-impact workflows.</p><p>The model should not make autonomous medical, legal, financial, or safety-critical decisions without expert review. Independent verification is still required wherever factual accuracy or business impact matters.</p><h3>Conclusion</h3><p>Grok 4.6 brings a strong combination of long-context reasoning, multimodal understanding, tool calling, and OpenAI-compatible APIs to Microsoft Foundry.</p><p>For developers, the practical value is not just access to another language model. It is the ability to place a reasoning-oriented model inside an Azure-managed deployment with familiar authentication, API patterns, quota controls, and enterprise integration options.</p><p>The most promising use cases are workloads where the model must understand a large amount of context, reason through a complex task, and coordinate with external tools. Coding assistants, technical research agents, enterprise knowledge workflows, and engineering automation are natural starting points.</p><p>The best way to evaluate Grok 4.6 is to begin with a narrow, measurable scenario. Define the task, connect only the tools it needs, test it against real examples, and measure quality, latency, cost, and failure modes before expanding the scope.</p><p>Thanks for reading my article, and I hope you can take something away.</p><p>💯 Don’t forget to follow me on Medium for more.</p><p>💯 Follow me on <a href="https://www.linkedin.com/">LinkedIn</a> for more.</p><p>💯 Leave some feedback.</p><h3>Further Reading</h3><ul><li><a href="https://ai.azure.com/catalog/models/grok-4.6">Grok 4.6 in the Microsoft Foundry model catalog</a></li><li><a href="https://learn.microsoft.com/en-us/azure/foundry/foundry-models/how-to/use-foundry-models-grok">Deploy and use Grok models in Microsoft Foundry</a></li><li><a href="https://docs.x.ai/developers/grok-4-6">Grok 4.6 documentation from xAI</a></li></ul><p>That’s all!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=185badd786c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure AI Foundry Anti‑Patterns: What Not to Do in Real Projects]]></title>
            <link>https://medium.com/@badrkacimi/azure-ai-foundry-anti-patterns-what-not-to-do-in-real-projects-7d0896cb0977?source=rss-e28ee0b5617c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d0896cb0977</guid>
            <category><![CDATA[antipattern]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Badr Kacimi]]></dc:creator>
            <pubDate>Mon, 06 Apr 2026 11:37:13 GMT</pubDate>
            <atom:updated>2026-04-06T11:38:37.311Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ednC6NXR95lcWa80" /><figcaption><a href="https://www.cnet.com/pictures/natures-patterns-golden-spirals-and-branching-fractals/">Nature’s patterns: Golden spirals and branching fractals — CNET</a></figcaption></figure><blockquote>Most blog posts show how Azure AI Foundry works.<br>Very few show how it quietly fails in production.</blockquote><p>After experimenting multiple AI initiatives from proof-of-concept to scaled deployments, I’ve noticed a pattern. The teams that struggle aren’t lacking features, models, or ambition.</p><p>They repeat the <strong>same anti‑patterns</strong>.</p><p>This article isn’t about shaming teams or blaming tools. Azure AI Foundry is a powerful platform. But like any platform, how you use it matters more than what it offers.</p><p>If you’re building real customer-facing AI, not just demos</p><p>these are the mistakes to avoid.</p><h3>Anti‑Pattern #1: One Model to Rule Them All</h3><blockquote><em>“Let’s just use GPT‑4 for everything.”</em></blockquote><p>This feels efficient at first. One deployment, one prompt strategy, one approval flow.</p><p>In practice, it causes:</p><ul><li>Unpredictable latency</li><li>Inflated costs</li><li>Inconsistent behaviors across tasks</li><li>Difficult tuning and governance</li></ul><h3>What goes wrong</h3><p>Different workloads have <strong>different intelligence needs</strong>:</p><ul><li>Classification ≠ summarization</li><li>Extraction ≠ reasoning</li><li>Real‑time chat ≠ batch processing</li></ul><p>Forcing all of this through one large model creates unnecessary complexity and fragility.</p><h3>What to do instead</h3><p>Adopt a <strong>model portfolio mindset</strong>:</p><ul><li>Smaller or faster models for extraction/classification</li><li>Larger models only where reasoning truly adds value</li><li>Explicit model–task mapping in your architecture docs</li></ul><p>Use model router for performance and cost efficiency, see my previous article about that <a href="https://medium.com/@badrvkacimi/the-model-router-explained-intelligent-cost-performance-optimization-in-azure-ai-foundry-c2614a403471"><strong>The Model Router Explained: Intelligent Cost &amp; Performance Optimization in Azure AI Foundry</strong></a></p><h3>Anti‑Pattern #2: Prompt Sprawl Without Ownership</h3><blockquote><em>“Wait… which prompt is production using?”</em></blockquote><p>This happens faster than teams expect.</p><p>Prompts get:</p><ul><li>Copied across environments</li><li>Modified by different people</li><li>Tweaked in-flight to fix “small issues”</li><li>Left undocumented</li></ul><p>What goes wrong</p><ul><li>No auditability</li><li>No reproducibility</li><li>No clear “source of truth”</li><li>Production issues no one can confidently roll back</li></ul><h3>What to do instead</h3><p>Treat prompts as <strong>first-class assets</strong>:</p><ul><li>Version them (yes, like code)</li><li>Assign clear ownership</li><li>Use naming conventions tied to business outcomes</li><li>Log prompt changes alongside deployments</li></ul><h3>Anti‑Pattern #3: Treating Foundry Like a Notebook, Not a Platform</h3><blockquote><em>“It works in the playground, let’s ship it.”</em></blockquote><p>Playgrounds are dangerous when mistaken for production environments.</p><h3>What goes wrong</h3><ul><li>Hard-coded parameters</li><li>Hidden assumptions (temperature, max tokens, system prompts)</li><li>No environment separation</li><li>No CI/CD integration.</li></ul><h3>What to do instead</h3><p>Design for <strong>platform agnostic</strong> from day one:</p><ul><li>Explicit configuration management</li><li>Clear dev / test / prod separation</li><li>Infrastructure-as-code patterns</li><li>Repeatable deployment pipelines</li></ul><h3>Anti‑Pattern #4: Ignoring Latency vs Accuracy Trade‑Offs</h3><blockquote><em>“The answer is great, but it takes 12 seconds.”</em></blockquote><p>In isolation, accuracy feels like the only metric that matters.</p><p>In reality:</p><ul><li>Users abandon slow systems</li><li>APIs time out</li><li>Downstream systems fail silently</li></ul><h3>What goes wrong</h3><p>Teams optimize for “best possible answers” without considering:</p><ul><li>End‑to‑end latency</li><li>Token limits</li><li>Streaming vs blocking responses</li><li>User expectations per interaction</li></ul><h3>What to do instead</h3><p>Make trade‑offs explicit:</p><ul><li>Define acceptable latency per use case</li><li>Test different temperature and reasoning settings</li><li>Use progressive disclosure (fast answer → refined answer)</li><li>Measure perceived performance, not just correctness</li></ul><h3>Anti‑Pattern #5: Shipping Without Telemetry</h3><blockquote><em>“It worked fine last week.”</em></blockquote><p>This phrase usually appears <strong>right before a post‑mortem </strong>😂</p><h3>What goes wrong</h3><p>Without telemetry, teams can’t answer:</p><ul><li>Why did this response change?</li><li>Which prompts are failing most?</li><li>Did a model update affect behavior?</li><li>Are costs scaling linearly or exponentially?</li></ul><p>Azure gives you monitoring tools, using them is no longer optional.</p><h3>What to do instead</h3><p>Instrument everything:</p><ul><li>Prompt ID + model + parameters</li><li>Latency and token usage</li><li>User feedback loops</li><li>Error and fallback paths</li></ul><h3>The Real Pattern Behind These Anti‑Patterns</h3><p>Each mistake shares a theme:</p><blockquote><em>Treating AI systems like “smart features” instead of </em><strong><em>existing systems</em></strong><em>.</em></blockquote><p>Azure AI Foundry gives you the building blocks but <strong>architecture, governance, and humility keep systems healthy</strong>.</p><p><strong><em>Thanks for reading my article and I hope you can take something away.</em></strong></p><p>💯 Don’t forget to <em>follow me on </em><strong><em>medium </em></strong><em>for more</em></p><p>💯 Don’t forget to <em>follow me on </em><a href="https://www.linkedin.com/in/badr-kacimi/"><strong><em>LinkedIn</em></strong></a><strong><em> </em></strong><em>for more</em></p><p>💯 <strong><em>leave some feedback</em></strong></p><h3>#<a href="https://mvp.microsoft.com/">MVP Communities — Microsoft</a></h3><h3>That’s all !</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d0896cb0977" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Model Router Explained: Intelligent Cost & Performance Optimization in Azure AI Foundry]]></title>
            <link>https://medium.com/@badrkacimi/the-model-router-explained-intelligent-cost-performance-optimization-in-azure-ai-foundry-c2614a403471?source=rss-e28ee0b5617c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2614a403471</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[router]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Badr Kacimi]]></dc:creator>
            <pubDate>Sun, 05 Apr 2026 15:48:01 GMT</pubDate>
            <atom:updated>2026-04-05T15:48:01.056Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IorzxJdFav3_l3yA.png" /></figure><p>Most GenAI teams start with a single model, most <strong>enterprise GenAI failures</strong> come from staying there too long.</p><p>As Azure AI Foundry matures, Microsoft is quietly shifting the conversation away from <strong>Which model? to Which model, <em>when</em>?, </strong>this<strong> </strong>shift rely in one of Foundry’s powerful capabilities: <strong>the Model Router</strong>.</p><p>This article breaks down:</p><ul><li>What the Model Router is</li><li>Why static model selection doesn’t scale</li><li>How Azure AI Foundry enables intelligent routing across models</li><li>How to use the model router</li><li>Pricing</li></ul><h3>Why Single Model Strategies Break at Scale</h3><p>Enterprise GenAI workloads are <strong>not homogeneous</strong>:</p><ul><li>Some prompts require deep reasoning</li><li>Others are lightweight classification or summarization</li><li>Many are latency‑sensitive</li><li>All are cost‑constrained</li></ul><p>Running <strong>every request against your most powerful model</strong> guarantees:</p><ul><li>higher costs</li><li>wasted reasoning capacity</li></ul><p>Azure AI Foundry explicitly addresses this problem by enabling <strong>runtime model selection across a unified inference layer</strong>, rather than locking applications to one provider.</p><h3>What Is the Model Router (Conceptually)?</h3><p>The <strong>Model Router</strong> is a <strong>runtime decision layer</strong> that selects the <em>most appropriate model</em> for a given request based on predefined criteria.</p><p>It is <strong>not</strong>:</p><ul><li>a load balancer</li><li>a prompt router</li><li>an LLM ensemble that merges outputs</li></ul><p>It <strong>is</strong>:</p><ul><li>a cost‑performance optimization layer</li><li>model‑agnostic</li></ul><h3>Why Microsoft Built This into Azure AI Foundry</h3><p>Azure AI Foundry exposes <strong>11,000+ models</strong> across providers through a <strong>single </strong>inference<strong>, w</strong>ithout routing, that catalog becomes operational chaos.</p><p>Microsoft’s approach:</p><blockquote>Centralize model access, decentralize model choice.</blockquote><p>Different models have different cost profiles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0iNui-UqmYFL6wpXcgLnJQ.png" /></figure><p>Azure AI Foundry supports <strong>specialist models</strong> like Cohere Rerank, lightweight OpenAI variants.</p><p>You can see my article about <a href="https://medium.com/@badrvkacimi/fixing-the-last-mile-of-rag-with-cohere-rerank-v4-0-on-microsoft-foundry-6deece733a2e">Cohere Rerank.</a></p><h3>Performance Optimization Through Runtime Selection</h3><p>Azure AI Foundry’s unified API allows dynamic switching without redeploying applications, which is critical for production systems</p><p>Routing enables:</p><ul><li>fast models for early filtering</li><li>slower models only for complex prompts</li><li>fallback strategie (time out)</li></ul><h3>Fast models for early filtering</h3><p>Model router optimizes costs and latencies while maintaining comparable quality. Smaller and cheaper models are used when they’re sufficient for the task, but larger and more expensive models are available for more complex tasks.</p><p><strong>slower models only for complex prompts</strong></p><p>reasoning models are available for tasks that require complex reasoning, and non-reasoning models are used otherwise. Model router provides a single deployment and chat experience that combines the best features from all of the underlying chat models.</p><p>The latest version, 2025-11-18 includes several capabilities:</p><ol><li>Support Global Standard and Data Zone Standard deployments.</li><li>Adds support for new models: grok-4, grok-4-fast-reasoning, DeepSeek-V3.1, DeepSeek-V3.2, gpt-oss-120b, Llama-4-Maverick-17B-128E-Instruct-FP8, gpt-4o, gpt-4o-mini, gpt-5.2, gpt-5.2-chat, claude-haiku-4-5, claude-sonnet-4-5, claude-opus-4-1, and claude-opus-4-6.</li><li>Quick deploy or Custom deploy with routing mode and model subset options.</li><li>Routing mode: Optimize the routing logic for your needs. Supported options: Quality, Cost, Balanced (default).</li><li>Model subset: Select your preferred models to create your model subset for routing.</li><li>Support for agentic scenarios including tools so you can now use it in the Foundry Agent Service.</li></ol><p><strong>Fallback strategie</strong></p><p>Model router now includes built-in automatic failover. When using the default deployment to route to all supported models, model router transparently redirects the request to the next most appropriate model, so transient issues with any single model don’t disrupt your application. Failover is enabled by default — no additional configuration is required.</p><p>For custom deployment configurations:</p><ul><li>Your selected routing mode (Balanced, Cost, or Quality) continues to apply during failover.</li><li>Your configured model subset also works as your fallback set to prevent your prompts getting processed by unapproved models. Therefore, be sure to select model subsets with at least two models to benefit from the fallback capability.</li></ul><h3>How to use the model router</h3><p>In the model catalog, find model-router in the Models list and select it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y-mG7y02_z9Q5FJeWY0URg.png" /></figure><p>Choose Default settings for the Balanced routing mode and route between all supported models. To enable more configuration options, choose Custom settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-KIsqOV-TpNZqCgu81bzNA.png" /></figure><p>Use the Routing mode dropdown to select a routing profile. This sets the routing logic for your deployment.</p><p>When to use each mode:</p><ul><li>Balanced (default): Most workloads. Optimizes cost while maintaining quality.</li><li>Quality: Critical tasks like legal review, medical summaries, or complex reasoning.</li><li>Cost: High-volume, budget-sensitive workloads like content classification or simple Q&amp;A.</li></ul><p>Your tokens-per-minute rate limit setting applies to all activity to and from the model router; don’t set rate limits for each underlying chat model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*514bTCd1EDvEW9PE4gqpPg.png" /></figure><blockquote>Changes to the routing mode can take up to five minutes to take effect.</blockquote><h3>Select your model subset</h3><p>In the model router deployment pane, select Route to a subset of models. Then select the underlying models you want to enable.</p><p>You must select at least one model for routing. If no models are selected, the deployment uses the default model set for your routing mode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bzyo0-HVDYYujjo4psEKeQ.png" /></figure><blockquote>To include models by Anthropic (Claude) in your model router deployment, you need to deploy them yourself to your Foundry resource.</blockquote><h3>Test model router with the Completions API</h3><p>You can use model router through the <a href="https://learn.microsoft.com/en-us/azure/ai-foundry/openai/chatgpt-quickstart">chat completions API</a> in the same way you’d use other OpenAI chat models.</p><p>Set the model parameter to the name of our model router deployment, and set the messages parameter to the messages you want to send to the model.</p><h3>Pricing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*buIbyCL54Da393V7TzReXw.png" /></figure><p><strong><em>Thanks for reading my article and I hope you can take something away.</em></strong></p><p>💯 Don’t forget to <em>follow me on </em><strong><em>medium </em></strong><em>for more</em></p><p>💯 Don’t forget to <em>follow me on </em><a href="https://www.linkedin.com/in/badr-kacimi/"><strong><em>LinkedIn</em></strong></a><strong><em> </em></strong><em>for more</em></p><p>💯 <strong><em>leave some feedback</em></strong></p><p>FURTHER Reading​</p><ul><li><a href="https://learn.microsoft.com/en-us/azure/foundry/openai/concepts/model-router">https://learn.microsoft.com/en-us/azure/foundry/openai/concepts/model-router</a></li></ul><h3>#<a href="https://mvp.microsoft.com/">MVP Communities — Microsoft</a></h3><h3>That’s all !</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2614a403471" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connecting Microsoft Fabric and Foundry: Building AI Agents That Reason Over Enterprise Data]]></title>
            <link>https://medium.com/@badrkacimi/connecting-microsoft-fabric-and-foundry-building-ai-agents-that-reason-over-enterprise-data-53dfe4702088?source=rss-e28ee0b5617c------2</link>
            <guid isPermaLink="false">https://medium.com/p/53dfe4702088</guid>
            <category><![CDATA[microsoft-fabric]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Badr Kacimi]]></dc:creator>
            <pubDate>Sun, 05 Apr 2026 01:12:02 GMT</pubDate>
            <atom:updated>2026-04-05T13:52:23.513Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*KsfG554jgXqcCwnY.png" /></figure><p>The gap between ‘we have the data’ and ‘the AI can use the data’ is wider than most organizations expect. Enterprise data lives in lakehouses, warehouses, semantic models, and Power BI datasets. Getting an AI agent to reason over it, not just query it, but understand the business concepts it represents has historically required significant custom work.</p><p>Fabric IQ and the Microsoft Fabric MCP tool for Foundry agents close this gap. They create a semantic intelligence layer between your Foundry agents and your Fabric data; one that understands business concepts, not just column names, and retrieves consistent, permissioned answers across analytics, time-series, and operational data.</p><p>This article explores the integration architecture and provides a step‑by‑step guide to connecting a Foundry agent to Fabric data.</p><h3>Architecture: Fabric IQ as the Semantic Data Layer</h3><p>Fabric IQ creates a semantic layer on top of your Microsoft Fabric data. Instead of exposing raw tables and columns to an AI agent, it exposes the business logic, aggregations, and access controls already applied.</p><p>The Foundry agent queries Fabric IQ using natural language. Fabric IQ translates that into the appropriate Fabric queries (DAX, SQL, KQL), applies row-level security based on the calling user’s identity, and returns structured data with business-domain context. The agent never writes raw SQL. You never worry about prompt injection through query generation.</p><h3>Security architecture</h3><p>Fabric IQ enforces the Fabric data access model. The agent sees only data the calling user has permission to see. This is enforced by Fabric’s row-level security and object-level security, not by prompt instructions, which can be bypassed.</p><h3>Prerequisites</h3><ul><li><a href="https://learn.microsoft.com/en-us/fabric/enterprise/fabric-features#features-parity-list">A paid F2 or higher Fabric capacity</a>, or a <a href="https://learn.microsoft.com/en-us/fabric/enterprise/licenses#workspace">Power BI Premium per capacity (P1 or higher)</a> capacity with <a href="https://learn.microsoft.com/en-us/fabric/admin/fabric-switch">Microsoft Fabric enabled</a>.</li><li><a href="https://learn.microsoft.com/en-us/fabric/data-science/data-agent-tenant-settings">Fabric data agent tenant settings</a> is enabled.</li><li><a href="https://learn.microsoft.com/en-us/fabric/data-science/data-agent-tenant-settings">Cross-geo processing for AI</a> is enabled.</li><li><a href="https://learn.microsoft.com/en-us/fabric/data-science/data-agent-tenant-settings">Cross-geo storing for AI</a> is enabled.</li><li>At least one of these, with data: A warehouse, a lakehouse, one or more Power BI semantic models, a KQL database, or an ontology.</li><li><a href="https://learn.microsoft.com/en-us/fabric/data-science/data-agent-tenant-settings">Power BI semantic models via XMLA endpoints tenant switch</a> is enabled for Power BI semantic model data sources.</li><li>For Power BI semantic models used with a data agent, ensure users who interact via the agent have Read permission on the semantic model. Workspace Member or Build permission isn’t required for interaction.</li><li>Developers and end users in Foundry must at least have the AI Developer Role-Based Access Control (RBAC) role.</li></ul><h3>How it works</h3><p>Agent Setup: In Agent Service, create a new agent and add Fabric data agent as one of its knowledge sources.</p><p>To establish this connection, you need the workspace ID and artifact ID for the Fabric data agent. The setup enables your Azure AI agent to evaluate available sources when it receives a query, to ensure that it invokes the correct tool to process the request. Currently, you can only add one Fabric data agent as a knowledge source to your Azure AI agent.</p><h3>Add Fabric data agent to your Azure AI Agent</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VVQRDd9tXFtB5EOejmtq3g.png" /><figcaption>add fabric agent</figcaption></figure><p>Initiate Adding a Knowledge Source: Select the Add button, as shown in the following screenshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8a0xJdlShRHXA-4Sq8cMCQ.png" /></figure><p>This step opens a menu of supported knowledge source types.</p><ul><li>Select Microsoft Fabric as the Source: From the list, choose Microsoft Fabric, as shown in the following screenshot:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1OtQV3EvXMZ0kXEchgfNRA.png" /></figure><p>With this option, your agent can access the Fabric data agent.</p><ul><li>Create a connection: If you previously established a connection to a Fabric data agent, you can reuse that connection for your new Azure AI Agent. Otherwise, select New Connection to create a connection, as shown in the following screenshot:</li></ul><p>The Create a new Microsoft Fabric connection window opens, as shown in the following screenshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oNGX5LTe689id2CiuelmsQ.png" /></figure><p>When you set up the connection, provide the Fabric data agent workspace-id and artifact-id values as custom keys. You can find the workspace-id and artifact-id values in the published Fabric data agent endpoint. Your Fabric data agent endpoint has this format:</p><p><a href="https://fabric.microsoft.com/groups/">https://fabric.microsoft.com/groups/</a>&lt;workspace_id&gt;/aiskills/&lt;artifact-id&gt;, and select the Is Secret checkbox</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v_M6qiV7uQChclxfArnWTw.png" /><figcaption>fabric.microsoft</figcaption></figure><p>Finally, assign a name to your connection, and choose whether to make it available to all projects in Foundry or to restrict it to the current project.</p><p>After you select Connect, the Microsoft Fabric data agent is added as a Knowledge resource.</p><p>You must also provide instructions to your Azure AI agent about when, how, and under what conditions to use the Fabric data agent. From the perspective of the Azure AI agent, the Fabric data agent is treated as a Fabric tool, so you can refer to it as such in your instructions.</p><p>You can also adjust the deployment model, add Actions, or change Model settings based on your use case requirements. Once your Azure AI agent is fully configured, select Try in playground to test its performance.</p><h3>Conclusion</h3><p>Connecting <strong>Microsoft Fabric</strong> with <strong>Azure AI Foundry</strong> unlocks a powerful new paradigm for building intelligent, enterprise-grade AI agents; agents that don’t just generate responses, but <em>reason</em> over governed, reliable, and up-to-date organizational data. By combining Fabric’s unified data lake, semantic models, and security boundaries with Foundry’s agent orchestration, model tooling, and evaluation capabilities, organizations can move beyond isolated LLM experiments toward production-ready AI systems.</p><p><strong><em>Thanks for reading my article and I hope you can take something away.</em></strong></p><p>💯 Don’t forget to <em>follow me on </em><strong><em>medium </em></strong><em>for more</em></p><p>💯 Don’t forget to <em>follow me on </em><a href="https://www.linkedin.com/in/badr-kacimi/"><strong><em>LinkedIn</em></strong></a><strong><em> </em></strong><em>for more</em></p><p>💯 <strong><em>leave some feedback</em></strong></p><p>FURTHER Reading​</p><ul><li><a href="https://learn.microsoft.com/en-us/fabric/data-science/data-agent-foundry">https://learn.microsoft.com/en-us/fabric/data-science/data-agent-foundry</a></li></ul><h3>#<a href="https://mvp.microsoft.com/">MVP Communities — Microsoft</a></h3><h3>That’s all !</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53dfe4702088" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reinforcement Fine-Tuning on Azure AI Foundry: Training Models to Reason Better]]></title>
            <link>https://medium.com/@badrkacimi/reinforcement-fine-tuning-on-azure-ai-foundry-training-models-to-reason-better-bdbd9448ab2e?source=rss-e28ee0b5617c------2</link>
            <guid isPermaLink="false">https://medium.com/p/bdbd9448ab2e</guid>
            <category><![CDATA[fine-tuning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Badr Kacimi]]></dc:creator>
            <pubDate>Sat, 04 Apr 2026 12:54:26 GMT</pubDate>
            <atom:updated>2026-04-04T12:56:50.192Z</atom:updated>
            <content:encoded><![CDATA[<p>Large language models are great at producing fluent text, but real enterprise value often depends on something much harder: <strong>consistent, reliable reasoning</strong>. Whether you’re evaluating financial risk, enforcing internal policies, or navigating complex decision trees, prompting alone is rarely enough.</p><h3>How Fine‑Tuning Helps Create a Strong Foundation LLM</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xSyVwKvqajYGZUcIe87aXw.png" /><figcaption>Foundational model from Microsfot ignite Nov 2025</figcaption></figure><p>Fine‑tuning is what transforms a broadly trained language model into a true foundation LLM that can be reliably used in real systems. While pre‑training gives the model general language understanding, fine‑tuning establishes its behavioral baseline, teaching it how to follow instructions, apply domain knowledge, and respond in consistent, structured ways.</p><p>Instruction fine‑tuning anchors the model in practical tasks and organizational context, while alignment and reinforcement fine‑tuning further refine its judgment by rewarding better reasoning and penalizing incorrect or unsafe behavior. Together, these stages shift the model from simply generating plausible text to making dependable decisions, creating a foundation LLM that is both broadly capable and trustworthy enough to power agents, workflows, and production applications.</p><h3>Why Traditional Fine‑Tuning Isn’t Always Enough</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YJA5V4VT-cZQT1DXrbwW2A.png" /><figcaption>Fine-tuning your model</figcaption></figure><p>Most teams start customization with <strong>Supervised Fine‑Tuning (SFT)</strong>: you provide examples of prompts and ideal responses, and the model learns to imitate them. This works well when:</p><ul><li>Correct answers are clear and unambiguous</li><li>You have high‑quality labeled data</li><li>The task is mostly pattern‑matching</li></ul><p>Standard fine-tuning teaches a model to produce outputs that look like your training examples. Give it enough good examples of customer support responses, and it learns to write like your best support agents. This works well when you can define ‘correct’ by example.</p><h3>Reinforcement Fine-Tuning (RFT)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IwSo2P3At0edmgEqBq7Hzg.png" /></figure><p>Reinforcement Fine-Tuning (RFT) teaches a model to reason correctly toward verifiable outcomes. Instead of ‘here is the right answer, learn to produce something like it,’ RFT says ‘here is a task, here is a reward signal that tells you whether your reasoning worked, now improve.’ This is how OpenAI trained o1 and o3. It is now available for custom models on Azure AI Foundry.</p><p>The result is models that do not just produce better-looking outputs; they reason through problems more rigorously. For domains where there is a verifiable ground truth (math, code, legal compliance, medical diagnosis protocols), RFT produces quality improvements that standard fine-tuning cannot reach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BtZzxFkgO2S-gLyJ6eWmHQ.png" /></figure><blockquote>When to use RFT: Choose RFT when your task has a verifiable correct answer and when standard fine-tuning produces outputs that look right but fail on edge cases or reasoning steps.</blockquote><h3>How does fine-tuning work?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lT-vVJ_zKA9X1Q-zSK8RiA.png" /><figcaption>Fine tuning lifecycle</figcaption></figure><p>In this article, we’ll look at a concrete stories shared at <a href="https://www.youtube.com/watch?v=dXUy9evg1yo&amp;t=1911s"><strong>Microsoft Ignite 2025</strong></a>: a retail assistant that coordinates across a rich catalog of tools, and DocuSign’s contract‑understanding system, which processes more than a million documents every day. Using these examples, we’ll explore how fine‑tuning, synthetic data, and reinforcement fine‑tuning (RFT) transform a general‑purpose language model into a focused, reliable, and accountable agent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZD_6jZ2kTUFmNCDRaFS49w.png" /></figure><h3>1. Teaching the Model to Act, Not Just Answer</h3><p>The top‑left box defines the objective:</p><blockquote>Teach a best‑in‑class model to call the right tools to solve complex business problems.</blockquote><p>This immediately reframes the problem. Instead of optimizing for well‑written responses, the model is optimized for:</p><ul><li>Correct tool selection</li><li>Correct action sequencing</li><li>Correct decisions under constraints</li></ul><h3>2. Model + Technique: GPT‑5 + Reinforcement Fine‑Tuning</h3><p>On the right, the example specifies:</p><ul><li><strong>Model:</strong> GPT‑5</li><li><strong>Technique:</strong> Reinforcement fine‑tuning</li></ul><p>This means GPT‑5 is already a strong reasoning model, but RFT is applied to refine <em>how it behaves as an agent</em>. Rather than learning from static “correct answers,” the model learns from <strong>reward signals</strong> that score its choices, especially tool usage and decision paths.</p><h3>3. Data: Small, High‑Quality Starting Point</h3><p>At the bottom left, the pipeline begins with:</p><blockquote><strong><em>Data: 10 manually curated examples</em></strong></blockquote><p>This is an important insight. RFT does not require massive datasets. Instead, a small set of <strong>high‑signal examples</strong> defines:</p><ul><li>What the available tools are</li><li>When each tool should be used</li><li>What a “good” vs. “bad” outcome looks like</li></ul><p>These examples serve as the initial grounding for the reward function.</p><h3>4. Training: Foundry UI or Python SDK</h3><p>Training is performed using <strong>Azure AI Foundry</strong>, either through:</p><ul><li>The Foundry UI (for experimentation and visibility), or</li><li>The Python SDK (for automation and scale)</li></ul><p>During training:</p><ul><li>The model generates multiple action sequences</li><li>Each sequence is evaluated</li><li>Rewards reinforce correct tool calls and reasoning steps</li></ul><p>The model is <em>not</em> told exactly what to do, it learns what works by feedback.</p><h3>5. Evaluation: Foundry Evals</h3><p>Next comes evaluation using <strong>Foundry evaluations</strong>. This step answers questions like:</p><ul><li>Did the model select the right tool?</li><li>Did it call tools in the correct order?</li><li>Did it avoid unnecessary or risky actions?</li></ul><p>This makes agent behavior measurable and comparable, which is critical for iteration and governance.</p><h3>6. Deployment: DevTier</h3><p>Once the model reaches a satisfactory performance level, it is deployed to a <strong>DevTier environment</strong>. This allows the agent to:</p><ul><li>Run in realistic conditions</li><li>Interact with real (or sandboxed) systems</li><li>Be observed before production rollout</li></ul><p>This step reinforces that RFT‑trained agents are designed for <strong>production workflows</strong>, not demos.</p><h3>7. Continuous Loop: Benchmark, Iterate, Improve</h3><ul><li>New benchmarks are added</li><li>Reward criteria are refined</li><li>The model is re‑trained and re‑evaluated</li></ul><p>This creates a feedback loop where the agent continuously improves its decision quality.</p><h3>The Core Lesson of the Example</h3><p>This demo shows how RFT shifts model training from:</p><ul><li><strong>“Can the model generate a good answer?”</strong><br> to</li><li><strong>“Can the model reliably make the right decisions?”</strong></li></ul><p>By focusing reinforcement signals on tool selection and action quality, GPT‑5 becomes a <strong>controlled, accountable agent</strong> capable of operating inside complex business systems rather than merely describing them.</p><p><strong><em>Thanks for reading my article and I hope you can take something away.</em></strong></p><p>💯 Don’t forget to <em>follow me on </em><strong><em>medium </em></strong><em>for more</em></p><p>💯 Don’t forget to <em>follow me on </em><a href="https://www.linkedin.com/in/badr-kacimi/"><strong><em>LinkedIn</em></strong></a><strong><em> </em></strong><em>for more</em></p><p>💯 <strong><em>leave some feedback</em></strong></p><p>FURTHER Reading​</p><ul><li><a href="https://www.youtube.com/watch?v=dXUy9evg1yo">https://www.youtube.com/watch?v=dXUy9evg1yo</a></li></ul><h3>#<a href="https://mvp.microsoft.com/">MVP Communities — Microsoft</a></h3><h3>That’s all !</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdbd9448ab2e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure API Management as an AI Gateway for Microsoft Foundry: Enterprise Model Governance at Scale]]></title>
            <link>https://medium.com/@badrkacimi/azure-api-management-as-an-ai-gateway-for-microsoft-foundry-enterprise-model-governance-at-scale-64953cbf3da0?source=rss-e28ee0b5617c------2</link>
            <guid isPermaLink="false">https://medium.com/p/64953cbf3da0</guid>
            <category><![CDATA[microsoft-azure]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[microsoft-foundry]]></category>
            <category><![CDATA[apim]]></category>
            <dc:creator><![CDATA[Badr Kacimi]]></dc:creator>
            <pubDate>Fri, 03 Apr 2026 07:41:26 GMT</pubDate>
            <atom:updated>2026-07-01T09:19:28.363Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/0*o8Bxas4hUDJGEqAW.png" /></figure><p>Most organizations adopting Foundry at scale face a common architecture problem: dozens of teams, hundreds of applications, all calling the same model deployments with no centralized control over cost, rate limiting, routing, authentication, or policy enforcement. The result is unpredictable costs, capacity conflicts between teams, and no single place to apply governance policies.</p><p>Azure API Management (APIM) as an AI Gateway solves this. It sits between your applications and your Foundry model deployments as an intelligent proxy enforcing policies, routing traffic, managing costs, and providing unified observability across your entire AI fleet.</p><p>Foundry’s ‘bring your own model’ feature, introduced in late 2025, supports APIM as a first-class gateway for agent workloads.</p><p>In this article we will design the AI gateway architecture, configure APIM for Foundry, implement the key policies, and understand the operational benefits.</p><h3>Why a Central AI Gateway Matters at Scale</h3><p>Without a gateway, the typical enterprise Foundry deployment looks like this: each team manages their own API keys, their own rate limit configurations, their own cost tracking. There is no visibility across teams. When one team’s batch job consumes all the available TPM quota, another team’s production application starts failing.</p><p>The AI gateway pattern centralizes all of this. One entry point, all policy applied there, all traffic visible in one place. It is the same pattern that API management brought to microservices; now applied to AI model access.</p><blockquote>With an AI gateway, you know exactly what every team is spending on AI, you can change routing policies without touching application code.</blockquote><h3>Create an AI Gateway</h3><p>Follow these steps in the Foundry portal to enable AI Gateway for a resource.</p><ol><li>Sign in to <a href="https://ai.azure.com/?cid=learnDocs">Microsoft Foundry</a>. Make sure the New Foundry toggle is on. These steps refer to Foundry (new).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/184/0*VhZZUEZD-vNaKKeY.png" /></figure><ol><li>Select Operate &gt; Admin console.</li><li>Open the AI Gateway tab.</li><li>Select Add AI Gateway.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sr7WQWLUhFsGRYtJU5qPBA.png" /></figure><p>Select the Foundry resource you want to connect with the gateway.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_DQHZjpqcXs8mLq_IJw0UA.png" /></figure><ol><li>Select Create new or Use existing APIM.</li></ol><ul><li>Create new: Creates a Basic v2 SKU instance. Basic v2 is designed for development and testing with SLA support.</li><li>Use existing: Select an instance that meets your organization’s governance and networking requirements.</li></ul><p>or programmatically:</p><p>Create an APIM instance and import your Foundry model endpoints as backend services. APIM uses managed identity to authenticate to Foundry — no API key management required:</p><pre>az apim create \<br>  --name ai-gateway \<br>  --resource-group rg-ai-platform \<br>  --location westeurope \<br>  --sku-name Premium \<br>  --publisher-email platform@contoso.com \<br>  --publisher-name &#39;Contoso AI Platform&#39;<br><br><br># Assign Foundry model access to the APIM managed identity<br>az role assignment create \<br>  --assignee $(az apim show -n ai-gateway -g rg-ai-platform --query identity.principalId -o tsv) \<br>  --role &#39;Cognitive Services OpenAI User&#39; \<br>  --scope /subscriptions/SUB/resourceGroups/RG/providers/Microsoft.CognitiveServices/accounts/FOUNDRY</pre><h3>Implement Cost Control Policies</h3><p>APIM policies are XML configuration applied at the gateway level. This policy enforces per-team token budgets and routes to a cheaper model when the premium quota is exhausted:</p><pre>&lt;policies&gt;<br>  &lt;inbound&gt;<br>    &lt;!-- Identify the calling team from the subscription key --&gt;<br>    &lt;set-variable name=&#39;team-id&#39; value=&#39;@(context.Subscription.Id)&#39; /&gt;<br><br><br>    &lt;!-- Enforce per-team daily token budget --&gt;<br>    &lt;azure-openai-token-limit<br>      counter-key=&#39;@(context.Subscription.Id)&#39;<br>      tokens-per-minute=&#39;50000&#39;<br>      estimate-prompt-tokens=&#39;true&#39;<br>      tokens-consumed-header-name=&#39;x-tokens-used&#39;<br>      remaining-tokens-header-name=&#39;x-tokens-remaining&#39; /&gt;<br><br><br>    &lt;!-- Route to semantic cache first (cost saving) --&gt;<br>    &lt;azure-openai-semantic-cache-lookup<br>      score-threshold=&#39;0.92&#39;<br>      embeddings-backend-id=&#39;embeddings-backend&#39; /&gt;<br>  &lt;/inbound&gt;<br>  &lt;backend&gt;<br>    &lt;!-- Load balance across multiple deployments --&gt;<br>    &lt;azure-openai-load-balance backend-pool-id=&#39;foundry-pool&#39; /&gt;<br>  &lt;/backend&gt;<br>  &lt;outbound&gt;<br>    &lt;!-- Emit token usage to Azure Monitor for cost attribution --&gt;<br>    &lt;emit-metric name=&#39;ai-tokens-consumed&#39;<br>      value=&#39;@(int.Parse(context.Response.Headers[&quot;x-tokens-used&quot;][0]))&#39;&gt;<br>      &lt;dimension name=&#39;team&#39; value=&#39;@((string)context.Variables[&quot;team-id&quot;])&#39; /&gt;<br>      &lt;dimension name=&#39;model&#39; value=&#39;@(context.Request.MatchedParameters[&quot;model&quot;])&#39; /&gt;<br>    &lt;/emit-metric&gt;<br>  &lt;/outbound&gt;<br>&lt;/policies&gt;</pre><h3>Verify the gateway is working</h3><p>Confirm that traffic routes through AI Gateway:</p><ol><li>In the Azure portal, open the API Management instance connected to your Foundry resource.</li><li>Select Monitoring &gt; Metrics. In the Metric dropdown, select Requests. Make a test call to a model deployment in the enabled project, then verify that the request count increments.</li><li>To check detailed logs, select Monitoring &gt; Logs and run a query against the GatewayLogs table. Look for entries with a 200 response code and an API name that matches your AI Gateway.</li><li>If you configured token limits, verify they apply by testing a request that exceeds the limit. The API Management instance returns a 429 Too Many Requests response when the limit is exceeded.</li></ol><h3>Connect Foundry Agent Service to the APIM Gateway</h3><p>The ‘bring your own model’ feature in Foundry Agent Service lets agents call models through APIM rather than directly. This applies all your gateway policies to agent tool calls and model inference giving you the same governance for agentic workloads as for direct API calls:</p><pre># In the Foundry portal: Deployments &gt; New &gt; Bring Your Own Model<br># Or via SDK:<br>from azure.ai.projects.models import ExternalModelDeployment<br><br><br>gateway_deployment = project.deployments.create_external(<br>    ExternalModelDeployment(<br>        name=&quot;gpt4o-via-gateway&quot;,<br>        endpoint_url=os.environ[&quot;APIM_GATEWAY_URL&quot;],<br>        api_key=os.environ[&quot;APIM_SUBSCRIPTION_KEY&quot;],<br>        model_name=&quot;gpt-4o&quot;,<br>        description=&quot;GPT-4o routed through the enterprise AI gateway&quot;<br>    )<br>)</pre><p>Once configured, agents use this deployment exactly like any other, the gateway is transparent to the agent logic. But every call is now subject to your cost control, rate limiting, semantic caching, and audit logging policies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rGI9cil59iPwkH1T9oHFoA.png" /><figcaption><a href="https://www.youtube.com/watch?v=jmPYCxFT6f4">https://www.youtube.com/watch?v=jmPYCxFT6f4</a></figcaption></figure><h3>Conclusion</h3><p>Azure API Management transforms Microsoft Foundry from a collection of model endpoints into a governed, enterprise-scale AI platform. Acting as a centralized AI gateway, APIM enforces cost controls, rate limits, routing, security, and observability across all teams and workloads without changing application or agent code.</p><p><strong><em>Thanks for reading my article and I hope you can take something away.</em></strong></p><p>💯 Don’t forget to <em>follow me on </em><strong><em>medium </em></strong><em>for more</em></p><p>💯 Don’t forget to <em>follow me on </em><a href="https://www.linkedin.com/in/badr-kacimi/"><strong><em>LinkedIn</em></strong></a><strong><em> </em></strong><em>for more</em></p><p>💯 <strong><em>leave some feedback</em></strong></p><p>FURTHER Reading​</p><ul><li><a href="https://learn.microsoft.com/en-us/azure/foundry/configuration/enable-ai-api-management-gateway-portal">https://learn.microsoft.com/en-us/azure/foundry/configuration/enable-ai-api-management-gateway-portal</a></li></ul><h3>#<a href="https://mvp.microsoft.com/">MVP Communities — Microsoft</a></h3><h3>That’s all !</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64953cbf3da0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Foundry Local: Running Microsoft AI Models at the Edge and On-Device]]></title>
            <link>https://medium.com/@badrkacimi/foundry-local-running-microsoft-ai-models-at-the-edge-and-on-device-57d4ef176c3c?source=rss-e28ee0b5617c------2</link>
            <guid isPermaLink="false">https://medium.com/p/57d4ef176c3c</guid>
            <category><![CDATA[microsoft-foundry]]></category>
            <category><![CDATA[local-llm]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Badr Kacimi]]></dc:creator>
            <pubDate>Wed, 01 Apr 2026 23:48:38 GMT</pubDate>
            <atom:updated>2026-04-01T23:48:38.537Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BIssvfQQGPTphwtb.png" /></figure><p>The assumption behind most AI architecture is that the model lives in the cloud. You send a request, the cloud sends a response, and the only questions are about latency, cost, and security in transit. That assumption breaks in a surprising number of real enterprise scenarios.</p><p>A hospital emergency department where connectivity drops during network incidents. A manufacturing plant floor where millisecond latency matters and cloud round-trips are unacceptable. A government facility where data cannot leave a controlled environment for regulatory reasons. A field service technician with a tablet in an area with no cellular coverage.</p><p>Foundry Local is Microsoft’s answer to all of these. It brings the same models, the same APIs, and the same governance model from Azure AI Foundry to on-device and edge environments; running fully locally, with Azure-consistent operations, and the ability to sync with the cloud when connectivity is available.</p><h3>Architecture: How Foundry Local Fits in the Foundry Ecosystem</h3><p>Foundry Local is not a separate product. It is a deployment target within the Foundry ecosystem. You define your agent and its configuration in Azure AI Foundry; the same project, the same SDK, the same governance policies. You then deploy that configuration to Foundry Local, which runs the model on local hardware.</p><p>The model runs via ONNX Runtime, optimized for the target hardware, CPU, NVIDIA GPU, Intel NPU, Qualcomm NPU on supported Copilot+ PCs. The inference is local. The API surface is identical to the Azure endpoint. Your application code does not change.</p><blockquote>Key architecture decision: Foundry Local is for inference, not training. You train and fine-tune models in Azure, then deploy the optimized model artifact to Foundry Local for local execution. The cloud remains the control plane; the edge is the execution plane.</blockquote><h3>When to Use Foundry Local</h3><p>Foundry Local is ideal when you need to:</p><ul><li>Keep sensitive data on your device</li><li>Operate in limited or offline environments</li><li>Reduce cloud inference costs</li><li>Get low latency AI responses for real-time applications</li><li>Transcribe audio on-device for privacy-sensitive applications (for example, voice journals, meeting notes, medical dictation)</li><li>Build apps that combine speech-to-text and text generation in a single pipeline</li><li>Experiment with AI models before you deploy to the cloud</li></ul><h3>Install Foundry Local:</h3><ul><li>macOS: Open a terminal and run the following command.</li></ul><pre>brew tap microsoft/foundrylocal <br>brew install foundrylocal</pre><blockquote><em>Note: You need the </em><em>homebrew package manager for macOS installed.</em></blockquote><ul><li>Alternatively, you can download the installer from the <a href="https://aka.ms/foundry-local-installer">Foundry Local GitHub repository</a>.</li><li>Verify the installation. Run:</li></ul><pre>foundry --version</pre><p>You should see the installed version number.</p><ul><li>Run your first model. Open a terminal and run this command:</li></ul><pre>foundry model run qwen2.5-0.5b</pre><ul><li>Foundry Local downloads the model, which can take a few minutes depending on your internet speed, then runs it. After the model starts, interact with it by using the command-line interface (CLI). For example, you can ask:You see a response from the model in the terminal:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eZHeJAuE-F3bpOZQ.png" /><figcaption><a href="https://blog.colbyford.com/">https://blog.colbyford.com/</a></figcaption></figure><h3>The Sovereignty Connection</h3><p>Foundry Local is not just a convenience feature for offline scenarios. It is a sovereignty tool. For organizations operating under the EU AI Act, GDPR, national security regulations, or sector-specific data laws, the ability to run AI with complete data locality; no bytes leave your controlled environment changes what is legally possible to build.</p><p><strong><em>Thanks for reading my article and I hope you can take something away.</em></strong></p><p>💯 Don’t forget to <em>follow me on </em><strong><em>medium </em></strong><em>for more</em></p><p>💯 Don’t forget to <em>follow me on </em><a href="https://www.linkedin.com/in/badr-kacimi/"><strong><em>LinkedIn</em></strong></a><strong><em> </em></strong><em>for more</em></p><p>💯 <strong><em>leave some feedback</em></strong></p><p>FURTHER Reading​</p><ul><li><a href="https://learn.microsoft.com/en-us/azure/foundry-local/get-started">https://learn.microsoft.com/en-us/azure/foundry-local/get-started</a></li></ul><h3>#<a href="https://mvp.microsoft.com/">MVP Communities — Microsoft</a></h3><h3>That’s all !</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57d4ef176c3c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microsoft AI Tour Brussels 2026: Frontier Transformation and the Sovereignty Question]]></title>
            <link>https://medium.com/@badrkacimi/what-i-learned-at-microsoft-ai-tour-brussels-2026-frontier-transformation-and-the-sovereignty-5f6bcfe6e8b9?source=rss-e28ee0b5617c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f6bcfe6e8b9</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[brussels]]></category>
            <dc:creator><![CDATA[Badr Kacimi]]></dc:creator>
            <pubDate>Wed, 01 Apr 2026 23:21:50 GMT</pubDate>
            <atom:updated>2026-06-24T19:33:58.127Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*b3a9IS2DL8rwfgz9" /></figure><p>I walked into Brussels Expo on March 26 not entirely sure what to expect. I had been building on Azure AI Foundry for over a year at that point, writing about it, experimenting with every new feature as it dropped.</p><p>I thought I had a reasonable picture of where Microsoft was heading. The AI Tour gave me a better one, and it reframed a few things I thought I understood.</p><p>The day was built around one central idea that Microsoft has been sharpening for a while: the Frontier Firm. Not a company that is experimenting with AI, not one that has deployed a chatbot. A company that has fundamentally reorganized around AI as operating infrastructure; the same way organizations reorganized around the internet in the 2000s. The question on the table all day, in different forms, was: what does that transformation actually require?</p><p>What I did not expect was how much of the day was shaped by a second question, one that felt more urgent in Brussels than it might in other cities: who controls the AI that runs your organization? That is the sovereignty question. And in Europe, in 2026, it is not theoretical.</p><h3>The Keynote: Frontier Transformation</h3><p>Marijke Schroos, General Manager for Belgium and Luxembourg at Microsoft, opened with a framework I found useful. The Frontier Transformation model breaks down AI adoption into three stages that most organizations move through:</p><ul><li>Efficiency: Using AI to do existing work faster. Copilot drafting emails, summarizing meetings, generating first drafts. This is where most organizations start, and where most of them stay.</li><li>Transformation: Redesigning workflows around AI capabilities rather than augmenting existing ones. The process changes, not just the tools. This is where the real productivity gains live and where most organizations get stuck.</li><li>Frontier: AI as a capability layer embedded across the entire operating model. Agents running autonomously across departments. Decisions informed by AI in real time. The organization is effectively a different kind of institution than it was before.</li></ul><p>What struck me about this framework is how it named the difficulty of the transition from efficiency to transformation. The technology is rarely the bottleneck. The bottleneck is the organizational will to redesign how work gets done, not just add AI to how it already gets done. Marijke put it plainly: the companies that stay at the efficiency stage</p><p>will be outcompeted by the ones that reach transformation. The ones that reach transformation will be outcompeted by the ones that reach frontier.</p><blockquote>The talk that resonated most with me: ‘Frontier firms are not adopting AI. They are becoming AI-native. That is a different level of commitment and a different level of return.’</blockquote><h3>The Session That Reframed Everything: AI Sovereignty</h3><p>For European organizations, AI sovereignty is no longer a compliance topic. It is a strategic one.</p><p>The core of the sovereignty conversation was this: organizations are now asking three questions about their AI that they were not asking two years ago. First, where does my data go, and who can access it? Second, what happens to my AI systems if geopolitical conditions change, connectivity is disrupted, or supply chain dependencies fail? Third, how do I adopt frontier AI without ceding control of the decisions that matter most to my organization?</p><p>These are not abstract concerns. In the room were IT leaders from regulated industries financial services, healthcare, public sector for whom the answers to these questions directly determine what they can build and what they can deploy. The conversation was different from a typical developer conference. It was sharper. More uncomfortable. More honest about the real constraints.</p><p>Microsoft’s answer to the sovereignty question has three pillars, and I think it is worth laying them out clearly because they map directly to how Foundry is architected for European enterprise:</p><ul><li>Data residency: All data processed in your Foundry project stays in your chosen Azure region. For Belgium and Luxembourg organizations, that means the EU data boundary; no data leaves the European Economic Area. This is enforced at the infrastructure level, not just by policy.</li><li>Operational continuity: Foundry Local, Microsoft’s on-device and edge AI deployment model, is the answer to the connectivity-disruption question. If your AI needs to keep running when the internet is constrained in a hospital, on a factory floor, in a government facility Foundry Local gives you the model running on-premises with Azure-consistent governance.</li></ul><h3>The Hands-On Sessions: From Experience to Direct Product Feedback</h3><p>The developer and technical tracks at the AI Tour went beyond demos for me, they became an opportunity to engage directly with Microsoft on the evolution of the platform.</p><p>One of the most valuable moments was connecting with Microsoft people on-site about <strong>Azure AI Foundry especially Foundry IQ</strong>. I had the chance to share my hands-on feedback from real-world usage, and it was encouraging to see how open and receptive they were to it. The discussion wasn’t just surface-level, they genuinely appreciated the input, particularly around how these tools are being used outside controlled demo environments.</p><p>The session explaining Foundry’s place in the <strong>agentic ecosystem</strong> was one of the clearest I’ve seen. The positioning between <strong>Foundry, Copilot Studio, and Microsoft 365 Copilot</strong> is strong but from experience, this is still an area where customers can hit friction.</p><p>In my feedback, I emphasized that beyond the mental model, there’s still a need for:</p><ul><li>clearer guidance when designing <strong>multi-agent architectures</strong></li><li>stronger integration patterns across tools</li><li>better alignment when moving from prototyping to production</li></ul><p>This became even more relevant when discussing <strong>Agent-to-Agent (A2A) communication and MCP integration</strong>. While the vision is compelling, I shared that I’ve encountered bottlenecks in practice — particularly when coordinating agents across systems or ensuring smooth orchestration with MCP servers.</p><p>These challenges don’t block progress, but they highlight an important gap:</p><ul><li>the ecosystem is powerful, but <strong>interoperability and orchestration patterns still need to mature</strong> for real-world, large-scale deployments.</li></ul><p>On Foundry IQ specifically, the demo was impressive — compressing a full RAG pipeline into a minimal amount of code is a huge step forward. But in my discussion with Microsoft, I stressed a key point:</p><p>From hands-on experience, I sometimes hit limits when:</p><ul><li>needing deeper control over retrieval and ranking behavior</li><li>debugging results across the pipeline</li><li>integrating IQ into more complex agent-driven architectures</li></ul><p>This is where I see the next evolution of Foundry IQ: enabling developers to <strong>go deeper when needed</strong>, without losing the simplicity that makes it so powerful.</p><p>Overall, what stood out most was not just the technology, but the openness to feedback. These conversations reinforced that Microsoft is actively shaping Foundry with input from practitioners, and that direct engagement can genuinely influence how the platform evolves.</p><h3>What I Am Taking Back to My Work</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8vOyl-034qg5ngsJ" /></figure><p>I left the AI Tour with three things:</p><p>First: the Frontier Firm framework is useful as a diagnostic tool. When I am writing about Foundry features, I want to be explicit about which stage of maturity they are designed to support. MCP servers and A2A protocol are frontier-level infrastructure. Prompt Flow and content safety are transformation-level enablers. The distinction helps readers understand where they are and what they need to build next.</p><p>Second: sovereignty is not a European-only concern, but it is most acute in Europe right now.</p><p>Third: the gap between ‘deployed an AI feature’ and ‘built an AI-native organization’ is much larger than most technical practitioners acknowledge.</p><p>The Microsoft AI Tour is worth attending if you get the chance. Not for the demos you can see those online. For the conversations in the hallways and the breakout rooms, where the real constraints surface. Brussels delivered on that.</p><p><strong><em>Thanks for reading my article and I hope you can take something away.</em></strong></p><p>💯 Don’t forget to <em>follow me on </em><strong><em>medium </em></strong><em>for more</em></p><p>💯 Don’t forget to <em>follow me on </em><a href="https://www.linkedin.com/in/badr-kacimi/"><strong><em>LinkedIn</em></strong></a><strong><em> </em></strong><em>for more</em></p><p>💯 <strong><em>leave some feedback</em></strong></p><p>FURTHER Reading​</p><ul><li><a href="https://aitour.microsoft.com/flow/microsoft/brussels26/landingpage/page/cityhome">https://aitour.microsoft.com/flow/microsoft/brussels26</a></li></ul><h3>#<a href="https://mvp.microsoft.com/">MVP Communities — Microsoft</a></h3><h3>That’s all !</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f6bcfe6e8b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fixing the Last Mile of RAG with Cohere Rerank v4.0 on Microsoft Foundry]]></title>
            <link>https://medium.com/@badrkacimi/fixing-the-last-mile-of-rag-with-cohere-rerank-v4-0-on-microsoft-foundry-6deece733a2e?source=rss-e28ee0b5617c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6deece733a2e</guid>
            <category><![CDATA[cohere]]></category>
            <category><![CDATA[reranking]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Badr Kacimi]]></dc:creator>
            <pubDate>Tue, 24 Mar 2026 10:27:14 GMT</pubDate>
            <atom:updated>2026-03-24T10:27:14.145Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QGIZ-pLMt--iqD2K.png" /></figure><p>Your RAG pipeline retrieves ten chunks. Seven are relevant. Three are noise. The language model reads all ten, weighs them equally, and occasionally hallucinates from the noisy three instead of answering from the solid seven.</p><p>This is the last-mile retrieval problem. Vector similarity gets you in the right neighborhood, but it does not guarantee the right documents come first. The solution is reranking: a second-pass model that reads both the query and each retrieved chunk and scores how well each chunk actually answers the question; not just how similar the embeddings are.</p><p>Cohere Rerank v4.0 is available in the Foundry model catalog as a serverless endpoint, uses cross-encoding AI for semantic relevance scoring, and drops into your existing RAG pipeline with minimal code changes. In this article, we will build a RAG pipeline with reranking and measure the quality improvement.</p><h3>Why Reranking Works: Embedding Similarity vs Semantic Relevance</h3><p>Embedding similarity measures cosine distance between vector representations. It is fast and scales well, but it has a fundamental limitation: the embedding model was trained to capture general semantic meaning, not to judge whether a specific passage answers a specific question.</p><p>Reranking uses a cross-encoder; a model that reads the query and each document together (not separately) and scores relevance on a 0–1 scale. Cross-encoders are slower and cannot scale to thousands of documents, but they are far more accurate at judging relevance for a specific query. The pattern is:</p><ul><li>First pass: Retrieve top-50 candidates using vector similarity.</li><li>Second pass: Rerank the top-50 with Cohere Rerank, select top-5.</li><li>Generation: Pass the reranked top-5 to the LLM (higher quality context, lower token cost)</li></ul><h3>Step 1: Deploy Cohere Rerank v4.0 in Foundry</h3><p>In the Foundry portal, navigate to the Model Catalog and search for ‘Cohere Rerank’. Deploy Rerank v4.0 Fast or Pro to a serverless endpoint. Copy the endpoint URL and key; you will use them directly in the Cohere client.</p><pre>pip install cohere azure-search-documents azure-ai-projects azure-identity</pre><h3>Step 2: Build the Retrieval Layer with Azure AI Search</h3><p>Set up a standard hybrid search retrieval function (vector + keyword).</p><p>This is your first pass, retrieve broadly:</p><pre>from azure.search.documents import SearchClient<br>Set up a standard hybrid search retrieval function (vector + keyword). This is your first pass — retrieve broadly:<br>from azure.search.documents import SearchClient<br>from azure.search.documents.models import VectorizedQuery<br>from azure.core.credentials import AzureKeyCredential<br>from azure.ai.projects import AIProjectClient<br>from azure.identity import DefaultAzureCredential<br><br><br>project = AIProjectClient(<br>    endpoint=os.environ[&quot;FOUNDRY_PROJECT_ENDPOINT&quot;],<br>    credential=DefaultAzureCredential()<br>)<br>oai = project.get_openai_client(api_version=&#39;2024-10-21&#39;)<br><br><br>search_client = SearchClient(<br>    endpoint=os.environ[&quot;SEARCH_ENDPOINT&quot;],<br>    index_name=&quot;docs-index&quot;,<br>    credential=AzureKeyCredential(os.environ[&quot;SEARCH_KEY&quot;])<br>)<br><br><br>def retrieve_candidates(query: str, top_k: int = 25):<br>    embedding = oai.embeddings.create(<br>        input=query, model=&quot;text-embedding-3-large&quot;<br>    ).data[0].embedding<br><br><br>    results = search_client.search(<br>        search_text=query,<br>        vector_queries=[VectorizedQuery(<br>            vector=embedding, k_nearest_neighbors=top_k,<br>            fields=&quot;content_vector&quot;<br>        )],<br>        top=top_k,<br>        select=[&quot;id&quot;, &quot;content&quot;, &quot;source&quot;]<br>    )<br>    return [{&#39;id&#39;: r[&#39;id&#39;], &#39;text&#39;: r[&#39;content&#39;], &#39;source&#39;: r.get(&#39;source&#39;, &#39;&#39;)} for r in results]</pre><h3>Step 3: Rerank with Cohere Rerank v4.0</h3><p>Pass the retrieved candidates through Cohere Rerank.</p><p>The model reads query + document pairs and returns relevance scores:</p><pre>import cohere<br><br><br>co = cohere.Client(<br>    api_key=os.environ[&quot;COHERE_API_KEY&quot;],<br>    base_url=os.environ[&quot;COHERE_RERANK_ENDPOINT&quot;]  # Your Foundry serverless endpoint<br>)<br><br><br>def rerank(query: str, candidates: list, top_n: int = 5):<br>    response = co.rerank(<br>        model=&quot;rerank-v4.0&quot;,<br>        query=query,<br>        documents=[c[&quot;text&quot;] for c in candidates],<br>        top_n=top_n,<br>        return_documents=True<br>    )<br>    reranked = []<br>    for r in response.results:<br>        original = candidates[r.index]<br>        reranked.append({<br>            &#39;text&#39;: original[&#39;text&#39;],<br>            &#39;source&#39;: original[&#39;source&#39;],<br>            &#39;relevance_score&#39;: r.relevance_score,<br>            &#39;original_rank&#39;: r.index<br>        })<br>    return reranked</pre><h3>Step 4: Wire Retrieval + Reranking + Generation</h3><pre>def answer_with_reranking(query: str):<br>    # First pass: retrieve 25 candidates<br>    candidates = retrieve_candidates(query, top_k=25)<br><br><br>    # Second pass: rerank, keep top 5<br>    top_chunks = rerank(query, candidates, top_n=5)<br><br><br>    # Log reranking effect for observability<br>    for i, chunk in enumerate(top_chunks):<br>        print(f&#39;Rank {i+1} (was #{chunk[&quot;original_rank&quot;]+1}) | Score: {chunk[&quot;relevance_score&quot;]:.3f}&#39;)<br><br><br>    # Generate grounded answer<br>    context = &quot;\n\n---\n\n&quot;.join(c[&quot;text&quot;] for c in top_chunks)<br>    response = oai.chat.completions.create(<br>        model=&quot;gpt-4o&quot;,<br>        messages=[<br>            {&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: f&quot;Answer only using the context below.\n\n{context}&quot;},<br>            {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: query}<br>        ]<br>    )<br>    return response.choices[0].message.content</pre><h3>Measuring the Quality Improvement</h3><p>The real impact of reranking shows up in your Groundedness evaluation scores. After adding Cohere Rerank to a typical RAG pipeline, expect:</p><ul><li>Groundedness score: <a href="https://www.chat-data.com/blog/advanced-rag-implementation-enterprise-chatbots">+0.3 to +0.6</a> points on a 5-point scale (based on typical enterprise RAG benchmarks)</li><li>Token cost reduction: <a href="https://www.chat-data.com/blog/advanced-rag-implementation-enterprise-chatbots">50–70%</a> fewer tokens passed to the LLM (5 chunks instead of 25)</li><li>Answer precision: Fewer hallucinations from off-topic chunks contaminating context</li></ul><p>The latency cost is typically 150–300ms for the reranking call. For most production applications, this trade-off is very favorable — better quality answers with lower LLM cost, at the price of a sub-second extra step.</p><blockquote>Run a Foundry evaluation before and after adding reranking. Use the same evaluation dataset and track Groundedness, Relevance, and Coherence. The numbers will tell you exactly how much improvement you get for your specific domain; do not rely on generic benchmarks for your production decision.</blockquote><p><strong><em>Thanks for reading my article and I hope you can take something away.</em></strong></p><p>💯 Don’t forget to <em>follow me on </em><strong><em>medium </em></strong><em>for more</em></p><p>💯 Don’t forget to <em>follow me on </em><a href="https://www.linkedin.com/in/badr-kacimi/"><strong><em>LinkedIn</em></strong></a><strong><em> </em></strong><em>for more</em></p><p>💯 <strong><em>leave some feedback</em></strong></p><p>FURTHER Reading​</p><ul><li><a href="https://docs.cohere.com/docs/rerank">https://docs.cohere.com/docs/rerank</a></li></ul><h3>#<a href="https://mvp.microsoft.com/">MVP Communities — Microsoft</a></h3><h3>That’s all !</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6deece733a2e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>