Module 7 · Lesson 6 · 13 min read

How do you choose the right agent framework?

Choosing an Agent Framework

Introduction

There is no absolutely best framework, only a framework better suited to a specific problem. In this lesson we turn the problem into requirements, build a weighted decision matrix in Python, and learn how to test the choice with a small prototype before committing.

Learning objectives

  • Extract the requirements for choosing a framework from the problem description
  • Link each type of need to the candidate framework for it, with justification
  • Build a weighted decision matrix and interpret its result
  • Design a small prototype to validate the choice

Start from the problem, not from the framework

The most common mistake when building a first real agent is choosing the framework because it is the most popular this month, then trying to bend the problem to fit it. The right way is the reverse: describe the problem first, then extract the requirements, then evaluate the frameworks against these requirements. And remember Anthropic's recommendation in "Building effective agents" (2024): start with the simplest solution that works, and add complexity only when it is shown to improve the result.

Questions that define the requirements

Before any comparison, answer these questions in writing:

  1. Who decides the next step? Is the path fixed and known (a workflow), or does the model decide it according to the conversation (an agent)?
  2. How long does the run take? Seconds in a conversation, or hours and days waiting for human approvals? The second case requires persistence and resumption.
  3. How many agents do you really need? Many tasks are served well enough by a single agent with good tools.
  4. What is the team's environment? The programming language (Python only, or .NET too), the available Python version, and the allowed model provider.
  5. What are the monitoring and security requirements? Do you need detailed tracing, guardrails and approval points that cannot be skipped?
ObservationReasoning engineLLM / ReasonerInstructions and goalInstructions / GoalMemoryPlannerToolsTools / APIsEnvironmentSafety guardrailsGuardrails
The agent's components: a reasoning engine (usually a language model) governed by the instructions, connected to memory, tools and the planner, and surrounded by safety controls.

A quick map: when does each framework shine?

According to the official documentation (reviewed 18 November 2026), and with the reminder that these are teaching generalizations, not final judgments:

Main needNatural candidateReason
A conversation that moves between specialists, with ready-made tracingOpenAI Agents SDKAgent, handoff, guardrails and tracing with few concepts
A long, controlled path with resumption and human approvalLangGraphAn explicit state graph, durable execution and persistence
Rapid prototyping of a team of roles that produces contentCrewAIAgents with roles and tasks and a sequential or hierarchical process
A .NET and Python environment, or moving from AutoGen/Semantic KernelMicrosoft Agent FrameworkThe official successor, with agents plus workflows
A simple task with one or two toolsNo frameworkA hand-written loop is clearer and easier to debug

Pay attention to practical constraints too: CrewAI supports Python from 3.10 up to (but not including) 3.14, agent-framework requires 3.11 or later, and openai-agents requires 3.10 or later. A constraint like this may settle the choice on an old university server.

A practical example: a weighted decision matrix

The scenario: the Dean of Student Affairs wants an agent that receives requests to postpone exams, checks the documents, waits for the advisor's approval (which may take two days), then updates the system. The team works in Python only.

We turn the requirements into weighted criteria, rate each option from 1 to 5, then compute the weighted total. These scores are the team's estimates for this scenario and are not published measurements:

python
# A weighted decision matrix - standard Python without libraries
weights = {"Resume after a long wait": 0.30, "Guaranteed human approval": 0.25,
           "Ease of learning": 0.20, "Tracing and monitoring": 0.15, "Fit with the team's environment": 0.10}

scores = {  # hypothetical estimates from the team (1 to 5)
    "Hand-written loop":        {"Resume after a long wait": 1, "Guaranteed human approval": 3,
                          "Ease of learning": 5, "Tracing and monitoring": 2, "Fit with the team's environment": 5},
    "OpenAI Agents SDK": {"Resume after a long wait": 3, "Guaranteed human approval": 3,
                          "Ease of learning": 4, "Tracing and monitoring": 5, "Fit with the team's environment": 5},
    "LangGraph":         {"Resume after a long wait": 5, "Guaranteed human approval": 5,
                          "Ease of learning": 3, "Tracing and monitoring": 4, "Fit with the team's environment": 5},
}

def weighted(option):
    return round(sum(weights[c] * s for c, s in scores[option].items()), 2)

for name in sorted(scores, key=weighted, reverse=True):
    print(f"{name:20} {weighted(name)}")

In this scenario the explicit graph comes out ahead because resuming after a long wait and guaranteed approval carry half the weight. If the scenario changed to "an instant FAQ conversation", the weights, and perhaps the result, would change.

A small test before committing

Do not settle for the table. Set aside a day for a spike with the smallest version of the task in the top two frameworks, and measure concrete things: how many lines did you need? Could you stop the run and resume it? Does every tool call appear in the trace? Can you test the steps without calling a real model?

Summary

Choosing a framework starts from the problem: who decides the next step, how long the run takes, how many agents we need, and what the team's environment and security requirements are. Each framework has areas where it shines, and sometimes the best solution is a hand-written loop with no framework. The weighted matrix makes the decision explicit, provided the weights are set before rating. Then a small prototype confirms the choice before committing.

Terms

TermEnglishDefinition
RequirementsRequirementsWhat the system must achieve, against which the choice is measured
Decision matrixDecision MatrixA table of criteria, weights and scores for comparing options
Exploratory prototypeSpikeA short experiment to test a technical hypothesis before committing
Version pinningVersion PinningSpecifying the library's version number in the requirements file
Workflow vs agentWorkflow vs AgentA fixed path set by code versus a path decided by the model

Review questions

  1. What are the five questions that help define the requirements for choosing a framework?
  2. Why must the weights be set before rating the frameworks?
  3. When is using no framework at all the best option?
  4. What do you measure in a small prototype to confirm the choice?

References