The three frameworks most often compared for building LLM applications are not competitors in the usual sense. LangChain is a general orchestration layer with a large integration surface. LlamaIndex is built around retrieval and indexing, with data loading and query engines as its centre of gravity. DSPy treats prompts as parameters to be optimised against a metric rather than strings to be hand-written. They overlap enough to be confusing and differ enough that choosing the wrong one costs months.
The short version: decide what you are actually building, count how many of the framework’s opinions you would have adopted anyway, then estimate the cost of the opinions you would not have adopted. Convenience now is usually paid for in debugging later, and the exchange rate is worse than most teams expect.
The cost of an abstraction is the prompt you cannot see
Any framework that generates prompts on your behalf is making decisions you will later need to explain. LangChain’s chains and agents assemble instructions, tool descriptions, and formatting rules into a final prompt. When the output is wrong, the first question is which part of that assembled prompt caused it, and the answer lives inside library code that changes between versions.
That is not a reason to avoid frameworks. It is a reason to log the final prompt and the raw response at the boundary, always, from the first day. With that log, a framework is a convenience. Without it, a framework is a black box that makes every incident an investigation into someone else’s source code.
LlamaIndex: pay for retrieval, not for the rest
If your application is mostly “answer questions over a corpus”, LlamaIndex earns its keep. Document loaders, node parsers, index structures, and query engines are the parts that take longest to write well, and the library has spent years on them. The abstractions map closely onto the problem, which is the condition under which a framework is genuinely cheaper than hand-rolling.
The cost appears when the application grows beyond retrieval. Once you need custom routing, multi-step planning with tool calls, and non-trivial evaluation, the LlamaIndex idioms start to constrain you, and you end up writing adapters that translate your logic into the framework’s shape. At that point the framework is a tax on every change rather than a saving on the first build.
LangChain: breadth has a maintenance price
LangChain’s advantage is that almost every integration you need already exists. Its cost is that the library moves quickly, deprecates often, and carries layers of indirection between your code and the API call. Upgrading a version can change prompt assembly in ways that alter behaviour without any visible diff in your repository.
If you use it, pin versions, keep the integration layer thin, and treat the framework as something you may need to replace. The code that matters, your business logic and your evaluation harness, should not be entangled with framework-specific objects. That separation is the difference between a migration and a rewrite.
DSPy: optimisation is real work
DSPy’s premise is attractive: define the task and a metric, and let the framework search for prompts and few-shot examples that score well. When it works, it produces pipelines that outperform hand-written prompts on the measured metric, and it does so reproducibly.
The cost is the metric itself. Optimisation needs a representative dataset and a scoring function that reflects what you actually want. Building a good metric is often the hardest part of the project, and a bad metric will be optimised faithfully into a system that scores well and serves users badly. Budget for the evaluation set before you budget for the optimiser, and expect to spend more time on data than on the framework.
How to choose without guessing
Write the smallest version of your real task by hand first, without any framework. It will take a day and it will tell you which parts are genuinely tedious. If the tedious part is document loading and chunking, LlamaIndex pays. If it is wiring many providers, LangChain pays. If it is prompt tuning against a metric you already have, DSPy pays. If nothing is tedious, you have saved yourself a dependency.
Then check the escape hatch. For each framework, ask how you would replace one component with your own implementation. Frameworks that make this easy are safe to adopt; frameworks that require you to fight their control flow are a commitment, and commitments should be made deliberately.
A worked example: the same task in three shapes
A small application answers questions over a folder of PDFs. Hand-rolled, it is a loader, a splitter, an embedding call, a vector store, a prompt, and a client. That is perhaps two hundred lines and takes a day. Under LlamaIndex it is fifteen lines and takes an hour, and the library handles the parsing edge cases you would otherwise discover one at a time.
Six months later the same application needs tool calling, a review step, and a cost dashboard. The hand-rolled version grows by two hundred lines. The framework version needs adapters to express the review step in the framework’s control flow, and the upgrade that follows changes prompt assembly in a way nobody documents. The framework was cheaper on day one and more expensive in month seven, which is the normal shape of this trade.

What to check before you commit
- Write the task by hand once to find the genuinely tedious part.
- Log the assembled prompt and raw response at the boundary on day one.
- Pin versions and keep business logic outside framework objects.
- Estimate the evaluation cost before adopting an optimiser-based approach.
- Test replacing one component with your own code; if it is hard, weigh that as a real cost.
- Prefer the framework that matches your actual bottleneck, not the one with the most stars.
The honest summary is that frameworks are neither overrated nor underrated; they are priced in a currency most teams do not track. The price is paid in debugging hours and migration weeks rather than in licence fees, which is why it surprises people. Count it before you sign.