# LangChain and the alternatives: choosing an LLM framework

> What LLM frameworks such as LangChain give you, what they cost, the current options by type, and a decision table for when to use one or none at all.

- Published: 2026-09-28; last updated 2026-11-13
- Author: the WeStack AI team
- Subject: AI agents
- Address: https://westack.ai/blog/llm-frameworks-langchain-and-alternatives

> Choose the smallest layer that covers your hardest requirement. For a product built on one model provider, that is usually the provider's SDK plus a thin layer you write yourself. Add a graph framework such as LangGraph when work has to pause, resume and wait for human approval, and a general library such as LangChain or LlamaIndex when you need many integrations quickly.

## What an LLM framework gives you

An LLM framework is a library that sits between your code and the model APIs. It wraps the repetitive parts of building with language models so that you write less plumbing: sending messages, describing tools, parsing structured output, fetching documents, looping until the task is done.

All of it can be written by hand. The question is how much of it you want to own. Five things turn up in nearly every framework:

- **Model abstraction.** One interface for several providers, so that switching models is a configuration change and not a rewrite.
- **Tool calling.** Turning your functions into schemas the model can call, validating the arguments and feeding results back. Most now include a client for the [Model Context Protocol](https://westack.ai/blog/model-context-protocol-explained), so tools can live outside your codebase.
- **Retrieval plumbing.** Loaders, chunkers, embedding calls and vector store connectors for [RAG and enterprise search](https://westack.ai/services/generative-ai).
- **Agent loops.** The cycle of model call, tool call and next model call, with limits, retries and memory.
- **Tracing hooks.** A record of every prompt, tool call and token count, usually sent to an observability product.

The agent loop is the part people assume is hard. Stripped down, it is this:

```python
def run(task, tools, max_steps=8):
    messages = [{"role": "user", "content": task}]
    for _ in range(max_steps):
        reply = model.call(messages, tools=tools.schemas())
        messages.append(reply)
        if not reply.tool_calls:
            return reply.text
        for call in reply.tool_calls:
            result = tools.run(call.name, call.arguments)
            messages.append(tool_result(call.id, result))
    raise StepLimitReached(task)
```

What a framework adds is everything around those ten lines: timeouts, retries, streaming, saving state so a run can resume tomorrow, pausing for a person to approve a step, trimming context when it grows too long. Those are real engineering problems. They are also the places where your product's requirements differ most from the framework author's assumptions.

## What a framework costs

**Indirection.** When an answer is wrong, you need to see the exact text that went to the model. With a framework, that text is assembled several layers below the code you wrote. Anthropic's guide to [building effective agents](https://www.anthropic.com/engineering/building-effective-agents) warns that frameworks add "extra layers of abstraction that can obscure the underlying prompts", and suggests starting with the model APIs directly. We agree, with one amendment: if you do adopt a framework, log the raw request at the HTTP boundary from the first day, so you are never guessing.

**Churn.** This field renames itself every few months. Microsoft has folded AutoGen and Semantic Kernel into one successor, Agent Framework. LangChain's 1.0 release reorganised the library around a single agent constructor and middleware. The Claude Code SDK became the Claude Agent SDK. LlamaIndex renamed its hosted platform from LlamaCloud to LlamaParse. Each change was reasonable, and each cost somebody a migration. LangChain now has a long-term support policy for its 1.x line, which helps. Even so, a framework upgrade is a change to your prompts, and it needs the same regression testing as a model upgrade.

**Hidden prompts.** Frameworks ship defaults: system prompts, tool descriptions, summarisation instructions for long conversations, retry messages when output fails validation. These are prompts you did not write and may not have read, and they change between versions. The more a framework does out of the box, the more of your agent's behaviour lives in someone else's repository.

There is a quieter cost too. A framework puts complicated designs within easy reach. Five agents handing work to each other is one import away, whether or not the problem needs more than one model call.

## The options in late 2026, by type

Names and features below were checked against each project's documentation at the time of writing. Expect them to move.

### General orchestration libraries

[LangChain](https://docs.langchain.com/oss/python/langchain/overview) is the best known. In its 1.x form it centres on `create_agent`, a configurable agent loop with middleware for guardrails, retries and routing, plus one interface across model providers and a very large catalogue of integrations. Its agents run on LangGraph underneath. [LlamaIndex](https://developers.llamaindex.ai/python/framework/) describes itself as a toolkit for agents over your data: its strength is ingestion, parsing and retrieval, with an event-driven Workflows layer on top. [Haystack](https://docs.haystack.deepset.ai/docs/intro) is the most explicit of the three. You wire components into a pipeline graph that runs the same way every time, and hand control to an agent only where you choose to.

Use these when breadth of integrations matters more than control: many document sources, several vector stores, a prototype due on Friday.

### Graph-based agent frameworks

[LangGraph](https://docs.langchain.com/oss/python/langgraph/overview) models a workflow as a graph of shared state, nodes and edges, and does not prescribe prompts or architecture. What you are buying is the runtime: checkpointed state, resumption after failure, pausing for human review. The idea has spread. Microsoft Agent Framework has graph-based workflows, Google's ADK added them in its 2.0 release, and [CrewAI](https://docs.crewai.com/) pairs crews of agents with flows for the stateful parts.

Use these when the process has a shape you can draw, runs for minutes or days, and must survive a restart.

### The model providers' own agent SDKs

Each large provider now ships an agent SDK. The [OpenAI Agents SDK](https://openai.github.io/openai-agents-python/) keeps to a few primitives: agents, handoffs, guardrails, sessions and built-in tracing. The [Claude Agent SDK](https://code.claude.com/docs/en/agent-sdk/overview) exposes the agent loop, file and shell tools, permissions and subagents behind Claude Code as a Python and TypeScript library. Google's [Agent Development Kit](https://adk.dev/) covers Python, TypeScript, Go, Java and Kotlin, with evaluation tooling and deployment paths to Google Cloud. [Microsoft Agent Framework](https://learn.microsoft.com/en-us/agent-framework/overview/) serves .NET and Python, with Go in preview. AWS backs the open-source [Strands Agents](https://strandsagents.com/latest/).

Most of these accept other vendors' models through adapters, but each is tuned for its own. Use one when you have chosen a provider and want its newest features, such as hosted tools, sandboxes or voice, as soon as they ship.

### Typed and lightweight libraries

[Pydantic AI](https://pydantic.dev/docs/ai/overview/) brings type-checked tools, dependency injection and validated structured output to Python, and treats a change of provider as a one-line edit. For TypeScript, the [AI SDK](https://ai-sdk.dev/docs/introduction) from Vercel gives one API for text, structured objects and tool calls, with hooks for chat interfaces, and [Mastra](https://mastra.ai/docs) adds agents, tools and memory. [DSPy](https://dspy.ai/) is different in kind: you declare a task as typed inputs and outputs, supply examples and a metric, and let an optimiser tune the prompts.

Use these when you want a small, typed surface with control flow in ordinary code.

### Plain SDK calls and a thin layer of your own

The provider SDKs already handle tool schemas, structured output and streaming. A thin layer on top, typically a few hundred lines, gives you a model client wrapper, a tool registry, the loop above and logging in the shape your team wants. You own every line, which is both the benefit and the bill.

## Which framework for which project?

| Project | Our starting point | Why |
|---|---|---|
| Extraction, classification, one-shot generation | Provider SDK and a schema library | One call, no loop. A framework adds nothing. |
| RAG over your documents | Your own retrieval code, or LlamaIndex or Haystack if ingestion is messy | Quality comes from chunking and evaluation, which you must own anyway. |
| Chat assistant inside a TypeScript web app | AI SDK | Streaming interfaces and provider switching with little overhead. |
| Tool-using agent on one provider | That provider's agent SDK | Newest model features, least glue code. |
| Typed Python service across several providers | Pydantic AI | Validation and portability without a large dependency. |
| Long-running process with approvals and resumption | LangGraph, or a workflow engine plus a thin layer | Checkpointing and human review are the hard part. |
| Agent that works on files and runs commands | Claude Agent SDK or a similar packaged agent | The loop, tools and permissions are already tuned. |
| .NET or Java estate | Microsoft Agent Framework or Google ADK | First-class support in your language. |

## A worked example: one assistant, three stages

Take a retailer that wants an assistant to answer order questions for its support team. It has to read the help centre and call two internal APIs: order status and refunds.

Stage one is a single model call with two tools and a retrieval function. There is no state beyond the conversation. A provider SDK and the loop above cover it in an afternoon, and every prompt is visible in one file. A framework here would be dead weight.

Stage two adds a rule: refunds over a set amount need a supervisor's approval, which may arrive hours later. Now a run has to stop, persist and resume with the same state. You can build that on a database table and a queue, and for one approval step we often do. If approvals multiply or the process branches, a graph framework earns its place, because checkpointing and resumption are exactly what it sells.

Stage three is a request to try a second model provider to cut cost. If the thin layer has one model client wrapper, this is a day's work. If provider-specific calls are scattered through the code, it is a fortnight. That is the case for some abstraction from the start, though not necessarily someone else's.

Notice what never drove a decision: the number of agents. The assistant stayed a single agent throughout.

## When should you use no framework?

More often than the tutorials suggest. Our default for a new build is the provider SDK, a schema library and a thin layer. We add a framework when a named requirement appears that would take more than a few days to build well: durable execution, a specific integration, a multi-language team that needs shared conventions.

We skip the framework when the product makes only a handful of distinct model calls, when prompt quality is the main risk and we want every token in view, when latency budgets are tight enough that each layer counts, or when a regulated client needs to audit exactly what is sent where.

We adopt one without guilt when the team is new to LLM work and benefits from structure, when the roadmap plainly includes long-running workflows, or when the integrations catalogue saves weeks.

Using LangChain is not the mistake. The mistake is choosing any framework before you know what the product has to do, then finding that the hard part of the project, [working out whether the agent is right](https://westack.ai/blog/how-to-evaluate-ai-agents), was never something a framework could do for you.

Whatever you choose, three habits keep the decision reversible. Keep prompts in your own files. Wrap the framework behind your own interfaces. Send traces to a store you control, in an open format such as OpenTelemetry.

## How to choose in your first week

1. Write down the hardest requirement: resumable runs, many data sources, strict typing, one provider's particular feature.
2. Build the core task with the plain SDK first, in a day. You will see what the prompts and tool calls look like, which informs every later decision.
3. Collect twenty to thirty real examples with expected outcomes. This small evaluation set will outlive any framework.
4. If a requirement from step one is still unmet, trial one framework of the matching type for two days. Read its default prompts. Check how you would log the raw request.
5. Pin versions, record why you chose it, and set a review date.

If you want a second opinion on the choice, or a team to build the first version, this is the work our [AI agents practice](https://westack.ai/services/ai-agents) does.

## Frequently asked questions

### Is LangChain still worth using in 2026?

Yes, for the right job. LangChain 1.x is stable, has a long-term support policy and offers the widest set of integrations, which suits prototypes and products that connect to many systems. It is less suited to small, latency-sensitive features where you want every prompt in plain view.

### What is the difference between LangChain and LangGraph?

LangChain is the higher-level library: a ready-made agent loop, middleware, model interfaces and integrations. LangGraph is the lower-level runtime beneath it, where you define a workflow as a graph of state, nodes and edges and get checkpointing, resumption and human review. Start with LangChain agents for simple cases and drop to LangGraph when you need explicit control.

### Do I need a framework to build an AI agent?

No. An agent is a loop: call the model, run the tools it asks for, feed back the results, repeat until done. Provider SDKs already handle tool schemas and structured output, so a thin layer of your own code is enough for many products. Frameworks earn their place when you need durable, resumable runs or many integrations.

### Which LLM framework is best for TypeScript?

For a web product, the AI SDK is the usual starting point: one API across providers plus hooks for streaming chat interfaces. Mastra adds agents, tools and memory for teams that want more structure. The OpenAI Agents SDK, Claude Agent SDK, Google ADK and LangChain all have TypeScript versions if you have already chosen that provider or ecosystem.
