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.

BeginnerIntermediateExpert · 13 min read · Last updated:

In short

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.

Beginner What you are choosing

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.

LayerWhat it coversYou still own
Model API clientRequests, streaming, typed responses, transport retriesThe loop, tools, state and limits
Agent SDKThe loop, tool schemas, handoffs, guardrail hooks, tracingPermissions, business rules, durability choices
Orchestration runtimeGraphs or workflows, checkpoints, pause and resumeState design, safe repeats, operations
Hosted agent serviceRunning, scaling, isolating and storing sessionsData boundaries, cost control, exit plan
One callno tools
Plain loopfew tools, short runs
Agent SDKhandoffs, approvals
Runtime or servicelong, durable, many users
Move right only when a requirement pushes you there.

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 whenChoose a framework when
You have a handful of tools and one model providerSeveral agents hand work to each other
Runs finish in one requestRuns pause for hours and must resume
You need to see and control every promptYou want standard tracing and approval hooks
The team is learning how agents workThe 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
Intermediate Trials, scores and benchmarks

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 caseWhat to observe
Normal request using two toolsAmount of code, clarity of the trace
Tool raises an errorWhat the model sees, and whether anything retries unasked
Model asks for a tool that does not existWhether the run recovers or crashes
Action needs approvalWhether anything happens before approval
Process killed mid-runWhat survives and what repeats
Endless loopWhich limit stops it and what it reports
Test without a live modelWhether 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.

MeasureHow to collect itCommon trap
Task successCheck the end state, over repeated runsJudging by how the answer reads
Cost per successful taskAll tokens and tool fees divided by successesIgnoring failed and retried runs
Model calls per taskCount from tracesHidden planning or summarizing calls
Latency spreadMedian and slow tailReporting only an average
Added overheadSame script with a fake modelTreating it as important when models dominate
RecoveryInject failures at fixed pointsNever 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.

Questions to ask of any chart

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-inWhat reduces it
Tools written as framework classesPlain functions with a thin wrapper, or MCP servers
Business rules inside prompts or callbacksRules in your own services, called by tools
Proprietary state formatYour own records for anything you must keep
One provider's message shapesYour own result type at the boundary
Hosted sessions and memoryA tested export, and a written retention rule
Agents calling agents inside one libraryOrdinary 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

Freeze behaviorcontract and evaluation set
Build adapternew framework
Shadowno side effects
Small sharewatch and compare
Drain old runsthen remove
Paused runs usually have to finish on the system that started them.

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.

Expert Upgrades and long-term ownership

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.

  1. Pin exact versions and commit the lock file, including transitive packages.
  2. Read the changelog and migration guide before upgrading, not after tests fail.
  3. Upgrade one library family at a time.
  4. Run unit tests with a fake model, then the evaluation set with the real one.
  5. Check that state saved by the old version can be read, or drain it first.
  6. Compare the prompts and requests sent before and after; a default may have changed.
  7. Release to a small share, with a tested way back.
Behavior can change without an error

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 signalWhy look
Stated support and deprecation policySets what you can plan around
Regular releases with clear notesShows maintenance and makes upgrades predictable
Security reporting processShows how faults are handled
License of core and add-onsSome features may carry different terms
Default telemetrySeveral 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.

GuideProjectsLanguages
Provider SDKsOpenAI Agents SDK, Claude Agent SDK, Anthropic API clientPython, TypeScript
LangChain familyLangChain, LangGraphPython, TypeScript
CrewAICrews and flowsPython
MicrosoftAgent Framework, Semantic Kernel, AutoGenPython, .NET
Data and optimizationLlamaIndex Workflows, Haystack, DSPyMainly Python
Other PythonPydanticAI, smolagents, AgnoPython
Cloud providersGoogle ADK, Amazon Bedrock AgentCoreSeveral
TypeScriptVercel AI SDK, MastraTypeScript
JavaSpring AI, LangChain4jJava and JVM

Illustrative decision

Illustrative scenario, not a real organization

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

MistakeBetter practice
Choosing from popularity or a demoTrial your own task, including failures
Scoring must-haves with preferencesExclude first, score second
Adopting several frameworks at onceOne default, with written exceptions
Floating versionsPin, lock and upgrade deliberately
Assuming saved state is portablePlan 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

Next steps