Choosing an AI framework (or none at all)
Every few months a new agent framework shows up promising to make LLM apps easy, and every team I talk to asks the same question: which one should we use? My honest answer is that the framework matters less than knowing what job you want it to do. This doc gives you a map of the landscape as of October 2026, a way to decide, and the cases where the right answer is "just call the model SDK yourself".
Why it matters
A framework is a bet. You are trading control for speed, and you are betting that the abstractions the authors chose will still fit your problem a year from now. Get it right and you skip weeks of plumbing: tool calling loops, retries, streaming, state persistence, tracing. Get it wrong and you spend those weeks fighting the framework instead, reading its source to find out why a prompt was rewritten or why a callback fired twice.
The landscape is also more stable than it used to be. Most of the big projects have reached 1.0 or later: LangChain is on the 1.4 line, LangGraph on 1.2, CrewAI on 1.15, Microsoft Agent Framework on 1.22, Google's Agent Development Kit on 2.12, Pydantic AI on 2.58 and the Vercel AI SDK on version 7 (versions checked on PyPI and npm in October 2026). Stability means you can pick based on design, not just on who shipped last week.
How it works
I think about frameworks in layers. Each layer solves a different problem, and many real systems use one tool per layer.
Rendering diagram…
- Provider SDKs (OpenAI, Anthropic, Google) are the floor. Everything else wraps them.
- Model and tool abstractions give you one interface across providers: LangChain chat models, the Vercel AI SDK
generateText, Pydantic AI'sprovider:modelstrings. - Orchestration is where the real differences live. Some frameworks give you an agent loop (LangChain
create_agent, OpenAI Agents SDK, Claude Agent SDK, Pydantic AI). Some give you an explicit graph or workflow engine (LangGraph, LlamaIndex Workflows, CrewAI Flows, Microsoft Agent Framework workflows, Mastra workflows). Some give you a compiler that optimizes prompts for you (DSPy). - Data layer frameworks focus on getting your documents into the model: LlamaIndex is the strongest here.
- Observability (LangSmith, or OpenTelemetry based tools) sits across everything.
The question to ask is not "which framework" but "which layer is my hard problem in?"
Reference architecture
Here is the decision process I walk teams through. It is deliberately boring.
Rendering diagram…
Two notes on this chart. First, "Locked into one model vendor" is not an insult. If you already run everything on Claude or on Gemini, the vendor's own SDK usually gets new features first and has the fewest layers between you and the API. Second, the boxes combine. A common stack I see is LlamaIndex for ingestion, LangGraph for orchestration and LangSmith for traces, or the Vercel AI SDK for the UI with a Python agent service behind it.
Code
The best way to calibrate is to see how little code the "no framework" baseline needs. This is a full tool calling loop against the Anthropic Messages API in Python, no framework involved:
import anthropic
client = anthropic.Anthropic()
tools = [{
"name": "get_weather",
"description": "Get the current weather for a city",
"input_schema": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
},
}]
def get_weather(city: str) -> str:
return f"It's sunny in {city}"
messages = [{"role": "user", "content": "Weather in Lisbon?"}]
while True:
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
tools=tools,
messages=messages,
)
messages.append({"role": "assistant", "content": response.content})
if response.stop_reason != "tool_use":
break
results = []
for block in response.content:
if block.type == "tool_use":
results.append({
"type": "tool_result",
"tool_use_id": block.id,
"content": get_weather(**block.input),
})
messages.append({"role": "user", "content": results})
print(response.content[0].text)
That is about 40 lines. Now compare it with the LangChain version:
from langchain.agents import create_agent
def get_weather(city: str) -> str:
"""Get weather for a given city."""
return f"It's sunny in {city}"
agent = create_agent(model="claude-sonnet-4-6", tools=[get_weather])
result = agent.invoke({"messages": [{"role": "user", "content": "Weather in Lisbon?"}]})
The framework saved 30 lines, but more importantly it gave you a loop that already handles streaming, provider switching, middleware and checkpointing. If you need none of that, the 40 lines are fine. If you need all of it, writing it yourself is a project.
Trade-offs and pitfalls
What frameworks buy you: provider portability, a tested agent loop, streaming plumbing, persistence and human in the loop primitives, integrations with hundreds of vector stores and tools, and a tracing story.
What they cost you: another dependency that moves fast, abstractions that hide the actual prompt, stack traces through code you did not write, and occasionally features arriving later than in the raw provider API.
Pitfalls I see repeatedly:
- Picking by GitHub stars. Pick by the layer your hard problem lives in.
- Using a multi-agent framework for a single agent problem. Most "multi-agent" demos are one agent with good tools. Start with one.
- Mixing two orchestration frameworks. One data framework plus one orchestration framework is fine. Two orchestration frameworks fighting over the loop is not.
- Not reading the prompt. Whatever you pick, turn on tracing on day one so you can see exactly what goes to the model.
- Treating the framework as the architecture. Keep your business logic in plain functions and let the framework call them. That makes switching later a refactor, not a rewrite.
When to pick a framework: you need multi-step agents, durable state, human approval steps, multiple providers, or a large integration catalogue, and you want a team to share one mental model.
When not to: a single prompt with structured output, a latency critical path where every layer counts, or a team that already has a thin internal wrapper that works. In those cases the provider SDK plus a tracing library is the most honest choice.
Checklist
- Write down which layer your hard problem lives in before comparing frameworks.
- Prototype the feature with the raw provider SDK first, even if you throw it away.
- Pick at most one orchestration framework per service.
- Keep tools and business logic as plain functions with type hints.
- Turn on tracing from the first commit.
- Pin framework versions and read changelogs before upgrading.
- Re-evaluate the choice after the first real production incident, not before.