Choosing Frameworks: Lock-In, Upgrades and Benchmarks
Pick for what you must control and what you can maintain. Then keep the door open to change your mind.
Start from your requirements, not from a list of popular names. Rule out options that fail a must-have, build the same small task in two or three of the rest, and compare behavior on failures as well as on success. Keep business rules and tools in ordinary code behind a small interface, pin versions, and treat each upgrade as a change that needs testing. Calling a model API directly is a valid choice.
What you will learn: what a framework does for you, when a plain loop is enough, how to score options honestly, how to read benchmarks, how to limit lock-in, how to handle upgrades and where to find the main SDKs.
Prerequisites: The Agent Loop: Observe, Reason, Plan, Act, Reflect and a first look at Orchestration vs Automation vs Frameworks.
What a framework actually does
At its center an agent is a loop: send the conversation to a model, run any tool it asks for, add the result, repeat until it answers or a limit is reached. A framework packages that loop with the surrounding work. Different products package different amounts, which is why comparing them feature by feature can mislead.
| Layer | What it covers | You still own |
|---|---|---|
| Model API client | Requests, streaming, typed responses, transport retries | The loop, tools, state and limits |
| Agent SDK | The loop, tool schemas, handoffs, guardrail hooks, tracing | Permissions, business rules, durability choices |
| Orchestration runtime | Graphs or workflows, checkpoints, pause and resume | State design, safe repeats, operations |
| Hosted agent service | Running, scaling, isolating and storing sessions | Data boundaries, cost control, exit plan |
Direct API calls or an abstraction
A hand-written loop is often under a hundred lines, shows every prompt and makes debugging simple. Its costs arrive later: you write streaming, parallel tool calls, retries, context trimming, approvals and tracing yourself, and each provider change is yours to absorb.
| Choose a plain loop when | Choose a framework when |
|---|---|
| You have a handful of tools and one model provider | Several agents hand work to each other |
| Runs finish in one request | Runs pause for hours and must resume |
| You need to see and control every prompt | You want standard tracing and approval hooks |
| The team is learning how agents work | The team would otherwise build a runtime by accident |
A useful test is to ask what you would delete if you adopted the framework. If the answer is only twenty lines, the new dependency may cost more than it saves.
Write requirements first
Separate must-haves, which exclude an option, from preferences, which are scored. Mixing them lets a pleasant feature outweigh a missing necessity.
- Languages and runtimes your team can operate in production
- Model providers you must support, including any that run in your own environment
- Whether runs need to pause for approval and resume after a restart
- How tools are authorized, and whether a person can refuse an action
- Where conversation and state data may be stored, and for how long
- License terms, support status and the cost of any paid parts
- How traces reach the monitoring you already use
Run the same small trial
Documentation shows the happy path. A trial of a few days shows the rest. Give every candidate the same task, the same model and the same tools, including awkward cases.
| Trial case | What to observe |
|---|---|
| Normal request using two tools | Amount of code, clarity of the trace |
| Tool raises an error | What the model sees, and whether anything retries unasked |
| Model asks for a tool that does not exist | Whether the run recovers or crashes |
| Action needs approval | Whether anything happens before approval |
| Process killed mid-run | What survives and what repeats |
| Endless loop | Which limit stops it and what it reports |
| Test without a live model | Whether a fake model can be plugged in |
The last row matters more than it looks. A framework that accepts a scripted stand-in lets you test control flow in seconds and at no cost. Most examples in this section work that way.
Score, then test the score
A weighted table makes a choice discussable. It can also lend false precision, so check whether small changes in the weights alter the result. The numbers below are invented to show the method; they rate no real product.
"""Weighted choice with hard requirements and a stability check."""
MUST = ["language", "approval_pause", "supported"]
WEIGHTS = {"debuggability": 5, "recovery": 4, "team_skill": 3,
"ecosystem": 2}
# Scores from 1 to 5 come from your own trial, not from this example.
OPTIONS = {
"plain loop": {"language": True, "approval_pause": True,
"supported": True, "debuggability": 5, "recovery": 2,
"team_skill": 4, "ecosystem": 2},
"graph runtime": {"language": True, "approval_pause": True,
"supported": True, "debuggability": 3,
"recovery": 5, "team_skill": 3, "ecosystem": 4},
"old library": {"language": True, "approval_pause": True,
"supported": False, "debuggability": 4,
"recovery": 4, "team_skill": 5, "ecosystem": 4},
}
def total(option, weights):
return sum(option[name] * weight for name, weight in weights.items())
def rank(weights):
passed = {name: o for name, o in OPTIONS.items()
if all(o[m] for m in MUST)}
return sorted(((total(o, weights), name)
for name, o in passed.items()), reverse=True)
for name, option in OPTIONS.items():
failed = [m for m in MUST if not option[m]]
if failed:
print(f"excluded: {name} (fails {', '.join(failed)})")
for score, name in rank(WEIGHTS):
print(f"{score:3} {name}")
winner = rank(WEIGHTS)[0][1]
flips = []
for criterion in WEIGHTS:
for change in (-2, 2):
trial = dict(WEIGHTS)
trial[criterion] = max(0, trial[criterion] + change)
if rank(trial)[0][1] != winner:
flips.append(f"{criterion} {change:+}")
print("winner:", winner)
print("changes the winner:", ", ".join(flips) or "nothing tested")
Output:
excluded: old library (fails supported)
52 graph runtime
49 plain loop
winner: graph runtime
changes the winner: debuggability +2, recovery -2, ecosystem -2
The unsupported option is removed before scoring, however well it would have scored. The leader is only three points ahead, and three modest weight changes reverse it. The honest conclusion is that the two options are close, so the decision should rest on the trial evidence and on which weakness the team can live with, not on the total.
Reading benchmarks
Published agent scores mostly reflect the model, the prompts, the tool descriptions and the task set. The framework is one ingredient. Two results are comparable only when those other ingredients are held fixed, which is rarely stated clearly.
| Measure | How to collect it | Common trap |
|---|---|---|
| Task success | Check the end state, over repeated runs | Judging by how the answer reads |
| Cost per successful task | All tokens and tool fees divided by successes | Ignoring failed and retried runs |
| Model calls per task | Count from traces | Hidden planning or summarizing calls |
| Latency spread | Median and slow tail | Reporting only an average |
| Added overhead | Same script with a fake model | Treating it as important when models dominate |
| Recovery | Inject failures at fixed points | Never testing it at all |
Run each case many times because outputs vary. Report the spread, the number of runs, model versions and the date. Agent Evaluation Framework explains how to build the task set.
Who ran it and what do they sell? Were all systems given the same model and a fair configuration? Are the tasks and code published? How many runs? What counts as success? If the answers are missing, treat the chart as advertising.
Lock-in and portability
Lock-in is the cost of leaving. Part of it is code written against one library, but the larger part is often stored data, prompts tuned to hidden behavior, traces and operating habits.
| Source of lock-in | What reduces it |
|---|---|
| Tools written as framework classes | Plain functions with a thin wrapper, or MCP servers |
| Business rules inside prompts or callbacks | Rules in your own services, called by tools |
| Proprietary state format | Your own records for anything you must keep |
| One provider's message shapes | Your own result type at the boundary |
| Hosted sessions and memory | A tested export, and a written retention rule |
| Agents calling agents inside one library | Ordinary APIs or an agent protocol between teams |
Do not build a universal wrapper that hides every feature. It becomes a second framework that only your team knows. Keep the interface as small as what your application needs, and let each adapter use its framework fully.
"""Keep your rules outside the framework, behind a small interface."""
from dataclasses import dataclass, field
from typing import Callable, Protocol
def order_status(order_id: str) -> str: # business code: no framework
return {"A-17": "delayed"}.get(order_id, "unknown")
TOOLS: dict[str, Callable[..., str]] = {"order_status": order_status}
@dataclass
class RunRecord:
answer: str
tool_calls: list = field(default_factory=list)
stopped: str = "finished"
class AgentRunner(Protocol): # the only thing the application sees
def run(self, request: str, max_steps: int) -> RunRecord: ...
class PlainLoopRunner:
def __init__(self, decide):
self.decide = decide # a model call in real code
def run(self, request, max_steps):
record, notes = RunRecord(answer=""), [request]
for _ in range(max_steps):
action = self.decide(notes)
if "answer" in action:
record.answer = action["answer"]
return record
result = TOOLS[action["tool"]](**action["args"])
record.tool_calls.append(action["tool"])
notes.append(result)
record.stopped = "step limit"
return record
def scripted(notes):
if len(notes) == 1:
return {"tool": "order_status", "args": {"order_id": "A-17"}}
return {"answer": f"Your order is {notes[-1]}."}
def looping(notes):
return {"tool": "order_status", "args": {"order_id": "A-17"}}
def contract(make_runner):
"""Every adapter, in any framework, has to pass these."""
good = make_runner(scripted).run("Where is A-17?", max_steps=4)
assert "delayed" in good.answer
assert good.tool_calls == ["order_status"]
stuck = make_runner(looping).run("Where is A-17?", max_steps=3)
assert stuck.stopped == "step limit" and len(stuck.tool_calls) == 3
return good
record = contract(PlainLoopRunner)
print("contract passed")
print(record)
Output:
contract passed
RunRecord(answer='Your order is delayed.', tool_calls=['order_status'], stopped='finished')
The application depends on AgentRunner and RunRecord, never on a library's objects. The contract function is the valuable part: an adapter for another framework is acceptable when it passes the same checks, including the stuck-loop case. Grow the contract as you find behavior you rely on, such as approval before an action or resumption after a restart.
Planning a migration
Saved state rarely moves between libraries. Plan to let in-flight runs finish where they are, or write and test a converter for the few fields that matter. During shadow runs, replace tools that change things with recorders so nothing happens twice.
Upgrade and compatibility strategy
Agent libraries move quickly, and their stated promises differ. As of November 2026, LangChain and LangGraph describe their 1.0 releases as long-term support lines, PydanticAI states that minor releases carry no intentional breaking changes, and Spring AI 2.0 shipped breaking changes from 1.1. DSPy's 3.5 notes warn that prompts, defaults and APIs changed. Read each project's policy for the version you use, because a promise about code interfaces may not cover prompts or behavior.
- Pin exact versions and commit the lock file, including transitive packages.
- Read the changelog and migration guide before upgrading, not after tests fail.
- Upgrade one library family at a time.
- Run unit tests with a fake model, then the evaluation set with the real one.
- Check that state saved by the old version can be read, or drain it first.
- Compare the prompts and requests sent before and after; a default may have changed.
- Release to a small share, with a tested way back.
An upgrade may alter a default prompt, a retry count, a step limit or which data a trace uploads. Tests of types and functions will pass. Only recorded requests and task evaluations show the difference.
Following release notes
Assign one owner per dependency. Subscribe to the release feed, and sort each entry into security fix, behavior change, deprecation or feature. Deprecation warnings are free notice: fail the build on new ones in your own code so they do not pile up.
Watch project status too. Names and support change: Anthropic's Claude Code SDK became the Claude Agent SDK, and the AutoGen repository now says the project is archived and no longer maintained. A library that still installs is not necessarily one that still receives security fixes.
| Health signal | Why look |
|---|---|
| Stated support and deprecation policy | Sets what you can plan around |
| Regular releases with clear notes | Shows maintenance and makes upgrades predictable |
| Security reporting process | Shows how faults are handled |
| License of core and add-ons | Some features may carry different terms |
| Default telemetry | Several libraries send usage data unless disabled |
Framework and SDK directory
This is a map to starting points, not a ranking. Each guide linked in the first column goes further.
| Guide | Projects | Languages |
|---|---|---|
| Provider SDKs | OpenAI Agents SDK, Claude Agent SDK, Anthropic API client | Python, TypeScript |
| LangChain family | LangChain, LangGraph | Python, TypeScript |
| CrewAI | Crews and flows | Python |
| Microsoft | Agent Framework, Semantic Kernel, AutoGen | Python, .NET |
| Data and optimization | LlamaIndex Workflows, Haystack, DSPy | Mainly Python |
| Other Python | PydanticAI, smolagents, Agno | Python |
| Cloud providers | Google ADK, Amazon Bedrock AgentCore | Several |
| TypeScript | Vercel AI SDK, Mastra | TypeScript |
| Java | Spring AI, LangChain4j | Java and JVM |
Illustrative decision
A support team needs refunds approved by a person, sometimes the next day. A plain loop handles questions well but loses paused requests on restart. A short trial shows that one graph runtime keeps them but needs more effort to trace. The team keeps simple questions on the plain loop, moves only refunds to the runtime, shares the same tool functions between them and records why, with a date to review.
Write that record down: requirements, options tried, evidence, choice, known weaknesses and what would make you revisit it. It is worth more than the scores.
Common mistakes
| Mistake | Better practice |
|---|---|
| Choosing from popularity or a demo | Trial your own task, including failures |
| Scoring must-haves with preferences | Exclude first, score second |
| Adopting several frameworks at once | One default, with written exceptions |
| Floating versions | Pin, lock and upgrade deliberately |
| Assuming saved state is portable | Plan draining or conversion |
| Wrapping everything "just in case" | A small interface and a contract test |
Checklist
- The need for a framework is stated in one sentence
- Must-haves are separate from preferences
- At least two options ran the same trial, including failure cases
- Support status, license and telemetry defaults were checked
- Business rules and tools work without the framework
- A contract test covers the behavior you rely on
- Versions are pinned and an owner follows release notes
- The decision and its review date are recorded
Frequently asked questions
Do I need a framework to build an agent?
No. A model client, a loop, a few functions and clear limits make a working agent. Frameworks help when you need pauses, handoffs, durability or shared conventions.
Which framework is best?
There is no general answer. It depends on language, hosting, durability and approval needs, and on what your team can debug at night.
Can I switch model providers later?
Often the code allows it, but prompts, tool behavior, limits and costs differ. Rerun your evaluation set before calling it a switch.
How often should I upgrade?
Apply security fixes promptly and take other releases on a regular schedule. Long gaps turn several small migrations into one large one.
References and further reading
- LangChain and LangGraph release policy
- PydanticAI version policy
- Spring AI 2.0.0 announcement
- DSPy 3.5 release notes
- Claude Agent SDK migration guide
- AutoGen repository status notice
Next steps
OpenAI and Anthropic Agent Development
Start with the provider SDKs.
LangChain and LangGraph
Agents on a graph runtime.
Agent Testing: Unit to End-to-End
Test behavior before you switch.