The Stepladder Framework

Stepladder is an architectural pattern for adopting AI without betting the business on any one provider. It rests on two ideas.

Two teams, one contract The application team and the AI team each keep their own roadmap, joined only by a single versioned API that exposes AI as business operations, “extract the fields from this document”, “classify this request”, “read the label in this photo”, never as a passthrough to a vendor.

A migration ladder Managed cloud services get you to production in weeks, then traffic moves to models you run yourself one rung at a time, shadow, compare, gated share, phased increase, with every rung one configuration change away from the one below it.

The name is the picture. A stepladder has two legs joined at the top by one hinge, it stands on its own without leaning on a wall, and you climb it rung by rung, stepping back down whenever you need to. Two teams, one contract, no provider to lean on, and a ladder you can always descend. I use the pattern on engagements where an organization needs AI in production quickly, wants to own its models eventually, and cannot let the second goal delay the first. It is not tied to any vendor, model family or industry. This page describes it in general terms so you can apply it anywhere: the problem it solves, the reference architecture, how a request flows through it, the contract, the migration ladder, and the design principles that make it work.

Download this framework as a PDF Download the slide deck (PDF)

A personal note

I do not claim the idea behind Stepladder. An abstraction layer between the applications and the AI services behind them is a known pattern, and it goes by several names: AI gateway, model router, LLM proxy, inference abstraction layer. What you are reading is my documented version of what I do with most of my clients and projects, written down once so I can point to it.

I originally called it AIBOX, and it still runs under that name at several client locations. I may keep using AIBOX with clients and customers. Stepladder is the name I chose for the documented version, because it says what the pattern does: two legs joined by one hinge, climbed one rung at a time.

For me, AIBOX was never simply a router. It is my auditor, my cache layer, my load balancer and my reinforcement learning data collector. Because every request and every answer passes through one place, each one can be recorded, served again without a second call to the provider, spread across providers and model instances by load and health, and turned into the graded examples that train the next model.

Zareef Ahmed

The problem Stepladder solves

Most organizations adopting AI face five tensions at once, and the naive approach, calling a provider’s SDK directly from the application, resolves none of them.

  • Speed now versus independence later. Managed cloud AI services deliver working results in weeks. Owning your own models delivers data control, cost predictability and independence, but takes months. Choosing one usually means giving up the other.
  • Two roadmaps that must not block each other. The application team has a release cadence and a backlog. The AI team wants to change models, prompts, providers and post-processing often. If every AI change is an application change, one roadmap is always waiting on the other.
  • No single provider is best at everything. Document extraction, image reading, classification and summarization each have a different best-fit service, and the best choice moves as the market moves.
  • Quality must be measurable and reversible. A wrong extraction corrupts a record. Any change to how results are produced needs to be compared against the previous behavior and reverted in minutes, not in a hotfix cycle.
  • Sensitive data needs one control point. Authentication, authorization, rate limits, retention, audit and data-residency rules have to be enforced consistently, which is impossible when each application integrates AI its own way.

These are architectural problems, not modeling problems. Stepladder answers them with one decision: treat AI as infrastructure with a contract, not as a feature bolted onto each application.

Reference architecture

Stepladder reference architecture: consuming applications call one versioned API; inside it a gateway, a use-case orchestrator, a routing and policy engine, provider adapters, validation and confidence, a response normalizer and an observability layer; behind it managed AI services and in-house models.Web applicationMobile applicationBack-office systemsrequest: versioned contract, auth, correlation IDresponse: canonical JSON, confidenceSTEPLADDERGateway and identityauthn, authz, rate limits, request IDUse-case orchestratornamed operations, explicit contractsRouting and policy enginetraffic split, health, latency, data rulesProvider adaptersone adapter per backing serviceValidation and confidencefield rules, lookups, confidence signalResponse normalizercanonical JSON per use caseObservability, audit trail, quality metrics, samplingevery request: route taken, provider, latency, outcome, confidenceManaged AI service Afast to marketManaged AI service Bbest fit per use caseIn-house modelsyour environment, your weights
The Stepladder reference architecture. Consumers see one contract; every provider, including models you run yourself, is an adapter behind the routing and policy engine.

The layer has six building blocks. Each has one job, talks to the others through internal interfaces, and can be replaced without touching the rest.

Gateway and identity. Every call is authenticated, authorized against the calling application’s entitlements, rate-limited and tagged with a correlation ID that follows the request through every downstream hop. Consumers hold credentials for Stepladder only; provider credentials live nowhere else in the estate.

Use-case orchestrator. Every supported operation is a named use case with an explicit input contract and an explicit output schema. Some use cases are one model call. Others are a pipeline: quality triage, then detection, then extraction, then a lookup against reference data. The consumer sees one request and one response either way.

Routing and policy engine. The strategic flexibility lives here. Routing is configuration, not code, evaluated per request against the use case, the traffic-split policy in force, provider health, the latency budget and any data-handling constraint that applies to the payload. Changing which engine serves a use case is a configuration change with an audit record, not a release.

Provider adapters. One adapter per backing service, translating the canonical internal request into that provider’s API shape and the response back. Adding a provider means writing an adapter; it never means touching the orchestrator, the schemas or a consumer. A managed cloud service, an open-weight model served in your own environment through Ollama or vLLM, and a fine-tuned specialist model are all just adapters.

Validation, confidence and normalization. Raw model output is never returned. Every result is coerced into the canonical schema for its use case, field-level rules are applied (formats, checksums, plausibility, date sanity), and a confidence signal is attached. Low-confidence results are flagged so the consumer can route them to a person instead of writing a bad record.

Observability and audit. Every request is recorded with its routing decision, provider, latency, outcome and confidence, and a sampled subset is retained for quality evaluation. This is not a nice-to-have. It is the mechanism that makes every later change safe.

How a request flows through Stepladder

The life of one request through Stepladder: authenticate and tag, resolve the use case, route by policy, call the adapter, validate and normalize, respond; with fallback to another provider on error and hand-off to human review on low confidence, and an audit record at every hop.1. Authenticateand tag2. Resolvethe use case3. Routeby policy4. Callthe adapter5. Validateand normalize6. Respondschema, confidenceerror, timeout, unhealthyFallback providerlow confidenceHuman reviewEvery hop writes an audit recordrequest ID, use case, route taken, provider, latency, outcome, confidence, plus sampled payloads for evaluation
One request, hop by hop. The two dashed paths, fallback and human review, are what make the layer safe to change.

Follow one request from a consuming application to its answer.

  1. Authenticate and tag. The gateway checks the caller’s credentials and entitlements, applies rate limits, and assigns a correlation ID. Nothing beyond this point is anonymous.
  2. Resolve the use case. The request names a business operation, never a provider. The orchestrator loads that use case’s input contract, validates the payload against it, and selects the pipeline that fulfills it.
  3. Route by policy. The policy engine picks the target: which provider or in-house endpoint, according to the live traffic split, provider health, the latency budget and the data-handling class of the payload. Payloads that must not leave a boundary are only ever routed inside it.
  4. Call the adapter. The adapter translates the canonical request into the provider’s shape, calls it, and translates the response back. On error, timeout or a health failure, the policy engine falls back to the next permitted target and records that it did so.
  5. Validate, normalize and score. The result is coerced into the use case’s output schema, checked field by field, cross-checked against internal reference data where the use case calls for it, and given a confidence signal.
  6. Respond, or hand off to a person. High-confidence results return to the caller in the stable JSON shape. Low-confidence results return flagged, or go to a human verification queue, depending on the use case’s policy. Either way the consumer’s code path is the same, because the contract is the same.

At every hop an audit record is written: request ID, use case, routing decision, provider, latency, outcome and confidence. Sampling retains a representative slice of requests and responses for evaluation. That record is what lets you explain any answer to an auditor afterwards, and what lets you compare a candidate model against the incumbent on real traffic.

The contract

The contract is the whole point, so it deserves precision. A consumer of Stepladder gets, per use case:

  • An input schema that names the operation and the payload it accepts, versioned so that a breaking change is a new version, never a surprise.
  • An output schema in canonical JSON, identical regardless of which provider produced the underlying result, with every field typed and validated.
  • A confidence signal on the result and, where it matters, on individual fields, with a documented meaning so that consumers can set thresholds.
  • Actionable failure semantics. “Retake required”, “document type not supported”, “needs human verification” are outcomes the consumer can act on, not opaque error codes from three different vendors.
  • A correlation ID the consumer can quote back when something needs investigating.

Equally important is what the consumer is never told: which provider answered, which model, which prompt, which version of the pipeline. If that information leaks into consumer code, the abstraction is gone and every future change becomes a coordinated release again. Normalize aggressively at the boundary and keep the contract honest.

The migration ladder: from managed services to your own models

The four-rung migration ladder: shadow, compare, gated live share, phased increase, with rollback at any rung by reverting the routing policy.1. Shadowmirrored traffic, outputs scored,never returned to a callerlive traffic: none2. Comparefield by field vs the incumbent,disagreements adjudicatedlive traffic: none, evidence built3. Gated live sharea small slice, automatic fallback,quality thresholds watchedlive traffic: small, per use case4. Phased increaseshare grows in held stepsas the evidence accumulateslive traffic: growing per use caseRollback at any rung: revert the routing policy. One configuration change, no deployment.
The migration ladder. You climb it per use case, and every rung is one configuration change away from the previous one.

The ladder is the other half of the name. Stepladder turns the move to in-house models from a rewrite into a migration. Because consumers already talk to Stepladder rather than to a provider, an internal model endpoint is one more routing target: deploy it, register an adapter, and the policy engine can send it traffic. The ladder has four rungs, and you climb them per use case, not globally.

Shadow. The candidate receives a mirrored copy of live traffic. Its outputs are recorded and scored but never returned to a caller. Zero production risk, real production data.

Compare. Shadow outputs are compared field by field against what the incumbent actually returned, with disagreements sampled for human adjudication. This produces an evidence base rather than a demo-day impression: where the candidate matches, where it is better, and which input types it is not ready for.

Gated live share. A small slice of live traffic is routed to the candidate, with automatic fallback to the incumbent on error, timeout or sub-threshold confidence, and quality metrics monitored continuously against defined thresholds.

Phased increase. The share grows in controlled steps, each held long enough to accumulate statistically meaningful evidence before the next. At every step, rollback is a single change to the routing policy, effective immediately, with no deployment.

The order matters, and most organizations get it backwards. They build the in-house model first, then try to integrate it, and discover the evaluation and routing problems at the end. Build the abstraction layer first and, by the time the first in-house model exists, the machinery to evaluate it, route to it and roll back from it is already running in production, with months of real traffic to test against. Hybrid operation is then a destination, not a waypoint: keeping managed services routable is a resilience feature even when the strategic goal is full in-house inference.

Two teams, one contract

The architecture has an organizational counterpart, and it is usually the outcome delivery leaders value most.

ConcernDirect integrationWith Stepladder
Changing AI providerApplication code change, regression cycle, coordinated releaseRouting configuration change with an audit record
Upgrading a modelBlocked on the application team’s release trainShipped on the AI team’s own cadence
Adding a use caseNew integration, new credentials, new error handling in each consumerNew use case on an existing platform, one contract
Rolling back a bad changeHotfix and emergency deploymentRevert the routing policy, effective immediately
Provider credentialsDistributed across every consuming applicationHeld only inside Stepladder

The contract is the hinge of the stepladder: the one point where the two legs meet, and what lets each leg carry its own weight. Application developers are insulated from AI change: their integration surface is a documented, versioned contract. The AI team is insulated from application release cycles: it can ship an improvement, evaluate it in shadow against live traffic, and promote it when the evidence supports it, without negotiating a release slot. The two roadmaps decouple, which is the mechanism behind going to market fast while innovating in parallel rather than in sequence. The first funds the second.

Governance by design

  • One control point. Authentication, authorization, rate limiting, retention and audit are enforced once, in Stepladder, instead of reimplemented inconsistently in every consumer.
  • Credential containment. Provider credentials exist only inside the layer, which shrinks the secrets footprint of the whole estate.
  • Policy-aware routing. Data-handling constraints are inputs to the routing decision, so payload classes that must stay inside a boundary never leave it. This is also how open-weight models running in your own environment take over the sensitive workloads first.
  • Full audit trail. Every request carries a correlation ID and an immutable record of what was asked, which engine answered, and with what confidence.
  • Human in the loop by design. Confidence thresholds route uncertain results to people rather than allowing automated writes to records that matter.

Design principles

  • Build the abstraction before you need it. A direct integration is quicker on day one. The value of Stepladder is everything that comes after: the second use case, the provider change, the in-house migration. Teams that skip it pay later, at a worse exchange rate.
  • Routing belongs in configuration, not code. Making the traffic split a policy artifact with an audit record turns changing the AI from a release event into an operational action. That is what makes phased, reversible migration possible at all.
  • Normalize aggressively at the boundary. Raw provider output leaks vendor semantics into consumer code and destroys the abstraction from the inside. One canonical schema per use case, enforced on the way out.
  • Shadow mode is the cheapest evaluation you will ever run. Comparing a candidate against the incumbent on live traffic, with no production risk, beats any benchmark dataset, and costs almost nothing once the platform exists.
  • Design for the low-confidence case first. Knowing when the system is unsure is worth more than being marginally more accurate on the easy cases.
  • Hybrid is a destination. Keep every proven provider routable. The fallback path is a feature, not technical debt.

When to use Stepladder, and when not to

Use it when more than one application will consume AI, when you expect to change providers or models, when you intend to run your own models eventually, when the outputs write to records that matter, or when the data is sensitive enough to need one enforcement point. Any two of those justify the layer.

Do not build it for a single application making a single AI call with no plan to change. A direct integration is the right answer there, and you can introduce the layer later when a second consumer or a second provider appears. The pattern earns its keep through reuse and change; without either, it is ceremony.

How to adopt Stepladder

Eight steps, in the order that has worked. The first three are where teams try to take shortcuts, and they are the ones that make everything after them cheap.

1. Name the use cases as business operations

Write down each AI capability as an operation a consumer would ask for, with a plain-language description, never as “call provider X”. If you cannot name it without a vendor, you have not understood the use case yet.

2. Define the contract for each use case

An input schema, a canonical output schema, the confidence signal and its meaning, and the actionable failure outcomes. Version it from day one. Get the consuming team to sign off on it before any provider is chosen.

3. Stand up the gateway and the audit trail

Authentication, authorization, rate limits, the correlation ID and the request record. Do this before the first adapter, because the audit trail is what makes every later step measurable.

4. Write the first adapter against a managed service

Start with whichever managed provider gets a working result fastest. Speed to first production value is the point of this step; independence comes later, through the ladder.

5. Put validation and normalization at the boundary

Coerce every result into the canonical schema, apply field-level rules, attach confidence, and route the low-confidence tail to human review. Return nothing raw.

6. Move routing into configuration

Traffic split, fallback order, health rules, latency budgets and data-handling constraints all become a policy artifact with an audit record and a rollback path. Test the rollback before you need it.

7. Add the second provider or the first in-house model as an adapter

Register it, run it in shadow, compare it against the incumbent on real traffic, then climb the ladder per use case. Open-weight models served in your own environment are the natural candidates for the sensitive workloads.

8. Make promotion routine

Automate the comparison and the quality gates so that promoting a new model version becomes a scheduled decision backed by evidence, not a project. Then add the next use case, which now costs a fraction of the first.

Frequently asked questions

What is an AI abstraction layer?

An AI abstraction layer is a service that sits between applications and AI providers, exposing business-level operations through one stable, versioned API while hiding which provider, model or pipeline produces each result. Stepladder is a specific pattern for building one, with routing in configuration, validation at the boundary, and a full audit trail.

How is Stepladder different from an API gateway?

An API gateway proxies requests to a backend. Stepladder changes the request: it maps a business operation to a pipeline, routes by policy across several providers, validates and normalizes the output into a canonical schema, attaches a confidence signal and records the whole decision. A gateway is one of its building blocks, not the layer itself.

Does the layer add latency?

A few milliseconds for authentication, routing and validation, which is small next to model inference time. In practice it often reduces end-to-end latency, because routing can prefer the fastest healthy provider and quality triage rejects unusable inputs before an expensive model call.

Does Stepladder lock me into one vendor?

The opposite. Because consumers never see the provider, traffic can move between managed services and in-house models on technical or commercial grounds through a configuration change. No single provider is structurally embedded, which also improves your negotiating position.

Can it route to open-weight models running in my own environment?

Yes. An in-house endpoint served by Ollama, vLLM or a similar runtime is registered as one more adapter, and the migration ladder moves traffic to it per use case as the evidence supports. Private AI deployment is how I build that side.

Working with me

I design and build Stepladder-style layers as part of private AI deployment consulting: the contract, the routing and policy engine, the evaluation machinery, and the migration from managed services to models you run yourself. If that is the problem in front of you, tell me about your situation.