AI EngineeringZero to ProductionHome·About·What’s new·Contact
Case Studies & Reference Architectures · Part 9

Standing up a shared AI platform

A full end-to-end walkthrough of standing up a shared, multi-team AI platform — an internal LLM gateway with model routing, cost governance, self-serve onboarding, and golden paths — so a dozen product teams can build on AI without each reinventing keys, guardrails, and billing. Problem → gateway architecture → routing → cost governance → self-serve + golden paths → platform-team topology → rollout. Representative composite; engineering-leadership framing.

⏱️ ~2.5 hours🧪 7 steps🎯 Advanced→Tech-lead

Learning objectives

  • Frame the platform problem: a dozen teams each wiring their own keys, guardrails, and billing is duplicated, unsafe, and unobservable.
  • Design an internal AI gateway that centralizes auth, routing, guardrails, caching, logging, and spend control behind one contract.
  • Route requests across models/providers by capability, cost, and availability — with fallback — without leaking that choice to callers.
  • Govern cost with per-team budgets, quotas, chargeback, and caching, so spend is attributable and bounded.
  • Ship self-serve onboarding and golden paths so teams adopt the platform because it's the fastest route, not because they're forced.
  • Choose a platform-team topology (Team Topologies-style) and a rollout that treats the platform as an internal product.
Representative scenario — not a real customerThe company, the team count, the budgets, and every number below are an illustrative composite invented for teaching. They are not a real deployment and no figure is a claimed result. The platform-engineering patterns are real, industry-standard practice; the story is a teaching device.

Meet "Vanta Corp" — a representative composite. A year into the AI gold rush, Vanta has a dozen product teams each shipping LLM features. Every team has independently wired up its own API keys, its own retry logic, its own half-built guardrails, and its own untracked spend. Nobody can answer "what are we spending on AI and on what?", two teams just leaked a key, and each team re-solves prompt-injection defense from scratch — badly. The mandate: stand up a shared AI platform so teams build features, not plumbing. This is the classic platform-engineering job applied to AI, dominated by three forces: you must remove duplicated toil, you must make the safe path the easy path, and you must make spend attributable and bounded.

1 · Framing the platform — what "shared" has to buy

Start with the meeting that always precedes this project. A VP finally asks the question nobody could answer: "What are we spending on AI, and is any of it safe?" The room goes quiet. Twelve teams have twelve sets of provider keys, twelve half-built prompt-injection filters, and twelve invoices buried inside a general cloud bill. Two of those keys have already leaked. That silence is the business case for a platform — and if you've sat in that room, you already understand why "just let each team build it" stops scaling somewhere around the third team.

The trap here is thinking a platform is a technology decision. It isn't — it's a toil-consolidation decision. The useful mental model is a shared office kitchen versus everyone bringing a hot plate to their desk. One kitchen is only worth building if enough people are cooking; if it's just you and a microwave, a shared kitchen is pure overhead with a cleaning rota. A platform earns its keep the same way: only when several teams are each independently re-solving the same unglamorous problems — key management, guardrails, model choice, spend tracking, retries, logging — does centralizing them save more than it costs to run.

So the discipline of this first section is to enumerate the duplication honestly, because each duplicated concern is a column in the platform's value case and, later, a capability the gateway must actually deliver. Name every place a team is doing something that is duplicated (wasteful), dangerous (a security or compliance risk), or unobservable (nobody can see or audit it). The common mistake is to skip this step and jump straight to architecture — you end up building a platform nobody asked for, solving problems teams didn't feel, and then wondering why adoption is zero. If the list you produce is genuinely short, the honest answer is "not yet — ship a shared library and revisit." If it's the long list below, the toil is already burning real money and risk, and the platform pays for itself the day it lands.

A platform is only worth its own team if it removes more toil than it adds. Start by naming the duplicated, dangerous, or unobservable things every product team is doing today — because each one becomes a capability the platform centralizes. If the list is short, you don't need a platform yet; if it's this long, you can't afford not to have one.

Before · every team rebuilds it Team Akeys·rails·spend Team Bkeys·rails·spend Team C … ×12keys·rails·spend duplicated · risky · unobserved After · the platform owns it once Team A Team B Team C … ×12 Shared platformkeys · guardrails · routingspend · retries · logging A platform is a toil-consolidation decision. The value case is exactly the list of concerns twelve teams each re-solve today; centralizing them pays off only once enough teams share the same unglamorous work.
🗺️ How to read this diagram

Read it left→right across the dashed divider: the same teams, before and after the platform lands.

  • The left red boxes are a dozen product teams, each independently carrying the same load — its own keys, guardrails, and spend tracking. That repetition is the duplicated, dangerous, unobservable toil.
  • The arrows show every team now pointing at one place instead of each rebuilding it.
  • The green box is the payoff: one shared platform owns keys, guardrails, routing, spend, retries, and logging once — so the count of duplicated concerns on the left is precisely the value the platform delivers.

In short: Each thing every team re-solves is a column in the platform's value case; if that list is long, the platform pays for itself.

Today, every team…The cost of thatWhat the platform centralizes
Manages its own provider keysKey sprawl, rotation gaps, leak risk.One brokered credential; teams never hold provider keys.
Re-implements guardrailsInconsistent, often weak, injection/PII defense.A shared, versioned guardrail layer, on by default.
Picks a model ad hocOverpays or under-delivers; no consistency.Capability-based routing with fallback.
Has untracked spendNo one can attribute or cap AI cost.Per-team metering, budgets, and chargeback.
Rebuilds retries/cachingDuplicated effort; inconsistent reliability.Shared resilience + prompt caching in one place.
Logs nothing consistentNo org-wide observability or audit.Uniform request logging, tracing, and metrics.
A platform is a product, and its customers are your own teamsThe single most useful reframe: the platform team's customers are the product teams, and adoption is voluntary in spirit even if mandated on paper. If the platform is slower or clumsier than a team calling the provider directly, teams will route around it — and you'll have built shadow IT with extra steps. Every decision below is in service of making the platform the fastest way to ship an AI feature.

2 · The AI gateway — one contract in front of everything

Here's the decision that quietly determines whether the whole platform works. You've agreed to centralize keys, guardrails, routing, and billing — but where does that centralized code actually live? The tempting answer is a shared Python package every team imports. It feels lighter, and teams already know how to pip install. Six months later you push a critical guardrail fix, and you discover half the teams are still pinned to last quarter's version, one team forked it, and you cannot rotate a leaked key without twelve coordinated redeploys. The thing you built to reduce risk has become a fleet of stale copies you can't update.

The fix is to make the platform a gateway, not a library — and the difference is exactly the difference between a toll bridge and a printed map. A map (the library) is copied into every car; once printed, it's frozen, and different drivers carry different editions. A toll bridge (the gateway) is a single structure every car physically drives through — so the moment you change the toll, add a lane, or close a route, every vehicle experiences the change instantly, because they all pass through the same point. Precisely defined: a gateway is a runtime boundary — a live service in the request path — whereas a library is build-time code baked into each caller. Only the runtime boundary can enforce something on every call the instant you change it.

That single architectural choice buys you the platform's whole reason to exist: guardrails that update everywhere at once, keys that rotate without touching a single team, budgets that can actually block a call rather than just chart it, and one uniform log for every request the org makes. The caller, meanwhile, gets radically simpler — it sees a clean endpoint and never touches a provider key, a model name, or a retry loop. The common mistake is to blur the two: teams ship "a bit of shared logic" as a library "for now," and enforcement quietly leaks back out to the callers where it can never be guaranteed. Keep the split sharp — a thin client SDK is fine for ergonomics (nicer function calls, types), but every rule you must guarantee lives server-side in the gateway.

The heart of the platform is an internal AI gateway: a single service every team calls instead of a provider directly. It owns the cross-cutting concerns so no team has to. Read the diagram as one request's life: a team app authenticates to the gateway, which applies guardrails, checks the team's budget, routes to the right model (with caching and fallback), logs everything, and returns a clean response. The caller never sees keys, never sees which model answered, and never has to build any of it.

Team app service identity Gateway auth no team keys Guardrails + budget safe + bounded Model router capability + cost Provider / model brokered key Log + meter per-team spend
🗺️ How to read this diagram

Read it left→right as the life of one request: each box is a stage the call passes through, and the blue arrows are the request flowing forward from the team to the provider and on into the log.

  • The first box, "Team app" (service identity), is the caller — it authenticates with its own identity and never holds a provider key.
  • The chain of arrowed boxes is what the gateway owns, in order: Gateway auth ("no team keys") admits the call, Guardrails + budget keeps it "safe + bounded", the Model router picks by "capability + cost", and the Provider / model answers using a "brokered key" the caller never sees.
  • The payoff is the final "Log + meter" box ("per-team spend"): every request ends metered and attributed, so the platform gains org-wide observability no single team had to build.

In short: One gateway sits in front of everything — the caller sees a clean endpoint while auth, guardrails, budget, routing, and metering all happen once, on the way through.

Why one gateway beats a shared libraryYou could ship a shared client library instead of a gateway. Libraries drift: teams pin old versions, skip the guardrail update, and you can't enforce spend or rotate a key centrally. A gateway is a runtime boundary — guardrails, budgets, routing, and key rotation apply to every call the moment you change them, with no team redeploy. Ship a thin client SDK for ergonomics, but the enforcement lives in the gateway.

3 · Model routing — the right model, hidden from the caller

Picture the day a better, cheaper model ships — the exact good news that should be a one-line win. You go to adopt it and discover a dozen product teams have each hard-coded the old model's name deep in their code. Adopting the new one is now a cross-team migration: twelve tickets, twelve redeploys, twelve regression cycles, and a scheduling nightmare. So you don't do it. You stay frozen on last year's model, overpaying, because the upgrade is too expensive to coordinate. That frozen-forever failure is what this section exists to prevent, and it's caused entirely by letting callers name models directly.

The escape is a layer of indirection, and the everyday analogy is ordering coffee by size. You ask for a "large," not for "480 millilitres in the 90mm cup from the third shelf." "Large" is an intent; the café is free to change cups, suppliers, or recipes behind that word without retraining a single customer. Model routing does the same thing: teams request a capability tier — "cheap-fast," "balanced," or "frontier" — which names what they need, not which model provides it. The gateway holds the mapping from tier to concrete model, so a model name is an implementation detail the platform owns, exactly like the cup size behind "large."

Once that indirection exists, the gateway can make the choice smarter than any single team would bother to. It can pick the cheapest model that clears the tier's quality bar (cost control, decided once for everyone), fail over to an alternate provider when one times out (resilience nobody has to build), and pin regulated data classes to an approved region or provider (compliance enforced in one place, not audited twelve times). And because callers depend only on the intent, you can swap the model, add a fallback, or shift the cost/quality tradeoff for the whole org with a single edit and zero caller changes. The mistake to avoid is leaking the model name back out "just so a team can pin a specific version" — the moment one caller depends on a concrete model, you've re-frozen the migration you worked to free. (Model availability and pricing drift constantly; treat the tier-to-model map as something you re-verify against provider docs, not set once.)

With every request flowing through one place, the gateway can make the model choice for the team — by capability, cost, and availability — and change it centrally without a single caller redeploying. Teams request a capability tier ("cheap-fast", "balanced", "frontier"), not a specific model name, so you can swap models, add providers, or fail over transparently.

Caller askstier: "balanced" Gateway routermap tier → model bycost · availability · policy Model A (cheapest, OK)chosen this call Model B (fallback)used on error / timeout Indirection = migratability. The caller names an intent tier, never a model. Because the tier→model map lives in the gateway, you swap models, add a provider, or fail over with zero caller changes.
🗺️ How to read this diagram

Follow one request left→right: the caller states what it needs, the gateway decides which model provides it.

  • The left box is the caller. It sends only an intent tier ("balanced") — it never knows or names a model.
  • The middle box is the router: it maps that tier to concrete models, ranking them by cost, availability, and policy pins.
  • The solid blue arrow goes to the green Model A — the cheapest option clearing the tier's quality bar. The dashed amber arrow is the fallback to Model B, taken only when the first errors or times out.

In short: Callers depend on intent, not model names — so the whole org can migrate models with a single edit to the tier map.

Routing inputHow it steers the choiceWhy it's centralized
Capability tierTeam asks for cheap-fast / balanced / frontier by intent.Decouples callers from model names; you swap models freely.
CostPrefer the cheapest model that meets the tier's quality bar.One place to enforce the cost/quality tradeoff org-wide.
AvailabilityFail over to an alternate provider on error/timeout.Every team gets resilience without building it.
PolicySome data classes pinned to a region/provider.Compliance routing enforced once, not per team.
Route on capability tiers, not model namesIf teams hard-code "model-x-latest", you can never migrate: every model change becomes a dozen coordinated redeploys. Expose intent-level tiers instead, map tiers to concrete models in the gateway, and you can upgrade a model, add a fallback, or shift cost profiles for everyone at once. Model names are an implementation detail the platform owns — verify current model availability and pricing in provider docs, which drift often.

4 · Cost governance — spend that's attributable and bounded

Every team that has run LLMs in production has a version of this story. A well-meaning engineer ships an agent with a retry loop that, under one bad input, calls a frontier model in a tight cycle overnight. Nobody notices until the monthly bill lands with an extra five figures nobody can explain — and worse, nobody can even say which team or feature caused it, because it's all one undifferentiated pile of provider spend. The lesson lands hard: for AI, cost isn't a reporting problem you clean up at month-end, it's a real-time control problem, and the place to solve it is the one spot every call already passes through — the gateway.

The key distinction, and the one beginners miss, is between attribution and enforcement. Think of the difference between a bank statement and a debit card with a limit. A statement (attribution) tells you afterward where the money went — useful, but the money is already gone. A card limit (enforcement) declines the transaction at the till before you overspend. A cost dashboard is a statement: it changes no behavior, because no one's ability to spend depends on it. The platform's superpower is that it sits in the request path, so it can be the card limit — it can warn, downgrade, throttle, or block a call while it's happening, not report on it later.

Because the gateway authenticates every call, it can tag each request's tokens and cost to a specific team and feature — turning that undifferentiated pile into a per-team, per-feature line item. From there, four more mechanisms layer on top to make spend both bounded and owned: graduated budgets that act as they approach a cap, per-team quotas so one team's runaway loop can't starve everyone else, shared prompt caching that cuts cost across all teams at once, and chargeback that hands each team its own bill so the cost has an owner. The common mistake is to stop at metering — to build beautiful dashboards and declare victory. Dashboards inform; only in-path enforcement changes what happens. The steps below walk the full layering; read them as "attribute first, then act."

The reason finance blessed the platform is this section. Because every call is authenticated and metered, the gateway turns AI spend from an untraceable lump into a per-team, per-feature line item — and, crucially, it can enforce budgets, not just report them. Four mechanisms, layered, give you FinOps for AI: metering, budgets, quotas/rate-limits, and shared caching.

Metered calltagged to team Budget checkspend vs monthly cap < 80% → pass the call at 80% → alert the team at 100% → downgrade tier over cap → block non-critical A statement reports; a card limit acts. Because the gateway is in the request path, budget is not a dashboard — it graduates from alert to downgrade to block while the call is happening.
🗺️ How to read this diagram

Read left→right, then top→bottom down the graduated outcomes.

  • The left box is a metered call — every request is tagged to a team and feature via the auth identity, so its cost has an owner.
  • The middle box checks that team's running spend against its monthly cap. This is the step a mere dashboard can't do, because it sits in the path.
  • The right column is graduated enforcement: green while under 80%, amber alert at 80%, amber tier-downgrade at 100%, and a red block for non-critical calls beyond the cap. The color ramp is the "aha" — the response escalates as spend climbs.

In short: Attribute first (tag the call), then act (warn → downgrade → block) — enforcement in the path is what actually bends the cost curve.

How the gateway governs cost

  1. Meter every call — attribute input/output tokens and cost to a team and feature via the auth identity.
  2. Per-team budgets — a monthly cap; approaching it alerts the team, exceeding it soft-fails to a cheaper tier or blocks non-critical calls.
  3. Quotas + rate limits — per-team RPS/concurrency so one team's runaway loop can't starve everyone.
  4. Shared prompt caching — common system prompts/context cached once at the gateway, cutting cost across all teams (verify cache pricing/TTL in provider docs).
  5. Chargeback / showback — a monthly per-team report so cost is owned by the team that incurs it.
Budgets must be enforceable, not just dashboardsA cost dashboard nobody's budget depends on changes no behavior. The platform's leverage is that it sits in the request path, so it can act: warn at 80% of budget, downgrade the tier at 100%, block non-critical calls beyond that. Pair enforcement with showback so each team sees — and owns — its own line. That combination is what actually bends the cost curve.

5 · Self-serve & golden paths — adoption by attraction

This is where most internal platforms quietly die. The gateway works, routing is elegant, cost governance is airtight — and adoption is near zero, because onboarding a team means filing a ticket and waiting two weeks for the platform team to provision access by hand. Meanwhile a product engineer under deadline pressure discovers they can paste a provider key into an environment variable and ship the same afternoon. They will do that every single time. You didn't lose on capability; you lost on friction. A platform competes with the direct provider call, and the direct call is often astonishingly easy — so if your paved road is slower to get onto than going off-road, teams go off-road and you've built expensive shelfware.

The reframe that fixes this is to stop thinking of the platform as a gate and start thinking of it as a product competing for users — and products win by being the easiest and best option, not by being mandatory. Two ideas do the heavy lifting. First, self-serve: a team registers its app in a portal and instantly receives a scoped identity and tier access — no ticket, no human in the loop, no wait. Second, the golden path: a paved, documented, best-practice route for the common cases (a RAG template, an agent tool-loop) where grounding, citations, guardrails, retries, and observability are already wired in and correct. The team supplies only the part that's actually theirs — their corpus, their tools — and ships.

The crucial nuance is that a golden path is not a mandate. Mandates ("you must use the platform") breed resentment and creative workarounds; the moment the paved road is inconvenient, a mandate just teaches teams to hide their shadow IT. A golden path wins by attraction: it's genuinely the fastest, safest way to ship the common case, so teams take it because they'd be foolish not to — guardrails and dashboards come free, and the docs actually work. The escape hatch matters too: a team with a truly exotic need can go off-path, accepting more responsibility for what they then have to build themselves. Most won't want to. The common mistake is investing everything in enforcement and nothing in ergonomics — you can compel a login, but you cannot compel enthusiasm, and durable adoption is built on the latter.

A platform that requires a ticket and a two-week wait to onboard a team will lose to teams calling the provider directly. The goal is self-serve: a team registers, gets a scoped identity, and ships against a golden path — a paved, documented, best-practice route for the common cases — in an afternoon. Golden paths aren't mandates; they're the easiest path, so teams take them by choice.

the choice a team faces Team needsan AI feature Ticket + 2-week waithand-provisioned Paste a key → off-roadshadow IT, no guardrails Self-serve registerscoped identity, no ticket Golden path → ships todayguardrails + obs. built in Adoption is won at onboarding. A slow paved road pushes engineers off-road to a pasted key; a self-serve golden path that ships in an afternoon wins by attraction, not mandate.
🗺️ How to read this diagram

Start at the left box and follow the two branches: the same team, two ways to get an AI feature out.

  • The top red branch (dashed, muted) is the slow path — a ticket and a two-week wait — which a deadline-pressured engineer escapes by pasting a provider key and going off-road into unguarded shadow IT.
  • The bottom green branch (solid) is self-serve: register, get a scoped identity with no ticket, and ship on a golden path the same day.
  • The payoff is the green destination: guardrails and observability come free on the paved road, so the fastest route is also the safest — teams take it by choice.

In short: If your paved road is slower to get onto than going off-road, teams go off-road; make self-serve the fastest path and adoption follows.

Self-serve capabilityWhat the team doesWhat they don't have to do
OnboardingRegister the app, get a scoped service identity + tier access.File a ticket; wait on the platform team.
Golden path: RAGFollow a template wiring retrieval + the gateway.Design grounding, citations, and guardrails from scratch.
Golden path: agentUse the paved tool-loop + guardrail defaults.Re-derive the agent loop and safety rails.
ObservabilityGet dashboards + tracing for free on every call.Instrument logging and metrics themselves.
GuardrailsInherit the shared, on-by-default guardrail layer.Build injection/PII defense per team.
Golden paths beat golden handcuffsYou can mandate the platform, but mandates breed resentment and workarounds. A golden path wins by being genuinely the fastest, safest way to ship the common case — guardrails, observability, and resilience come free, and the docs actually work. Teams with an exotic need can still go off-path (with more responsibility); most won't want to. Adoption by attraction is more durable than adoption by decree.

6 · Platform-team topology & the internal-product mindset

A platform with no clear owner rots in a predictable way. It starts as a heroic side project by two engineers; they get pulled onto feature work; the guardrails drift out of date, nobody answers the support questions, and within a year teams have quietly gone back to direct provider calls. The technology was never the problem — the org design was. How you staff and position the owning team decides whether the platform is a living product or an abandoned tool, and that's an engineering-leadership decision as much as an architectural one.

A useful, publicly known vocabulary for this is Team Topologies, which names a few team shapes and how they should interact. The one insight worth internalizing is its central metric: a platform team's job is to minimize the cognitive load it imposes on the teams it serves. Cognitive load is just "how much a product engineer has to hold in their head to ship a feature." Think of the platform as electrical wiring in a building: a good electrical system lets every tenant plug in an appliance without knowing anything about amperage, grounding, or the substation. A bad one makes every tenant an amateur electrician. The platform succeeds precisely when a product team can ship an AI feature while knowing almost nothing about models, keys, guardrails, or billing — not because those concerns vanished, but because the platform absorbed them behind a smaller surface.

In that vocabulary, the owning group is a platform team providing a self-serve internal product to stream-aligned product teams (the dozen teams shipping features), and its default interaction mode is "X-as-a-Service" — you consume it like a utility, you don't collaborate on its internals. Early on, though, a pure self-serve stance fails: the first adopters need hand-holding to get onto the paved road at all. So the platform team temporarily wears a second hat as an enabling team — pairing closely with the first one or two teams to bootstrap adoption, transfer the patterns, and then deliberately withdraw once the golden path proves itself. The common mistake is either extreme: staying in permanent hands-on mode (you become a bottleneck consultancy that can't scale), or going pure self-serve from day one (nobody can find the on-ramp and adoption stalls). Treat it as a product — measure time-to-first-call and adoption, not lines of code — and staff it to lower cognitive load, not to gatekeep.

A platform needs an owning team, and how you structure it decides whether it thrives. Borrowing the publicly known Team Topologies vocabulary: the platform team is a platform team providing a self-serve internal product to stream-aligned product teams, and it should minimize the cognitive load it imposes — the whole point is to reduce what product teams must know. Early on it also acts as an enabling team, pairing with product teams to bootstrap adoption, then stepping back.

Platform teamowns the gateway X-as-a-Service (consume like a utility) Stream-alignedteam A Stream-alignedteam B … ×12 enabling-team hat: pair to bootstrap, then withdraw First adopters (temporary pairing)facilitating, then hands off Staff it to lower cognitive load, not to gatekeep. The default mode is X-as-a-Service to stream-aligned teams; the enabling-team pairing is a temporary bootstrap you deliberately withdraw.
🗺️ How to read this diagram

Read the solid arrow first (the steady state), then the dashed arrow (the temporary bootstrap).

  • The left box is the platform team that owns the gateway.
  • The solid blue arrow is its default interaction mode — X-as-a-Service: the stream-aligned product teams on the right consume the platform like a utility and own their own features.
  • The dashed amber arrow to the amber box is the second hat — an enabling team that pairs closely with the first one or two adopters to bootstrap them, then deliberately withdraws. The dashing signals it's temporary, not permanent hand-holding.

In short: Serve teams like a utility by default; embed briefly to bootstrap the first adopters, then step back — measure adoption and time-to-first-call, not lines of code.

Team-topology roleWhoInteraction mode
Platform teamOwns the gateway, routing, guardrails, cost governance.Provides self-serve; treats teams as customers (X-as-a-Service).
Stream-aligned teamsThe dozen product teams building AI features.Consume the platform; own their features and budgets.
Enabling team (early)Platform engineers embedding temporarily.Pair to bootstrap the first adopters, then withdraw (Facilitating).
Cognitive load is the metric the platform team optimizesThe platform succeeds when a product team can ship an AI feature while knowing almost nothing about models, keys, guardrails, or billing. That's not fewer capabilities — it's the same capabilities behind a smaller surface. Every good API, default, and golden path lowers cognitive load; every leaky abstraction or mandatory-but-undocumented step raises it. Track adoption and time-to-first-call as your real product metrics.

7 · Rollout & the failure modes of a platform

The most common way to kill a good platform is to launch it well. Leadership loves the demo, issues a company-wide mandate — "all AI features must use the platform starting Monday" — and turns on a dozen teams at once against a gateway that has never handled real, concurrent, adversarial traffic. The gateway buckles, a team's launch slips because of your latency, trust evaporates in the first week, and the mandate that was supposed to guarantee adoption instead guarantees resentment. A big-bang mandate front-loads all the risk onto the moment you understand the system least. The alternative is to roll out the way you'd launch any product with real users: earn adoption incrementally.

The pattern is lighthouse → widen → steady state. First, land a single eager "lighthouse" team and co-build their feature on the platform (this is exactly where the enabling-team hat from §6 goes on) — you prove the golden path against real traffic while the blast radius is one team. Then widen by opening self-serve onboarding so more teams pull themselves on because the paved road is now visibly the fastest route (§5). Finally you reach steady state, where new AI features simply start on the platform by default — adoption by attraction, not decree. Each stage de-risks the next: you never expose more teams than the platform has earned.

The second half of this section is the honest part: a platform has its own failure modes, and every one traces back to a design choice made earlier. The single most important is the one you created deliberately — by putting one gateway in every team's request path, you made the org's entire AI capability depend on that one service's uptime. That's a single point of failure (SPOF), and it's the price of centralization. It's a price worth paying, but only if you then treat the gateway like the critical infrastructure it now is: high availability across multiple instances, per-provider circuit breakers and fallback so one provider's outage degrades gracefully instead of cascading, and a tested runbook for the day it does break. The mistake is to celebrate the elegance of "one contract in front of everything" and forget that "everything" now shares one fate. The table below pairs each failure mode with the specific earlier decision that defuses it — read it as a self-audit, not a list of scary outcomes.

Roll the platform out the way you'd roll out any internal product: land a lighthouse team, prove the golden path, then widen — never a mandate-first big bang. And a platform has its own failure modes, each mapping to a design choice already made above.

1 · Lighthouseone team, co-built 2 · Widenself-serve opens up;teams pull themselves on 3 · Steady statenew features starton the platform bydefault — by attraction blast radius widens only as the platform earns it · never a mandate-first big bang Earn adoption incrementally. Each stage de-risks the next: you never expose more teams than the platform has already proven it can carry.
🗺️ How to read this diagram

Read left→right; each box is bigger than the last because the rollout deliberately widens.

  • Stage 1 · Lighthouse (green): a single eager team co-builds its feature on the platform, so the blast radius is one team while you prove the golden path against real traffic.
  • Stage 2 · Widen (amber): self-serve onboarding opens, and more teams pull themselves on because the paved road is now visibly the fastest route.
  • Stage 3 · Steady state (blue): new AI features simply start on the platform by default — adoption by attraction, not a company-wide mandate.
  • The arrows are the ordering rule: you only advance a stage once the previous one has earned it, so risk is never front-loaded onto the moment you understand the system least.

In short: Lighthouse → widen → steady state — a big-bang mandate front-loads all the risk; incremental rollout de-risks each step.

Stage / failure modeWhat happensThe design choice that handles it
Rollout 1 · LighthouseOne eager team ships on the platform, co-built.Enabling-team pairing proves the golden path (§5,§6)
Rollout 2 · WidenSelf-serve onboarding opens to more teams.Golden paths + docs make it the fastest route (§5)
Rollout 3 · Steady stateMost new AI features start on the platform.Attraction, not mandate; cognitive load stays low (§6)
Gateway is a SPOFOne service in every path can take everything down.HA + circuit-breaker fallback per provider (§2,§3)
Platform too slowTeams route around it to the provider.Thin client SDK; latency budget; golden-path ergonomics (§2,§5)
Runaway spendOne team's loop blows the org budget.Per-team quotas + enforceable budgets (§4)
Guardrail rotShared defense drifts out of date.Versioned, centrally-updated guardrail layer, on by default (§2)
The gateway is a single point of failure — design it like onePutting one service in every team's request path means its availability is now the org's AI availability. That's the price of centralization, and it's worth it — but only if you treat the gateway with the reliability rigor of critical infrastructure: HA/multi-instance, per-provider circuit breakers and fallback, graceful degradation, and a tested runbook. A cheap gateway that goes down takes a dozen features with it.
📋 Grade this design
DimensionMeets barAbove bar
Problem framed as toilLists what teams duplicate today.Each duplicated concern maps to a centralized platform capability.
Gateway as runtime boundaryProvides a shared endpoint.Enforces auth, guardrails, budgets, routing at runtime; changes apply with no team redeploy.
Capability-based routingPicks a model.Routes on tier/cost/availability with fallback; callers never see model names.
Enforceable cost governanceReports spend.Per-team metering + enforceable budgets + quotas + shared caching + chargeback.
Self-serve golden pathsHas onboarding docs.Teams onboard and ship in an afternoon; golden paths win by being the fastest, safest route.
Product-minded topologyNames an owning team.Platform-as-product; optimizes cognitive load; enabling-team bootstrap then withdraw.

Score each dimension Meets or Above. All six at least Meets = a platform teams will adopt by choice. Any dimension you can't hit is where teams will route around you.

✓ Knowledge check

A team lead says: "just give us the provider API key directly — the gateway adds latency and we know what we're doing." How do you respond as the platform owner?

Show answer
Handing out provider keys defeats the platform: you lose central key rotation, per-team cost attribution and budget enforcement (§4), the shared guardrail layer (§2), and org-wide observability. The right response is two-pronged: fix the reason they're asking — if the gateway's latency or ergonomics are the real complaint, that's a platform bug to close with a thin client SDK and a tight latency budget (§7) — and explain what the key buys the org: rotate-once security, an attributable AI bill, and guardrails that update everywhere at once. The goal is that the gateway is genuinely the easiest path, so this request stops coming up. Adoption by attraction, not by decree.
✓ Knowledge check

Why does the gateway expose "capability tiers" (cheap-fast / balanced / frontier) instead of letting teams name the exact model they want?

Show answer
Because model names are an implementation detail the platform must own to stay migratable. If a dozen teams hard-code a specific model, every model upgrade, price change, or provider fallback becomes a coordinated multi-team redeploy — so you never do it. Exposing intent-level tiers and mapping them to concrete models inside the gateway (§3) lets you swap models, add a fallback provider, or shift the cost/quality tradeoff for everyone at once, with no caller change. It also centralizes the cost/quality decision instead of scattering it across teams. (Model availability and pricing drift — verify in provider docs.)

🪜 Practice ladder beginner → industry

Six graded exercises, easy to real-world. Try each before opening its solution.

Exercise 1 · Justify building a platform at allBeginner

Context: Not every org needs an AI platform, and building one prematurely is its own waste. The first skill is arguing when the platform pays for itself.

Your task: List four things product teams duplicate today and, for each, the centralized capability that justifies a shared platform.

Requirements:

  • Name at least four duplicated/dangerous/unobservable concerns (keys, guardrails, model choice, spend, retries, logging)
  • For each, state the platform capability that replaces it
  • State the tipping point: roughly when the toil outweighs the platform's own cost
  • Note the failure case: a platform slower/clumsier than direct calls loses

💡 Hint: The justification is always toil-removed minus toil-added; if it's negative, don't build yet.

Show solution
  • Own keys → one brokered credential, central rotation; teams never hold provider keys.
  • Re-implement guardrails → a shared, versioned, on-by-default guardrail layer.
  • Pick models ad hoc → capability-tier routing with fallback, owned centrally.
  • Untracked spend → per-team metering, enforceable budgets, and chargeback.

Tipping point: once several teams are each rebuilding this — and no one can answer "what do we spend on AI and is it safe?" — the toil removed exceeds the platform's cost. Before that, a shared library may be enough. The platform loses the moment it's slower or clumsier than a direct provider call, so it must be built as the fastest path, not a tollbooth.

Exercise 2 · Design the gateway contractIntermediate

Context: The gateway is only adopted if its contract is clean and its enforcement is real. A leaky or slow contract sends teams back to direct calls.

Your task: Specify what the AI gateway owns and the request contract a team codes against — and why it's a runtime boundary, not a library.

Requirements:

  • Gateway owns: auth, guardrails, routing, caching, logging, budgets
  • Team sends: a capability tier + prompt/messages + a feature id; never a provider key
  • Gateway returns: a clean response plus usage metadata for metering
  • Explain why enforcement at runtime beats a shared client library
  • Note the thin client SDK is for ergonomics, not enforcement

💡 Hint: Design the contract so a team never touches keys, model names, or guardrail code.

Show solution
Team -> Gateway:
  { service_identity, feature_id, tier: cheap-fast|balanced|frontier, messages }
Gateway does:  auth -> guardrails -> budget check -> route(tier,cost,availability)
               -> provider call (cached, with fallback) -> log + meter
Gateway -> Team:
  { response, usage: {tokens_in, tokens_out, cost, model_used} }

The gateway owns auth, guardrails, routing, caching, logging, and budgets; the team sends intent (a tier + a feature id) and never a provider key or model name. It's a runtime boundary, not a library, because a guardrail update, a key rotation, or a routing change then applies to every call instantly — no team redeploy, no version drift. Ship a thin client SDK for ergonomics, but keep all enforcement server-side.

Exercise 3 · Design capability-based model routingAdvanced

Context: Hidden, central model routing is what lets a platform migrate models without a dozen redeploys. Get the abstraction wrong and you're frozen on today's model forever.

Your task: Design the router: what inputs steer the choice, how tiers map to models, and how fallback works — without leaking model names to callers.

Requirements:

  • Callers request a capability tier, not a model name
  • Router picks the cheapest model meeting the tier's quality bar
  • Availability-based fallback to an alternate provider on error/timeout
  • Policy routing: some data classes pinned to a region/provider
  • Explain how you migrate a model with zero caller changes

💡 Hint: Map tiers → models inside the gateway so callers depend on intent, never on a model string.

Show solution
route(tier, data_class):
  candidates = TIER_MAP[tier]                 # e.g. balanced -> [modelA, modelB]
  candidates = filter_by_policy(candidates, data_class)   # region/provider pins
  for m in order_by_cost(candidates):
     if available(m):  return call_with_fallback(m, rest=candidates)
  raise NoModelAvailable                       # circuit-breaker / degrade

Callers request a tier (cheap-fast / balanced / frontier), and the router maps it to concrete models by cost, availability, and policy, failing over to an alternate on error. Migration is a gateway-only change: to adopt a new model you edit TIER_MAP, and every caller gets it with no redeploy. Because callers never see model names, you're free to swap, add, or fall back at will. Verify current model availability/pricing in provider docs — they drift.

Exercise 4 · Design enforceable cost governanceExpert

Context: A cost dashboard nobody's budget depends on changes nothing. The platform's leverage is that it sits in the path and can act.

Your task: Design cost governance that is attributable AND enforceable: metering, budgets, quotas, caching, and chargeback — and what the gateway does at each budget threshold.

Requirements:

  • Meter and attribute every call's cost to a team + feature via the auth identity
  • Per-team monthly budget with graduated enforcement (warn / downgrade tier / block non-critical)
  • Per-team quotas/rate limits so one team can't starve others
  • Shared prompt caching at the gateway to cut cost across teams
  • Monthly chargeback/showback so each team owns its spend
  • Explain why enforcement in the path beats a dashboard

💡 Hint: For each budget threshold, name the concrete action the gateway takes automatically.

Show solution
📋 Cost-governance controls
ControlMechanismAction
MeteringAttribute tokens+cost to team/feature via auth identity.Feeds budgets + chargeback.
Budget @ 80%Threshold on the per-team monthly cap.Alert the team; no behavior change yet.
Budget @ 100%Cap reached.Auto-downgrade to a cheaper tier where quality allows.
Budget overBeyond cap.Block non-critical calls; critical calls flagged for approval.
QuotasPer-team RPS/concurrency.Isolate a runaway loop from everyone else.
CachingShared prompt caching at the gateway.Cut cost on repeated prefixes across all teams.

Why in-path beats a dashboard: the gateway can act — warn, downgrade, block, throttle — because it's in the request path, and chargeback makes each team own its line. That pairing bends the cost curve; a report alone doesn't. Verify cache pricing/TTL in provider docs.

Exercise 5 · Design self-serve onboarding + golden pathsProfessional

Context: Adoption is won or lost at onboarding. If it takes a ticket and two weeks, teams route around you; if it takes an afternoon, they take the paved road by choice.

Your task: Design the self-serve onboarding flow and two golden paths (RAG and agent) so a team ships in an afternoon with guardrails and observability for free.

Requirements:

  • Self-serve registration → scoped service identity + tier access, no ticket
  • Golden path (RAG): a template wiring retrieval + the gateway, grounding/citations built in
  • Golden path (agent): a paved tool-loop with guardrail defaults
  • Observability + guardrails inherited free on every call
  • Explain why golden paths (attraction) beat a mandate (handcuffs)
  • Allow off-path use for exotic needs, with more responsibility on the team

💡 Hint: Make the paved path the genuinely fastest and safest option for the common case.

Show solution
  1. Self-serve onboarding. A team registers its app in a portal, gets a scoped service identity and tier access immediately — no ticket, no wait on the platform team.
  2. Golden path — RAG. A template wires retrieval + the gateway with grounding, citations, and guardrails already in place; the team supplies its corpus and ships.
  3. Golden path — agent. A paved tool-loop with guardrail and retry defaults; the team adds its tools without re-deriving the loop or the safety rails.
  4. Free by default. Observability (dashboards, tracing) and the shared guardrail layer apply to every call automatically.
  5. Off-path allowed. A team with an exotic need can go off the golden path, accepting more responsibility — but most won't want to.

Attraction over handcuffs: golden paths win by being the fastest, safest way to ship the common case, so teams choose them. A mandate breeds workarounds; a genuinely-better paved road earns durable adoption.

Exercise 6 · Stand up and roll out the whole platformIndustry scenario

Context: The gateway prototype works; now you must roll it across a dozen teams, own it as an internal product, keep spend bounded, and not become the org's single point of failure. This is the tech-lead deliverable.

Your task: Lay out the end-to-end platform plan: gateway architecture, routing, cost governance, self-serve golden paths, team topology, and the attraction-first rollout — with the reliability posture for a service in every path.

Requirements:

  • Architecture: gateway owns auth, guardrails, routing, caching, logging, budgets (runtime boundary)
  • Routing: capability tiers → models, with cost/availability/policy and fallback
  • Cost: metering + enforceable budgets + quotas + shared caching + chargeback
  • Self-serve: onboarding in an afternoon; golden paths for RAG and agents; guardrails/observability free
  • Topology: platform team as product owner; enabling-team bootstrap then withdraw; optimize cognitive load
  • Rollout: lighthouse team → widen via self-serve → steady state, by attraction not mandate
  • Reliability: treat the gateway as critical infra — HA, per-provider circuit breakers, tested runbook

💡 Hint: Lead with the gateway as a product teams want to use; win adoption by being the fastest, safest path, and engineer the SPOF away.

Show solution
  1. Gateway architecture. One service every team calls, owning auth, guardrails, routing, caching, logging, and budgets at runtime — so a change applies everywhere with no team redeploy. Thin client SDK for ergonomics; enforcement stays server-side.
  2. Routing. Capability tiers → concrete models by cost/availability/policy, with fallback; callers never see model names, so you can migrate freely (verify model availability/pricing in provider docs).
  3. Cost governance. Meter and attribute every call; per-team enforceable budgets (warn → downgrade → block), quotas, shared prompt caching, and monthly chargeback so teams own their spend.
  4. Self-serve + golden paths. Register-and-ship in an afternoon; paved RAG and agent paths with guardrails and observability free by default; off-path allowed for the rare exotic need.
  5. Topology. The platform team runs it as an internal product for stream-aligned teams, embeds as an enabling team to bootstrap the first adopters, then withdraws — optimizing cognitive load throughout.
  6. Rollout by attraction. Land one lighthouse team, prove the golden path, widen via self-serve, reach steady state where new AI features start on the platform by choice.
  7. Reliability. Because the gateway is in every path, engineer it as critical infra: HA, per-provider circuit breakers and fallback, graceful degradation, and a tested runbook.

Order: build the gateway as something teams want to use, win the lighthouse, widen by attraction, and never let the SPOF you created take the org down. A platform is a product; treat its own teams as customers and the adoption follows.

✓ Checkpoint — you can move on when you can…

  • Argue when a shared AI platform pays for itself, and map each duplicated concern to a centralized capability.
  • Design an AI gateway as a runtime boundary owning auth, guardrails, routing, caching, logging, and budgets.
  • Route on capability tiers (not model names) by cost/availability/policy with fallback, and migrate models with no caller change.
  • Govern cost with metering, enforceable budgets, quotas, shared caching, and chargeback.
  • Ship self-serve onboarding and golden paths that win adoption by attraction, not mandate.
  • Choose a platform-team topology that optimizes cognitive load, and engineer the gateway's SPOF risk away.
© 2026 studybydoing.in · AI Engineering: Zero to Production · All rights reserved. · About · Privacy Policy · Terms · Contact
Educational content, provided as-is and without warranty. Code samples are examples — review, test, and adapt them before using in production. See the Terms of Use & Disclaimer. Use at your own risk.
© studybydoing.in