AAI Agentic Handbook

Decision memo: one LLM platform for twelve teams

A worked staff-level decision record for a shared LLM gateway: context, decision, alternatives, tenancy, budgets and chargeback, model policy, eval gates, build versus buy, rollout and risks.

This is a decision memo of the kind a staff engineer writes before an organisation commits to shared infrastructure. The organisation is hypothetical and every number is a stated assumption, but the structure, decisions and trade-offs are the real ones. Copy the shape; replace the numbers with yours.

1. Context

  • Twelve teams each integrated one or more model providers directly. Assume 14 separate API keys, three providers, and five different retry and timeout implementations.
  • Spend is visible only as one monthly invoice per provider. No team can state its own cost per query; finance cannot allocate the bill.
  • Model changes ship without a shared eval bar. A provider deprecation notice requires 12 teams to find and change their own code.
  • Two teams send support transcripts containing personal data; neither has redaction before the call, and the data-processing terms differ by provider.
  • Assume combined spend of $150k/month, growing 10% per month. That growth, not today's bill, is the reason to decide now.

2. Decision

Stand up one platform owned by a three-person platform team: an LLM gateway that every model call goes through, plus an eval service that gates model and prompt changes. Buy or adopt the gateway proxy; build the policy, budget and eval layers on top. Migrate all 12 teams over two quarters, highest-spend first. Teams keep ownership of their prompts, evals and product behaviour; the platform owns access, routing, budgets, policy and the gate.

1
Team apps (12)
own prompts, golden sets
2
SDK / client
team id, use case, data class
3
Gateway
auth, routing, retries, fallback
4
Policy
model allowlist by data class, PII
5
Budgets
quotas, rate limits, chargeback
6
Eval service
gates model + prompt changes
7
Providers
3 APIs; self-host later
The platform is everything between the team's code and the provider. Teams own the top layer; the platform owns the rest.

3. Alternatives considered

OptionForAgainstVerdict
Status quo (direct)No migrationNo cost attribution, 12× deprecation workRejected
Cloud provider's gatewayManaged, IAM-nativeTies routing to one cloud's model listViable fallback
OSS proxy + our layersMulti-provider, we own policyWe run and patch itChosen
Build from scratchExact fit6+ months before parityRejected
Buy full SaaS platformFastest startPrompts and data via a third partyRejected for now
“OSS proxy” means an open-source gateway such as LiteLLM, run in our own network.

4. Tenancy

  • Tenant = team × environment. Each gets its own virtual key; provider keys never leave the gateway. Revoking a team is one action.
  • Every request carries team, use case and data class (public / internal / confidential / regulated). Requests without them are rejected: the gateway fails closed.
  • Isolation from noisy neighbours: per-tenant rate limits in requests and tokens per minute, carved out of each provider's org-level limit, with 20% reserved for customer-facing traffic. Batch and eval traffic goes to the batch API or a separate low-priority queue.
  • Logs are tenant-scoped. Prompt and response logging is on by default with a 30-day TTL, off for the regulated data class, and readable only by the owning team and the platform on-call.

5. Budgets and chargeback

Showback for one quarter, then chargeback. Every request is costed at the gateway from token counts and the price table, including cache reads, cache writes and batch discounts, and attributed to team and use case. Each team gets a monthly budget with alerts at 50%, 80% and 100%; at 120% non-customer-facing traffic is throttled, never customer-facing traffic.

Line item (assumptions)MonthlyBasis
Provider spend, all teams$150,000Assumed current bill
Platform team$60,0003 FTE × $20k fully loaded
Gateway + eval infra$6,000Containers, DB, log storage
Platform cost as % of spend44%Falls as spend grows
Break-even savings needed$66,000From caching, batch, routing
The platform must pay for itself through savings it makes measurable, or through risk it removes. State which.

Be honest in the memo about where savings come from, because they are the case finance will check. Each lever is measurable at the gateway: shared system prompts moved to cached prefixes (cache reads at 0.1× input price), offline work moved to batch APIs (about 50% off), and routing simple intents to a smaller model behind an eval gate. If the levers cannot be shown to reach the break-even line within two quarters, the justification has to be risk and velocity (deprecations, personal data, incident response), and the memo should say so plainly.

6. Model policy

  • Allowlist by data class. Regulated data only to providers under a signed data-processing agreement in an approved region; confidential data never to providers that train on inputs.
  • Three tiers, named by capability not vendor: small (classification, extraction), standard (most generation), frontier (hard reasoning, agents). Teams request a tier; the platform maps tiers to models.
  • Pinned model versions, never floating aliases, for customer-facing traffic. Deprecations become a platform ticket with the eval run attached, not 12 surprises.
  • Fallback per tier to a second provider, pre-evaluated. Fallback is triggered on provider errors and timeouts, never silently on quality.
  • Prompts are versioned artefacts stored with the team's code, referenced by version in each request so every logged response maps to an exact prompt.

7. Eval gates

No model, tier mapping or customer-facing prompt change reaches production without passing its team's gate. The platform provides the harness, judge models, result storage and the CI check; teams provide the golden sets and thresholds. Minimum bar: 100 or more cases per customer-facing use case, the pass threshold agreed with the product owner, judge prompts validated against human labels before they gate anything, and a Canary & ramped rollout at 5% with automatic rollback on error-rate or cost regression.

01Change proposedmodel, prompt, tier
02Offline evalteam golden set
03Gate≥ threshold, no regressions
04Canary 5%errors, cost, feedback
05Full rolloutpinned version
The same gate for every team; the thresholds belong to the team.

8. Build vs buy

Buy or adopt the commodity: the proxy that speaks every provider's API, retries, streams and counts tokens is a solved problem and changes monthly as providers add features. Build what is specific to us: the data-class policy, the chargeback model, the eval gate wired into our CI, and the dashboards finance reads. Revisit at 12 months: if the adopted proxy is more than 30% of platform on-call load, evaluate a managed gateway.

9. Rollout

Q1 wk 1–4: gateway, 2 pilot teams
15%
Q1 wk 5–8: budgets, showback
40%
Q1 wk 9–12: top-6 spend teams
70%
Q2: remaining 6, eval gates on
90%
Q2 end: direct keys revoked
100%
Percent of total LLM spend flowing through the platform. Revoking direct keys is the last step, not the first.
  • Pilot with one customer-facing and one internal team, so both latency and policy are tested early.
  • Migration is an SDK swap plus metadata; the platform team pairs with each team for the first day.
  • Gateway overhead budget: under 20 ms p95 added latency; measured from day one and published.

10. Risks and mitigations

RiskMitigationSignal
Gateway is a single point of failureMulti-AZ, stateless, client-side bypass flagGateway 5xx > 0.5%
Platform becomes a bottleneckSelf-serve tiers, keys and budgetsRequest-to-key time > 1 day
Chargeback disputesShowback quarter first; published price tableDisputed line items
Teams route around itRevoke direct keys; make the path easiestProvider spend outside gateway
Eval gate becomes theatreJudge validated vs humans; gate auditsProd incidents that passed the gate
Each risk has an observable signal, so the platform team knows before the teams complain.

11. Consequences

  • Positive: one place to see cost per team and per use case; a deprecation is one change; personal data policy is enforced, not requested; incidents have one log to search.
  • Negative: a new critical dependency; three engineers who are not building product; every team pays a one-time migration cost of roughly a week.
  • Reversibility: high for the proxy (swappable behind our SDK); medium for chargeback (finance will build on it); low for data-class policy once regulators or customers rely on it, which is why it is decided carefully now.
  • Revisit trigger: if steady volume on any single open-weights model crosses the self-hosting break-even, open the self-host memo.

Key takeaways

  1. Write the memo as context, decision, alternatives, consequences. State scope and what is explicitly not decided.
  2. Adopt the commodity proxy; build the parts specific to you: data-class policy, chargeback, and eval gates wired into CI.
  3. Tenancy is team × environment, with mandatory metadata, per-tenant rate limits and fail-closed defaults.
  4. Costs need an honest break-even: show which savings levers (caching, batch, routing) pay for the platform, or justify it on risk and say so.
  5. Roll out by spend, measure the gateway's own latency, and revoke direct keys last. Every risk gets an observable signal.

Sources

  1. LiteLLM documentation — BerriAI, 2026docs
  2. Prompt caching — Anthropic, 2026docs
  3. Batch API — OpenAI, 2026docs
  4. Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena — Zheng et al., 2023paper
  5. AI Risk Management Framework (AI RMF 1.0) — NIST, 2023spec
  6. Hidden Technical Debt in Machine Learning Systems — Sculley et al., 2015paper
More in Evals & LLMOps →