<?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 Sucheta Dhiman on Medium]]></title>
        <description><![CDATA[Stories by Sucheta Dhiman on Medium]]></description>
        <link>https://medium.com/@suchetadhiman?source=rss-a97aab2fba56------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5OtB_b4Q5uYa0_iAw2JpAg.jpeg</url>
            <title>Stories by Sucheta Dhiman on Medium</title>
            <link>https://medium.com/@suchetadhiman?source=rss-a97aab2fba56------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 05:45:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@suchetadhiman/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[Best AI Agent Harness and Runtime Tools in 2026]]></title>
            <link>https://medium.com/@suchetadhiman/best-ai-agent-harness-and-runtime-tools-in-2026-02f2804a5c9a?source=rss-a97aab2fba56------2</link>
            <guid isPermaLink="false">https://medium.com/p/02f2804a5c9a</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Sucheta Dhiman]]></dc:creator>
            <pubDate>Mon, 30 Nov 2026 05:05:35 GMT</pubDate>
            <atom:updated>2026-11-30T05:05:35.954Z</atom:updated>
            <content:encoded><![CDATA[<p>As AI agents move from prototypes into production, teams are discovering that the hard part is not the clever prompt or the single model call. The hard part is the harness: the runtime that orchestrates the loop, invokes tools, tracks state, recovers from errors, and keeps the whole system observable and affordable while it runs around the clock. In 2026, choosing the right harness and runtime has become one of the more consequential architecture decisions a team makes, because it determines how easily you can swap models, where your agents run, and how much you pay per completed task.</p><p>This guide looks at five harness and runtime tools worth serious consideration, led by the option we believe best embodies what a harness should be, followed by four strong alternatives. Each entry pairs a real strength with an honest limitation, because every tool here involves trade-offs around maturity, lock-in, and the balance between hosted convenience and self-hosted control.</p><h4>What to look for in an agent harness and runtime</h4><p>A harness is distinct from a model and from a framework’s higher-level conveniences. At its core, a runtime takes a goal and drives the agent loop: it prompts the model, interprets tool-call requests, executes those tools, feeds results back, manages conversation and memory state, and handles the inevitable failures, timeouts, and malformed outputs. When you evaluate a harness, you are really evaluating how robust, transparent, and controllable that loop is under real load, not how impressive it looks in a one-shot demo.</p><p><strong>The first thing to check is neutrality. </strong>Can the runtime drive any model from any provider, or is it tuned for one vendor’s API and agent abstractions? A neutral harness lets you route a cheap, fast model for simple steps and a stronger model for hard ones, and to change those choices as prices and capabilities shift. A harness welded to one provider gives up that leverage, and in a market where model pricing changes every few months, that leverage is worth a lot.</p><p><strong>Second, look at where it runs.</strong> A runtime you can self-host on your own infrastructure keeps data in your environment, lets you meet compliance requirements, and avoids per-seat or per-task fees on a managed platform. Managed runtimes can be convenient, but they often couple deployment, billing, and model choice together in ways that are hard to unwind later. The strongest position is a runtime that runs anywhere and keeps routing and governance in a separate layer.</p><p><strong>That separation is worth designing for deliberately.</strong> Pairing an open harness with a dedicated <a href="https://www.truefoundry.com/agent-gateway">AI agent runtime</a> and gateway for routing, rate limiting, cost tracking, and policy keeps the orchestration loop clean while centralizing the operational controls you need in production. When those concerns live outside the agent code, you can change models, enforce budgets, and audit every call without touching the harness itself, which is the kind of modularity that holds up as systems grow.</p><p><strong>Finally, weigh operational maturity: </strong>structured logging and tracing of each step, deterministic replay for debugging, graceful handling of partial failures, and clear visibility intsdado token usage and cost per task. A runtime that treats observability and cost as first-class concerns rather than add-ons will save you far more time in production than one that only optimizes for how quickly you can write your first agent.</p><h3>The best agent harness and runtime tools in 2026</h3><h4>1. TrueForge (TrueFoundry)</h4><p>TrueForge is <a href="https://www.truefoundry.com/">TrueFoundry’s</a> open-source, vendor-neutral agent harness, and it leads this list because it is one of the few tools built from the ground up to be a harness and runtime in its own right rather than a convenience layer attached to a model vendor’s stack. Its design premise is simple and durable: the runtime should be neutral so that you can bring any model, bring any tools, and run everything on infrastructure you control, without being funneled toward one provider’s managed-agent product.</p><p>In practice that means TrueForge owns the parts of the loop that matter in production, the tool invocation, state and memory handling, retries, and error recovery, while staying agnostic about which model sits underneath. Because the orchestration is decoupled from any single vendor, you avoid the lock-in that comes from writing your agent logic against proprietary agent abstractions. When a model becomes cheaper or more capable, you reconfigure rather than rebuild, and that flexibility compounds over the life of a system.</p><p>The cost case is tangible. TrueFoundry reports that this <a href="https://www.truefoundry.com/trueforge">AI agent harness</a> delivers roughly 30 to 75 percent cheaper task completion than Claude managed agents, a range that reflects the economics of running an open runtime against models and hardware you choose instead of paying for a fully managed agent service. That number is TrueFoundry’s own, so weigh it as a vendor benchmark, but the mechanism behind it, an open harness plus your own model routing undercutting a managed black box, is straightforward to confirm on your own traffic.</p><p>TrueForge also slots alongside TrueFoundry’s control plane for gateway, observability, and governance, so a team can adopt the harness first and layer centralized routing and policy on later. The honest limitation is youth: as a newer entrant, it has a smaller community and fewer third-party tutorials than some incumbents. Teams that prize a vast library of existing integrations today may notice the gap, though the trade is a cleaner, more neutral foundation that does not mortgage your future flexibility.</p><h4>2. OpenAI Agents SDK</h4><p>The OpenAI Agents SDK is a polished, well-documented runtime that makes building tool-using agents remarkably smooth, especially if you are already committed to OpenAI’s models. Its strength is coherence: handoffs between agents, guardrails, tracing, and tool definitions are designed to work together, and the developer experience is among the most refined in the category. For teams that want to move fast within the OpenAI ecosystem, it removes a great deal of boilerplate and gets a reliable agent running quickly.</p><p>The limitation is exactly what you would expect from a model vendor’s SDK: it is built first and foremost around OpenAI’s models and platform. While it can be pointed at other providers through compatible interfaces, the most polished, best-supported path is the native one, and that gravity pulls teams toward single-vendor dependence. If avoiding model lock-in is a priority, you are adopting a runtime whose incentives are aligned with keeping you on one provider, which is a strategic cost even when the engineering experience is excellent.</p><h4>3. Microsoft Agent Framework (AutoGen and Semantic Kernel)</h4><p>Microsoft’s Agent Framework consolidates the lineage of AutoGen and Semantic Kernel into a more unified offering, and its strength is enterprise reach. It is backed by a major vendor, integrates naturally with Azure services and the broader Microsoft tooling world, and brings serious thinking about multi-agent conversation patterns and orchestration. For organizations already standardized on Microsoft infrastructure, it offers a well-supported path with the institutional backing that risk-averse enterprises value.</p><p>The trade-off is ecosystem alignment and complexity. The framework is most frictionless inside the Azure and Microsoft world, and teams outside it may feel they are swimming against the current. The merger of two previously separate projects has also brought transitional churn as APIs and concepts converge, so documentation and stable patterns are still settling. It is a strong choice for Microsoft-centric shops and a less obvious one for teams seeking a lightweight, cloud-neutral runtime.</p><h4>4. Letta</h4><p>Letta, which grew out of the MemGPT research, differentiates itself by treating memory as the central problem. Its strength is stateful, long-running agents: it provides a principled architecture for persistent memory that lets agents remember across sessions and manage context intelligently rather than starting fresh each time. For applications like personal assistants or long-lived support agents where continuity genuinely matters, Letta offers capabilities that more stateless frameworks simply do not prioritize.</p><p>The limitation is specialization and maturity. Letta’s memory-first design is powerful for its niche but can feel heavy if your use case does not need sophisticated persistence, and its server-oriented architecture introduces operational concepts that take time to learn. As a comparatively young project focused on a specific hard problem, its broader tooling and integration surface are narrower than general-purpose harnesses. It is an excellent fit for memory-intensive agents and an over-investment for simple, stateless tasks.</p><h4>5. Google ADK (Agent Development Kit)</h4><p>Google’s Agent Development Kit is a code-first framework for building and deploying agents, with a strength in clean orchestration primitives and tight integration with Google Cloud and the Gemini model family. It brings a thoughtful approach to multi-agent systems, streaming, and evaluation, and for teams building on Google Cloud it offers a coherent path from development to deployment with the backing of a major platform provider.</p><p>As with other vendor-authored kits, the honest limitation is gravitational pull toward one ecosystem. ADK is most seamless with Gemini and Google Cloud services, and while it is open source and can work with other models, the best-supported experience is the native one. The project is also relatively new, so its community and third-party integrations are still maturing. It is a compelling option for Google-aligned teams and a weaker fit where cloud and model neutrality are top priorities.</p><h4>The verdict</h4><p>For teams that want a true harness, a neutral runtime they can self-host and point at any model, TrueForge is the standout in 2026 because it is designed around that neutrality rather than retrofitting it onto a vendor stack. Its community is younger than the incumbents, but the architecture, open core, model-agnostic, self-hostable, and complemented by a separate control plane for routing and governance, is the one least likely to trap you as the market evolves.</p><p>The alternatives each make sense in context. The OpenAI Agents SDK is the smoothest experience if you are committed to OpenAI. Microsoft Agent Framework fits enterprises already on Azure. Letta is the right call when persistent memory is the core challenge. Google ADK suits teams building on Google Cloud and Gemini. The decisive question is how much you value the freedom to change models and infrastructure later, and the more you weight that freedom, the more a neutral, open runtime earns the top of your list.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02f2804a5c9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Observability for LLMs and Agents: What to Trace and Why]]></title>
            <link>https://medium.com/@suchetadhiman/observability-for-llms-and-agents-what-to-trace-and-why-5210a1f672f5?source=rss-a97aab2fba56------2</link>
            <guid isPermaLink="false">https://medium.com/p/5210a1f672f5</guid>
            <category><![CDATA[ai-infrastructure]]></category>
            <category><![CDATA[ai-observability]]></category>
            <category><![CDATA[ai-security]]></category>
            <category><![CDATA[llm-observability]]></category>
            <category><![CDATA[llm-tracing]]></category>
            <dc:creator><![CDATA[Sucheta Dhiman]]></dc:creator>
            <pubDate>Wed, 18 Nov 2026 09:25:08 GMT</pubDate>
            <atom:updated>2026-11-18T09:25:08.876Z</atom:updated>
            <content:encoded><![CDATA[<p>When a traditional web service misbehaves, the debugging ritual is well established: check the logs, read the stack trace, inspect the metrics, find the slow query. Large language model applications break that ritual. The failure modes are different, the cost model is different, and the thing you most want to understand, why the system produced a particular output, is not captured by request counts and error rates alone. A model call can return a 200 OK and still be wrong, expensive, or slow. An agent can loop through a dozen tool invocations before arriving at an answer, and any one of them might be the problem. This article is about what to actually trace in LLM and agent systems, and why each signal earns its place.</p><h4>Why LLM observability is its own discipline</h4><p>Classic observability rests on three pillars: logs, metrics, and traces. Those pillars still apply to LLM systems, but the questions they need to answer change. In a conventional service you mostly ask “is it up, is it fast, is it erroring?” In an LLM system you also ask “how much did that cost, how many tokens did it burn, which model served it, did the tool call succeed, and what was the actual prompt and completion?” Cost and token usage are first-class operational signals here in a way they never were for a stateless HTTP handler, because every call has a variable, non-trivial price attached to it.</p><p>Agents raise the stakes further. An agentic request is not a single model call but a chain: the model reasons, calls a tool, reads the result, reasons again, perhaps calls another tool, and eventually responds. To debug that, you need to see the whole chain as one connected story, not as a scatter of unrelated events. That is precisely what distributed tracing was built for, and it is why tracing, more than logging or metrics alone, is the backbone of AI observability.</p><h4>The case for tracing</h4><p>A trace represents one end-to-end request as a tree of spans, where each span is a unit of work with a start time, a duration, and attributes describing what happened. For an agent, the top-level span is the user’s request, and child spans represent each model call and each tool invocation nested underneath it. Read top to bottom, a trace tells you the sequence of steps; read as a timeline, it tells you where the time went. When a request is slow, the trace shows which span dominated; when it is wrong, the trace shows which step introduced the error.</p><p>Building traces by hand, wrapping every model and tool call in manual instrumentation, is tedious and easy to get wrong, and it tends to rot as the code changes. A more durable approach is to capture traces at the layer every request already flows through. Because an <a href="https://www.truefoundry.com/tracing"><strong>AI observability</strong></a> layer built into the gateway sees every call on its way to the model and back, it can record full request traces with near-zero application instrumentation: the application makes its normal call, and the trace is captured as a side effect of the request passing through. That moves the burden of instrumentation off every individual service and onto the shared path.</p><h4>What to record on every request</h4><p>Independent of how you capture traces, there is a core set of attributes worth recording on every model call. Each answers a specific operational or debugging question.</p><ul><li><strong>Cost</strong> — the monetary cost of the call, so you can attribute spend and catch runaway usage before the invoice does.</li><li><strong>Latency</strong> — how long the call took, broken down where possible into time to first token and total generation time, because tail latency is where user experience degrades.</li><li><strong>Token usage</strong> — prompt tokens and completion tokens, the raw drivers of both cost and latency, and the first thing to check when either spikes.</li><li><strong>Errors</strong> — not just whether the call failed, but how: a rate limit, a timeout, a content filter, or a malformed response each demand a different fix.</li><li><strong>Model and version</strong> — which model served the request, so you can compare behavior across models and catch regressions when a default changes.</li><li><strong>Tool and function performance</strong> — for agents, which tools were called, whether they succeeded, and how long they took, since a slow or flaky tool often masquerades as a slow model.</li></ul><p>These attributes become most useful when you can slice them. The same data, aggregated by model, by team, and by user, answers very different questions: which model is most cost-effective for a given route, which team is driving spend, which user is hitting errors. A flat average hides all of that; dimensioned data surfaces it.</p><h4>Prompts and completions</h4><p>Beyond the numeric signals, the prompt and completion themselves are often the most valuable thing a trace can hold, because they let you see <em>what the model actually saw and said</em> rather than inferring it from metrics. When an answer is wrong, the prompt usually explains why: a missing instruction, a malformed context window, a retrieved document that was off-topic. Capturing the full text of prompts and completions turns “the model gave a bad answer” into “the model gave a reasonable answer to a badly assembled prompt,” which is a debuggable statement.</p><p>That same richness is also a governance concern, which the next section addresses directly.</p><h4>Privacy, access, and audit</h4><p>Prompts and completions frequently contain sensitive data: personal information, internal documents, customer records. Capturing them for observability is valuable, but doing so responsibly requires three controls working together.</p><p>The first is <strong>PII masking</strong>: detecting and redacting personally identifiable information before it is stored in traces, so that the observability pipeline does not become a shadow copy of sensitive data in the clear. The second is <strong>role-scoped access</strong> to traces: not everyone who can read a dashboard should be able to read the raw text of every prompt, so trace visibility should be governed by role, with sensitive content gated to those who genuinely need it. The third is an <strong>audit trail</strong>: a record of who accessed what, so that access to sensitive traces is itself observable and reviewable.</p><p>These are not optional niceties in regulated environments. They are what makes it possible to have rich observability and defensible data handling at the same time, rather than trading one for the other.</p><h4>Standardizing on OpenTelemetry</h4><p>A recurring mistake is to adopt a proprietary tracing format that locks your telemetry into one tool. The durable alternative is OpenTelemetry, the vendor-neutral standard for traces and metrics. When your traces are OpenTelemetry-compliant, they describe spans, attributes, and context in a common vocabulary that a wide ecosystem of backends understands, which means the system that generates the telemetry and the system that stores and visualizes it can be chosen independently.</p><p>The practical mechanism is OTLP, the OpenTelemetry Protocol, which is how traces and metrics are exported from where they are produced to where they are analyzed. A capable observability layer exports both traces and metrics over OTLP, letting you send them to the backend you already use. Conceptually, a span carries the attributes discussed above as structured fields:</p><blockquote># Illustrative OpenTelemetry span attributes for one LLM call (conceptual)<br>span: “chat.completion”<br> attributes:<br> gen_ai.request.model: “gpt-4o”<br> gen_ai.usage.input_tokens: 812<br> gen_ai.usage.output_tokens: 143<br> gen_ai.response.latency_ms: 1180<br> llm.cost.usd: 0.0094<br> team: “support-platform”<br> user.id: “u_8c21” # subject to PII policy<br> error.type: null<br> child spans:<br> — “tool.search_docs” status: ok duration_ms: 240<br> — “tool.lookup_order” status: error duration_ms: 90</blockquote><p>Because the format is standard, the same span can flow to different backends without re-instrumentation. That is the payoff of standardizing: you trace once and remain free to change where the data lands.</p><h4>Turning traces into action</h4><p>Observability is only worth the effort if it changes decisions. A few patterns recur. Cost attribution by team and user tells you where to focus optimization, and often reveals that a small number of routes or users drive most of the spend. Latency breakdowns tell you whether slowness comes from the model or from a tool, which points at completely different fixes. Error typing tells you whether to add retries, raise a rate limit, or fix a prompt. And model-level comparison tells you when a cheaper or faster model would serve a route just as well, a decision you can only make confidently when you have per-model cost, latency, and error data side by side.</p><p>For agents specifically, the tool-performance view is often the highest-leverage signal. Agents fail in ways single calls do not: a tool returns malformed data and the model flails, or one slow tool dominates the latency of an otherwise fast chain. Seeing the full trace, with each tool call as its own span, is what makes those failures diagnosable instead of mysterious.</p><h4>Key takeaways</h4><ul><li>LLM observability extends the classic pillars but adds cost and token usage as first-class signals and makes tracing central for multi-step agent requests.</li><li>A trace captures one request as a tree of spans; for agents, model calls and tool calls become child spans that reveal where time and errors originate.</li><li>Capturing traces at the shared layer every request passes through gives full request traces with near-zero per-application instrumentation.</li><li>Record cost, latency, token usage, errors, model and version, and tool performance on every request, and slice them by model, team, and user.</li><li>Full prompts and completions are often the most valuable debugging artifact, turning “bad answer” into a specific, fixable cause.</li><li>Pair rich capture with PII masking, role-scoped trace access, and audit trails to keep observability and data governance compatible.</li><li>Standardize on OpenTelemetry and export traces and metrics over OTLP so you can trace once and send the data to any compatible backend.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5210a1f672f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LLM Routing Explained: Weight, Latency, and Priority-Based Strategies]]></title>
            <link>https://medium.com/@suchetadhiman/llm-routing-explained-weight-latency-and-priority-based-strategies-aed99fa3a605?source=rss-a97aab2fba56------2</link>
            <guid isPermaLink="false">https://medium.com/p/aed99fa3a605</guid>
            <category><![CDATA[generative-ai]]></category>
            <category><![CDATA[ai-gateway]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai-infrastructure]]></category>
            <dc:creator><![CDATA[Sucheta Dhiman]]></dc:creator>
            <pubDate>Thu, 12 Nov 2026 04:44:11 GMT</pubDate>
            <atom:updated>2026-11-12T04:44:11.836Z</atom:updated>
            <content:encoded><![CDATA[<p>When an application sends a prompt to a large language model, something has to decide which model actually answers. In the simplest setups, that decision is hard-coded: the application names a specific provider and model, and every request goes to the same place. This works until it doesn’t. A provider has an outage, a model gets rate-limited during a traffic spike, a cheaper model would have been good enough for half the requests, or a new model needs a careful rollout before it carries production load. Each of these situations asks the same question in a different form: given several models that could handle this request, which one should receive it right now?</p><p>That question is the domain of LLM routing. Instead of wiring routing logic into every application, teams increasingly place it at a shared layer in front of the models. This article explains the three core routing strategies you will encounter at that layer: weight-based, latency-based, and priority-based routing. We will use TrueFoundry’s AI gateway as a running example because its configuration model maps cleanly onto the concepts, but the ideas themselves are general and apply to any gateway that performs <a href="https://www.truefoundry.com/ai-gateway">AI gateway routing</a>.</p><h4>The virtual model: one name, many targets</h4><p>The foundation of gateway-based routing is a concept worth naming precisely: the virtual model. A virtual model gives your application a single model name to call. Behind that name, the gateway spreads requests across one or more real targets, retries failed calls, and falls back to alternatives automatically. Your application does not know or care which underlying model answered a given request; it just names the virtual model and gets a completion back.</p><p>This indirection is what makes routing possible without touching application code. The calling pattern stays identical no matter how complex the routing becomes behind the scenes:</p><blockquote>from openai import OpenAI</blockquote><blockquote>client = OpenAI(<br> api_key=”your_truefoundry_api_key”,<br> base_url=”https://gateway.truefoundry.ai&quot;,<br>)</blockquote><blockquote>response = client.chat.completions.create(<br> model=”my-virtual-model”,<br> messages=[<br> {“role”: “user”, “content”: “Summarize this support ticket.”}<br> ],<br>)</blockquote><p>Notice what is absent here. There is no provider name, no fallback list, no retry loop, no health check. The application names my-virtual-model and the gateway handles load balancing, health-aware routing, retries, and fallbacks automatically. Each virtual model uses exactly one routing strategy, chosen to match what that model is for. The rest of this article walks through the three strategies and the situations each one fits.</p><h4>Weight-based routing: splitting traffic on purpose</h4><p>Weight-based routing spreads traffic across targets according to weights that sum to 100. If you give target A a weight of 70 and target B a weight of 30, roughly 70 percent of requests go to A and 30 percent go to B. The weights are the whole mechanism: there is no automatic optimization, just a deliberate split that you control.</p><p>The classic use case is a canary rollout. Suppose you want to introduce a new model but you are not yet confident it behaves well on your real traffic. A 90/10 split sends ninety percent of requests to the established model and ten percent to the new one. You watch the ten percent, compare quality and cost, and shift the weights as your confidence grows. If something goes wrong, you dial the new model back to zero without redeploying anything. Weight-based routing is also useful for deliberate cost blending, sending a known fraction of traffic to a cheaper model while keeping the rest on a stronger one.</p><p>Here is a weight-based configuration that also demonstrates sticky routing:</p><blockquote>routing_config:<br> type: weight-based-routing<br> sticky_routing:<br> ttl_seconds: 3600<br> session_identifiers:<br> — key: x-user-id<br> source: headers<br> load_balance_targets:<br> — target: provider-a/model-a<br> weight: 70<br> fallback_candidate: true<br> — target: provider-b/model-b<br> weight: 30<br> fallback_candidate: true</blockquote><h4>Sticky routing: keeping a session on one target</h4><p>Sticky routing is an optional refinement on top of weight-based routing. Without it, every request is independently diced against the weights, so two requests from the same user might land on different targets. That is usually fine, but sometimes you want a given session to stay on one model for consistency, for example so a multi-turn conversation does not change its tone or behavior mid-stream. Sticky routing pins a session to a single target for a defined time-to-live.</p><p>In the configuration above, the gateway reads the x-user-id header and uses it as the session identifier. The first request for a given user is routed by weight; for the next ttl_seconds (here, 3600 seconds, or one hour) that user’s requests go to the same target. When the window expires, the session is routed by weight again. You choose the identifier, so you can pin by user, by conversation, by tenant, or by whatever field in the headers makes sense for your application.</p><h4>Latency-based routing: letting speed decide</h4><p>Latency-based routing takes a different philosophy. You do not set weights at all. Instead, the gateway measures how fast each target has been responding recently and sends more traffic to the faster ones. Specifically, it tracks the recent time-per-output-token for each target and picks a target per caller based on that measurement.</p><p>This is the strategy to reach for when raw responsiveness matters and your candidate models are roughly interchangeable in quality. Latency to any given provider is not constant. It drifts with load, with time of day, with the provider’s own capacity. A static weight cannot track that drift, but a latency measurement can. When one target slows down, it naturally receives less traffic until it recovers, and a faster target picks up the slack.</p><p>Two details make this strategy behave sensibly in practice. First, a given caller stays on one target for a ten-minute window rather than being re-evaluated on every single request. This avoids thrashing between targets and gives each caller a stable experience for a reasonable stretch. Second, faster targets get more traffic but all healthy targets still get some. The gateway does not starve a slightly slower target entirely, which keeps its latency measurement fresh and keeps it ready to absorb load if the leader degrades. That balance between exploitation of the fast target and exploration of the others is what separates a robust latency strategy from a brittle one.</p><h4>Priority-based routing: an ordered chain of preference</h4><p>Priority-based routing expresses a ranked preference. Each target gets a priority number, where 0 is the highest priority. The gateway sends requests to the healthy target with the lowest priority number. If that target fails, the gateway moves on to the next priority, and so on down the chain.</p><p>This is the natural fit when your targets are not equivalent and you have a clear order of preference. Perhaps you prefer a specific deployment because of data residency, a committed-capacity contract, or simply because it is your primary provider, and you want everything else to serve only as backup. Priority-based routing encodes exactly that intent: use my first choice whenever it is healthy, and climb to the next choice only when I have to.</p><h4>SLA cutoffs: defining what unhealthy means</h4><p>Priority-based routing supports service-level cutoffs that let you mark a target unhealthy based on speed, not just on errors. You can set a threshold on time-per-output-token or on time-to-first-token; when a target exceeds that threshold, it is treated as unhealthy and the gateway moves to the next priority. This matters because a model that is technically responding but responding far too slowly is, for many applications, just as unusable as one returning errors. SLA cutoffs let you encode your real tolerance for slowness and have the routing honor it automatically.</p><h4>Health-aware routing across every strategy</h4><p>All three strategies share a common foundation: they route around unhealthy targets. The gateway watches each target’s behavior and forms a view of its health. A target is marked unhealthy after it accumulates at least two failures within a two-minute span. Once marked unhealthy, a target is moved to the end of the line and is used only if the healthy targets fail first. Recovery is automatic: the gateway re-admits a target as it starts succeeding again, so you do not have to intervene to bring a recovered provider back into rotation.</p><p>Health-aware routing is what turns a static traffic split into something resilient. Weight-based routing still respects health, so a target at weight 70 stops receiving its share the moment it is unhealthy. Latency-based routing already leans away from degraded targets by construction. Priority-based routing uses health as the trigger to descend its chain. In every case, the strategy decides where traffic prefers to go, and health decides where traffic is allowed to go.</p><h4>Choosing a strategy</h4><p>The three strategies answer three different questions. Weight-based routing answers “how do I control exactly what fraction of traffic goes where,” which makes it right for canary rollouts and deliberate cost blending, optionally with sticky routing when a session needs to stay consistent. Latency-based routing answers “how do I keep responses as fast as possible across interchangeable models,” which makes it right when speed is the priority and quality is roughly equal. Priority-based routing answers “how do I use my preferred target whenever possible and fall back only when needed,” which makes it right when targets are ranked and you want SLA-driven failover. Because each virtual model carries one strategy, you can run all three at once, each behind its own virtual model name, and pick the right behavior for each workload.</p><h3>Key takeaways</h3><ul><li>A virtual model gives your application one stable name while the gateway spreads requests across real targets and handles load balancing, health-aware routing, retries, and fallbacks automatically.</li><li>Weight-based routing splits traffic by weights summing to 100, ideal for canary rollouts such as a 90/10 split; sticky routing can pin a session to one target for a defined time-to-live.</li><li>Latency-based routing uses no weights and instead measures recent time-per-output-token, sending more traffic to faster targets while keeping a caller stable for a ten-minute window and still exercising all healthy targets.</li><li>Priority-based routing sends requests to the healthy target with the lowest priority number (0 is highest) and descends the chain on failure, with optional SLA cutoffs on time-per-output-token or time-to-first-token.</li><li>Health-aware routing underpins all three: a target is marked unhealthy after at least two failures within two minutes, is moved to the end of the line, and recovers automatically.</li><li>Each virtual model uses exactly one strategy, so you can match the routing behavior to each workload by running several virtual models side by side.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aed99fa3a605" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The MCP Gateway and Why AI Agents Need It]]></title>
            <link>https://medium.com/@suchetadhiman/the-mcp-gateway-and-why-ai-agents-need-it-2c65e1ef95a9?source=rss-a97aab2fba56------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c65e1ef95a9</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[mcp-gateway]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[model-context-protocol]]></category>
            <dc:creator><![CDATA[Sucheta Dhiman]]></dc:creator>
            <pubDate>Wed, 15 Jul 2026 05:32:46 GMT</pubDate>
            <atom:updated>2026-07-15T05:32:46.822Z</atom:updated>
            <content:encoded><![CDATA[<p>The Model Context Protocol solved a real problem. Before it, every AI application wired itself to every tool and data source with bespoke glue code. MCP standardized that connection, so an agent can talk to a database, a ticketing system, or an internal API through one protocol. Adoption has been fast, and the search interest around it, tens of thousands of monthly queries for the protocol itself, reflects how quickly it moved from novelty to default.</p><p>But standardizing the connection is not the same as governing it. The moment an organization runs more than a handful of MCP servers, a new question appears: who is allowed to call which tool, with whose credentials, and how does anyone see what happened? That is the gap an <a href="https://www.truefoundry.com/mcp-gateway"><strong>MCP Gateway</strong></a> fills. Think of it as the control point every agent tool call passes through, the same way network traffic passes through a firewall.</p><h4>What is an MCP Gateway?</h4><p>An MCP gateway is a centralized layer that sits between MCP clients (agents, IDEs, applications) and the MCP servers that expose tools and data. Instead of each client connecting directly to each server, clients connect to the gateway, and the gateway routes calls to the right server while enforcing authentication, access control, and observability along the way.</p><p>The value is concentration. Without a gateway, every agent needs its own set of server URLs, its own credentials for each downstream tool, and its own logging, if it logs at all. With a gateway, an agent uses one endpoint and one credential to reach every registered server, and the platform team gets a single place to decide what that agent is permitted to do.</p><h4><strong>MCP Gateway vs MCP Proxy: The Distinction That Matters</strong></h4><p>The two terms get used loosely, and the difference is worth being precise about because it changes what you can enforce.</p><p>An MCP proxy forwards traffic. It takes a call meant for an MCP server and passes it along, often to bridge transports, for example wrapping a local stdio-based server so it can be reached over HTTP. That is useful plumbing, but a proxy does not, on its own, reason about identity or policy. It moves bytes.</p><p>An MCP gateway forwards traffic and governs it. On top of routing, it separates inbound authentication (who is calling the gateway) from outbound authentication (how the gateway authenticates to the downstream server), applies role-based access control to decide which callers can reach which tools, and records every call for audit. The proxy is a subset of what the gateway does.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*GU7i9G48HIuyGdGBaDFIkA.png" /></figure><p>If all you need is to reach one server from one client over a different transport, a proxy is enough. Once multiple teams and multiple servers are involved, the ungoverned proxy becomes the thing your security team flags.</p><h4><strong>Why The Auth Model is The Hard Part</strong></h4><p>The interesting engineering in an MCP gateway lives in authentication, because agent tool calls have two identities that are easy to conflate.</p><p>There is the question of who is calling the gateway, which is the caller’s identity: a specific agent, a specific user, or an agent acting on behalf of a user. And there is the separate question of whose credentials are used to access the downstream service, since the gateway might call a database with a shared service account or with the end user’s own permissions.</p><p>Collapsing these two into one is where access-control bugs come from. An agent that authenticates cleanly to the gateway should not automatically inherit broad downstream access. A well-designed gateway keeps the layers independent, so a platform team can say, in effect, this agent may call the Sentry tool, but only with read scope, and only when invoked by a user who already has Sentry access. TrueFoundry’s <a href="https://www.truefoundry.com/docs/ai-gateway/mcp/mcp-gateway-auth-security">MCP gateway documentation</a> breaks this into inbound authentication, access control, and outbound authentication as three separate decisions, which is the right mental model regardless of which product you use.</p><h4>Where the MCP Registry Fits</h4><p>A gateway needs to know what servers exist before it can route to them, and that is the job of an MCP registry. The registry is the catalog: it lists available MCP servers, their tools, and who owns them, so that servers can be published once and discovered by any authorized client. Search demand for the registry concept is nearly as high as for the gateway itself, which tells you teams are looking for both halves of the pattern at the same time.</p><p>In practice the registry and gateway work together. The registry answers what tools are available and the gateway answers who may call them and records that they did. Some platforms go a step further and let you compose a virtual MCP server that bundles tools drawn from several underlying servers into one interface, so an agent sees a single curated toolset instead of a sprawling list. That composition is only safe when access control sits underneath it, which is the gateway’s job.</p><h4>What To Check Before Deploying One</h4><p>A few things separate an MCP gateway you can put in front of production agents from one that only looks good in a demo.</p><p><strong>First</strong>, confirm the auth separation described above is genuinely there. Ask specifically how the gateway handles a request where the agent’s identity and the downstream credential differ. If the answer is vague, so is the security model.</p><p><strong>Second</strong>, look at observability. Every tool call an agent makes should be traceable: which agent, which tool, what arguments, what came back. Agents fail in strange ways, and without call-level tracing you are debugging blind. A gateway that emits OpenTelemetry-compatible traces plugs into the monitoring you already run.</p><p><strong>Third</strong>, check deployment options. Tool calls often touch sensitive internal systems, so the ability to run the gateway inside your own VPC or on-prem matters even more here than it does for a pure LLM gateway. Data passing through tool calls is frequently more sensitive than the prompts themselves.</p><p><strong>Fourth</strong>, consider whether the gateway is a standalone product or part of a broader control plane. Agents rarely use tools in isolation; they also call models. A platform that unifies the <a href="https://www.truefoundry.com/mcp-gateway">MCP gateway</a> with the model layer lets you apply one governance model across both, rather than stitching two systems together and reconciling their logs by hand.</p><h4>Open Source and Self-Hosted Options</h4><p>Open-source MCP gateways exist for teams that want to inspect the code and self-host, and they are a reasonable starting point when owning upgrades and scaling is acceptable. The caution is the same as with any gateway: forwarding calls is the easy part, and the access-control and audit machinery is where the real work sits. An open-source proxy that lacks the auth-separation model will not pass a security review no matter how clean the routing is.</p><h3>FAQ</h3><h4><strong>Q: What is an MCP gateway?</strong></h4><p><strong>A:</strong> An MCP gateway is a centralized layer between AI agents and MCP servers that routes tool calls while enforcing authentication, access control, and logging. It gives agents one endpoint and one credential to reach many tools, and gives platform teams one place to govern what agents can do.</p><h4><strong>Q: What is the difference between an MCP proxy and an MCP gateway?</strong></h4><p><strong>A: </strong>A proxy forwards MCP traffic and can bridge transports, but does not enforce identity or policy on its own. A gateway does the forwarding and adds inbound and outbound authentication, per-tool access control, and audit logging. Every gateway includes proxy behavior; not every proxy is a gateway.</p><h4><strong>Q: What is an MCP registry, and do I need one with a gateway?</strong></h4><p><strong>A: </strong>An MCP registry is a catalog of available MCP servers and their tools. It works alongside the gateway: the registry handles discovery, the gateway handles access and observability. Most teams end up wanting both. TrueFoundry documents how they connect in its <a href="https://www.truefoundry.com/docs/ai-gateway/mcp/mcp-overview">MCP overview</a>.</p><h4><strong>Q: Can an MCP gateway restrict which tools an agent can call?</strong></h4><p><strong>A: </strong>Yes. That is one of its core functions. Access control policies let you scope each caller to specific servers and tools, so an agent only reaches what it has been explicitly granted.</p><h4>The Takeaway</h4><p>MCP made it easy for agents to reach tools. It did not make it safe. As soon as tool calls touch real systems and multiple teams share the same servers, you need a place to decide who calls what and to prove what happened. That place is the MCP gateway. Treat it as the firewall for agent behavior, and put it in before your agents start touching anything you would not want called without a record.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c65e1ef95a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>