Identify the concrete lock in costs a framework imposes on a production codebase (select all that apply)
Framework lock-in costs are the taxes you only pay because you adopted the framework. Type coupling, prompt portability, observability hooks, feature lag; GPU choice and token pricing are not framework concerns.
Think of moving into a furnished apartment. The lock-in costs are the things you cannot take with you when you leave: built-in shelving, the alarm system wired to one company, the smart switches that only work with that brand's app. The things you can take with you, your couch, your rent, the neighbourhood you live in, were never the apartment's fault to begin with. When you pick a framework, the same test applies: list the costs that would vanish if you swapped the framework for raw SDK calls. Those are the lock-in costs.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Framework lock-in is the lock-in cost most often conflated with provider lock-in, and that confusion is what makes this multi-select question discriminating. The candidate who lists 'token pricing' as a LangChain cost has not thought through the layering carefully. The candidate who can name the four real costs and explain why GPU choice is wrong-layer has internalised the right mental model.
This deep dive defines the ejection-cost test, walks through each of the four real costs and its mitigation, and explains why the two distractors fail the test.
The ejection-cost test
Lock-in is fundamentally a question about counterfactuals: if you removed the framework tomorrow and replaced it with raw provider SDK calls, what costs would you pay?
Anything that vanishes when the framework does is framework lock-in. Anything that persists regardless is not. It's lock-in to a different layer (provider, runtime, hardware, observability vendor) that you should account for separately.
Applying the test
For each candidate cost, ask:
- 'Would this cost still exist if I replaced LangChain with direct OpenAI/Anthropic/Google SDK calls?'
- 'Is this cost caused by the framework's abstractions, or by some other layer in my stack?'
The test cleanly separates the four real costs from the two distractors.
Why this matters in interviews
The question is testing whether you can reason about layering. A senior engineer should be able to walk a CTO through 'these costs grow if we stay on this framework, these costs are the same regardless, here are the mitigations.' A junior engineer will mix the layers and overestimate the framework's pull on decisions that are actually provider or runtime concerns.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
| Cost | Framework lock-in? | Why |
|---|---|---|
| Type coupling | Yes | Framework types in function signatures must be rewritten on exit |
| Prompt portability | Yes | Framework templating + parsers do not move to raw SDK as-is |
| Observability hooks | Yes | Proprietary tracers (LangSmith) require the framework |
| Feature lag | Yes | Framework wrappers ship weeks after provider SDKs |
| GPU vendor | No | Hardware decision independent of any LLM framework |
| Token pricing | No | Contract between you and the provider, framework is uninvolved |
Real products, models, and research that use this idea.
- LangSmith's tight coupling to LangChain is the canonical observability-coupling example; teams migrating off LangChain have to migrate off LangSmith too.
- OpenAI's structured-outputs feature with strict schemas landed in the OpenAI SDK in mid-2024 and reached LangChain's `with_structured_output` weeks later. A concrete feature-lag instance.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you design an application to minimise type coupling to a chosen framework?
Hexagonal architecture. Define your own domain types (Message, Conversation, Tool, Response). Build a thin adapter layer that converts to/from the framework's types. The framework lives at the edges; the core knows nothing about it.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Conflating framework lock-in with provider lock-in. Confusing the cost of leaving LangChain with the cost of leaving OpenAI, when they are independent decisions.
60 second bullets to scan on the way to the call.
The 'would this cost survive removing the framework?' test
The four real lock-in costs (type, prompt, observability, feature lag)
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.