SXF GUIDES / AGENT ARCHITECTURE · FRAMEWORK DECISIONS
AI Agent Frameworks Compared:
LangGraph vs CrewAI vs OpenAI Agents SDK vs Microsoft vs Google ADK
Which AI agent framework should you actually build with? Compare five production-relevant multi-agent frameworks by orchestration, state, memory, human approval, observability, vendor fit and true operating cost. Includes Python code sketches for the same test task, an interactive decision tool and source-linked methods—no invented benchmark winners.
What is the best AI agent framework?
It depends on the kind of control you need. Choose LangGraph for explicit, stateful execution graphs and recovery; CrewAI for collaborative agent roles with structured Flows; OpenAI Agents SDK for lightweight code-first tool loops and handoffs; Microsoft Agent Framework for typed enterprise workflows and Microsoft-oriented systems; and Google ADK for agents, sessions and graph workflows in the Google ecosystem. No framework automatically makes an agent reliable, safe or cheap. Start with the comparison table and verify on your own task.
BEST AI AGENT FRAMEWORKS · FEATURE MATRIX
LangGraph vs CrewAI vs OpenAI Agents SDK vs Microsoft Agent Framework vs Google ADK
These are five frameworks, five different default abstractions. All can help orchestrate tool-using agents, but their session semantics, flow control, review behavior and integrations differ. The table reflects official documentation reviewed on October 17, 2026; feature coverage can vary by package release, integration, deployment and paid tier. Treat it as a shortlist tool, not a certification of every deployment.
| Framework | Core execution | State and memory | Human-in-the-loop | Observability | Good starting fit |
|---|---|---|---|---|---|
| LangGraph | Explicit state graph, branching and resumable execution | Checkpointer; stores for longer-lived data | Interrupt/resume + developer-defined policy nodes | Graph/run traces; external observability integration | Stateful long-running or highly controlled agent workflows |
| CrewAI | Role-based Crews plus event-driven Flows | Crew memory, Flow state; checkpoint options | Human feedback and tier-dependent HITL options | Crew tracing and external integrations | Teams of specialists coordinated by explicit business Flows |
| OpenAI Agents SDK | Agent/Runner loops, handoffs and agents-as-tools | Sessions, history and resumable state APIs | Guardrails, tool gates and human review | Built-in tracing; API configuration matters | Code-first OpenAI-oriented tool and specialist orchestration |
| Microsoft Agent Framework | Typed executors, graph workflows, agents and middleware | Sessions; workflow checkpoints | Explicit human input and workflow state | Telemetry and enterprise integrations | Microsoft/.NET + Python enterprise workflow stacks |
| Google ADK | Agents with graph/dynamic and template workflow options | Sessions/state/memory services | Tools, confirmation controls, workflow gates | Logging, traces, evaluation tools | Google Cloud and Gemini-centric agent services |
Important Microsoft clarification: Microsoft explicitly calls Agent Framework the direct successor to both AutoGen and Semantic Kernel. It combines their patterns, but is not a drop-in replacement for all old code. Its Python functional workflow API is documented as experimental; the graph builder is the more established comparison surface here. [9–11]
Google's documentation says graph and dynamic workflows supersede older sequential/loop/parallel templates for advanced designs in Python and Go. Those templates still explain common patterns, but should not be confused with the whole platform. [12–13]
FRAMEWORK SELECTION BY ARCHITECTURAL NEED
Which AI agent framework should you choose?
LangGraph
Use it when the path of execution is a product requirement: conditional edges, explicit state, checkpointing, interrupts, retries and recovery across process restarts. A graph makes the control surface inspectable but requires careful state design and idempotent side effects.
Official LangGraph quickstart ↗CrewAI
Use it when roles and task delegation are central to the application, and combine Crews with Flows for conditional business rules, stateful routing and reliability. Check current HITL capabilities and the deployment tier you actually use.
Official CrewAI Flows ↗OpenAI Agents SDK
Use it when agent loops, function tools, handoffs, agents-as-tools, session management, structured output and built-in tracing should be expressed directly in application code. Bring your own production storage, access controls and evaluators.
Official SDK overview ↗Microsoft Agent Framework
Use it when you need explicit enterprise workflow orchestration, typed executors, sessions and checkpoints, especially in a .NET or Microsoft-heavy architecture. Distinguish Python preview/experimental features from stable deployment commitments.
Official Microsoft overview ↗Google ADK
Use it for agents integrated into the Google ecosystem with state, sessions, evaluation and workflow composition. Its architecture now includes graph-style controls alongside the familiar templates; deployment features and supported languages are version-dependent.
Official Google ADK workflows ↗Plain Python
Often the best fit is no agent framework. A deterministic policy rule, a database query and one optional LLM drafting step are less difficult to test and audit than an autonomous team handling every step.
See the deterministic alternative ↓Want to distinguish tools vs subagents vs plugins vs skills? That is a different technical question covered in our AI coding agent architecture research. This comparison focuses on which orchestration runtime you should select and why.
SXF DECISION TOOL · FREE / LOCAL
Interactive AI agent framework selector
Answer three practical questions and the worksheet displays an editorial starting recommendation plus alternatives and proof-of-concept gates. It does not call vendors, ingest private data, simulate costs or claim live benchmark rankings.
This worksheet is an editorial heuristic. Test the current implementation and requirements before selecting technology.
ONE COMMON TASK · FIVE IMPLEMENTATIONS
Compare agent frameworks using the same practical test
Claims like “LangGraph is faster than CrewAI” require a controlled benchmark—not a marketing comparison. The common scenario here is a fictional refund-support ticket. The customer requests a $149 refund after 47 days; the disclosed policy permits auto-eligibility only within 30 days. A correct run should return escalate for human review, create a safe draft reply and perform zero refund actions.
| Dimension | Fixed test contract | Pass condition |
|---|---|---|
| Input | Ticket age 47 days; amount $149; threshold 30 days | Same literal task across variants |
| Decision | Assess eligibility using external deterministic policy | Must say escalate / not auto-approved |
| Reply | Draft a polite customer-facing message | No guarantee of a refund |
| Authority | No refund/write tool is available in this experiment | Zero external side effects |
| Evidence | Save output, trace, exception and duration | Independent acceptance checks |
| Repeatability | Run with fixed model version and settings in each framework | Never discard failed trials |
Scope of the examples: LangGraph demonstrates a working deterministic graph; CrewAI and OpenAI demonstrate minimal LLM-backed configurations; Microsoft and Google illustrate documented integration entry points. These examples are not an executed head-to-head benchmark. Different framework versions and provider credentials are required for runtime tests. Keep policy enforcement outside the model for a production build.
For ready-to-edit JSON fixtures, download the scenario dataset. The tests are synthetic examples and intentionally do not connect to any real payment or refund system.
EXAMPLE 01 · LANGGRAPH
LangGraph Python example: explicit state and edges
The most instructive LangGraph example starts by taking the nondeterministic model out of the eligibility decision. The graph itself makes the two policy stages visible: assess the age, then draft a safe answer. A real agent can replace drafting with a model node later. A production graph should use a persistent checkpointer—not the in-memory checkpoint pattern reserved for local demos. [1–2]
# pip install langgraph
from typing import TypedDict
from langgraph.graph import StateGraph, START, END
POLICY_DAYS = 30
class State(TypedDict):
age_days: int
amount_usd: int
outcome: str
draft: str
def policy_check(state: State):
allowed = state["age_days"] <= POLICY_DAYS
return {"outcome": "eligible" if allowed else "escalate"}
def draft_reply(state: State):
if state["outcome"] == "escalate":
text = "This request needs human review. No refund was issued."
else:
text = "This refund may be eligible, subject to final approval."
return {"draft": text}
builder = StateGraph(State)
builder.add_node("policy", policy_check)
builder.add_node("draft", draft_reply)
builder.add_edge(START, "policy")
builder.add_edge("policy", "draft")
builder.add_edge("draft", END)
app = builder.compile()
result = app.invoke({"age_days": 47, "amount_usd": 149,
"outcome": "", "draft": ""})
assert result["outcome"] == "escalate"
print(result["draft"])The benefit is traceable state transitions and a clear insertion point for human approval before any write node. For long-running sessions, look at LangGraph checkpointers and stores rather than assuming “memory” is just passing chat messages.
EXAMPLE 02 · CREWAI
CrewAI Python example: agent roles and tasks
A Crew starts with roles, goals and tasks. You can combine specialist agents, but the example intentionally keeps one agent to avoid adding orchestration without need. Crews handle collaborative task execution; Flows let you design explicit branching and durable business coordination. [3–5]
# pip install crewai
# Requires credentials for your selected LLM provider.
from crewai import Agent, Task, Crew, Process
analyst = Agent(
role="Policy explainer",
goal="Apply the supplied refund rule; never issue refunds",
backstory="You analyze policy facts without acting on accounts.",
allow_delegation=False,
)
task = Task(
description=(
"Policy: only requests <= 30 days can be auto-eligible. "
"Ticket: 47 days old, $149. Explain whether escalation "
"is required. Draft a reply. Never execute a refund."
),
expected_output="A decision and customer-safe explanation.",
agent=analyst,
)
crew = Crew(agents=[analyst], tasks=[task],
process=Process.sequential, verbose=False)
result = crew.kickoff()
print(result)
# Independently verify the decision; this is NOT proof of policy compliance.The agent's output still needs independent policy validation. In production put the eligibility cutoff and permissions in code, and make the crew responsible for drafting or investigating uncertain cases—not moving money itself.
EXAMPLE 03 · OPENAI AGENTS SDK
OpenAI Agents SDK: agents, tools, handoffs and traces
The OpenAI Agents SDK provides a compact Agent/Runner loop with typed tools, handoffs, guardrails, session options and built-in tracing. Handoffs transfer conversation control; agents-as-tools keep a manager in charge. For this ticket there is no need for multiple agents or an action tool. [6–8]
# pip install openai-agents
# Set OPENAI_API_KEY and a model your account supports.
import asyncio
from agents import Agent, Runner
agent = Agent(
name="Refund policy reviewer",
instructions=(
"You have no refund tools. The 30-day cutoff is hard. "
"Never approve or execute a refund over 30 days. "
"For disallowed requests, explicitly require human review."
),
)
async def main():
result = await Runner.run(
agent,
"Ticket: 47 days since purchase, amount $149. "
"Return the policy decision and a safe customer reply."
)
print(result.final_output)
# Validate result against deterministic policy before acting.
asyncio.run(main())For consequential actions, design a server-owned approval check around the tool and a durable record of the approver. The SDK's model-visible instructions are not a substitute for backend authorization. Check trace data handling and Zero Data Retention restrictions before enabling hosted observability.
EXAMPLE 04 · MICROSOFT AGENT FRAMEWORK
Microsoft Agent Framework: workflows, executors and enterprise state
Agent Framework's explicit workflow model uses typed executors and edges; sessions, checkpoints and middleware support the operational architecture. Microsoft calls this the successor to Semantic Kernel and AutoGen. Do not assume legacy AutoGen code can import into the new SDK unchanged. [9–11]
# pip install agent-framework # check release-specific extras
# Skeleton based on the documented Python workflow builder.
from agent_framework import WorkflowBuilder
# Implement these as typed @executor functions or executor classes.
# They must accept the current workflow message/context contract.
policy_executor = ... # deterministic 30-day rule
reply_executor = ... # creates a customer-safe draft
builder = WorkflowBuilder(start_executor=policy_executor)
builder.add_edge(policy_executor, reply_executor)
workflow = builder.build()
# Configure checkpoints / approval handling for production.
# See Microsoft's official WorkflowBuilder examples linked below.This sketch deliberately uses placeholders for custom executors, rather than pretending to supply a complete application without provider setup or typed context signatures. For an end-to-end implementation, follow the official workflow tutorial and pin the tested SDK version.
EXAMPLE 05 · GOOGLE ADK
Google ADK Python example: agent definition and workflow evolution
Google ADK supports tools, sessions, agent compositions and workflows. Its newer graph workflow approach should be evaluated for conditional business processes; the simple example below defines an agent without authorizing payments. [12–13]
# pip install google-adk
# Minimal ADK agent definition; configure Gemini credentials.
from google.adk.agents import Agent
root_agent = Agent(
name="policy_reviewer",
model="YOUR_SUPPORTED_GEMINI_MODEL",
instruction=(
"Policy: requests older than 30 days require human review. "
"Ticket is 47 days old, amount $149. Explain the decision "
"and draft a reply. Do not issue a refund."
),
)
# Run with the ADK runner / CLI using a configured app/session.
# For production, move the policy check into a deterministic tool
# or a graph workflow and gate any side effects with approval.For a production support workflow, use deterministic policy functions and the current ADK graph/flow facilities to gate side effects. Remember: the SDK does not supply an external payment system or human approver automatically.
STATE MANAGEMENT · PERSISTENCE · APPROVAL
How do state, memory and human approval compare?
Three often-confused capabilities need separate tests: conversation continuity (what the model can recall), workflow durability (which execution node has committed), and authorization (whether a particular action may occur). A framework can provide all three interfaces while leaving policy enforcement to your application.
| Question | What to implement | Failure to test |
|---|---|---|
| Conversation state | Scoped history, expiry, opt-out, tenant separation | Old customer data crosses accounts |
| Checkpoint durability | Committed node ID, replay semantics, version compatibility | Payment executes twice after retry |
| Tool authority | Server-side allowlist and delegated credentials | Prompt asks for unauthorized tool use |
| Human approval | Pause before irreversible tool, record approver and expiry | Approval arrives after the request was revoked |
| Observability | Redacted trace IDs, timings, token usage, error classes | Sensitive ticket contents leak into logs |
| Agent memory | Storage, retrieval, correction and deletion rules | Stale facts override current policy |
Implementation rule: never equate an agent saying “approved” with a signed, scoped backend permission. If a user requests a refund, deploy an explicit approval_required transition before execute_refund; the refund API must verify permission a second time. See our existing AI agent authorization, agent memory and agent security guides for those separate design layers.
FAIR FRAMEWORK BENCHMARKS · NOT VENDOR RANKINGS
How to benchmark AI agent frameworks fairly
There is no credible public basis for claiming one framework has the fastest or smartest agents in every workload. Most evaluation headlines measure a model, a specific benchmark or a complete integrated stack—not the orchestration library in isolation. Fix the model, prompt, tools, policies and input fixtures, then report which framework patterns were easier to build and operate under those constraints.
| Metric | Measurement | Interpretation |
|---|---|---|
| Policy accuracy | Verified correct decisions / all trials | Rejects unsafe approvals |
| Unauthorized actions | Count side effects without valid authorization | Critical gate: target zero |
| Reliability | Repeated-run success and failure categories | Do not cherry-pick one run |
| Latency | p50/p95 end-to-end, including tools | User-perceived delivery time |
| Cost | Model + tool + storage + retry + reviewer cost / accepted tasks | Useful only with comparable acceptance |
| Recovery | Interrupt/resume, idempotent replay, checkpoint integrity | Operational dependability |
| Developer time | Hours to implement and modify a real workflow | Framework complexity, not model intelligence |
cost per accepted task = (model + tools + storage + retries + review + infrastructure) / verified accepted tasksRun with multiple realistic task classes and document provider versions, temperature/reasoning settings and permitted tools. If two frameworks trigger different numbers of LLM calls, report that explicitly; it can be an orchestration effect.
Run a minimum viable pilot first, then test failures: tool timeouts, restarts after approval, expired credentials, malformed structured outputs, multiple tenants and cancellation. NIST recommends fit-for-purpose measurement, human oversight and documented limits. [14] The existing SXF agent evaluation scorecard offers further scenarios, while AI Agent Reliability separates model skill from repeated-run dependability.
WHEN NOT TO USE A MULTI-AGENT FRAMEWORK
Sometimes plain Python is the best agent framework
If every step is known and the task is reversible, a queue plus ordinary functions can be cheaper to inspect than an autonomous loop. For the 47-day ticket, your actual authorization control can be implemented in a few lines of deterministic code. Only use an LLM to draft a response after code has decided the refund must be escalated.
def review_ticket(days_since_purchase: int, amount_usd: int):
if days_since_purchase > 30:
return {"decision": "escalate", "refund_executed": False}
return {"decision": "needs_final_approval", "refund_executed": False}
case = review_ticket(47, 149)
assert case["decision"] == "escalate"
assert case["refund_executed"] is False
print(case)Scale from a single deterministic workflow to an agent framework only when dynamic routing, diverse tools, specialized knowledge, sessions, long-running state or operational review make that added complexity measurable and necessary.
PRODUCTION CHECKLIST
Security, observability and operational readiness
This is a browser-only checklist; ticking a box does not certify a deployment. Framework features are components inside a wider security boundary. Read prompt injection, MCP tool integration, and authorization and delegation before exposing any irreversible operation.
AI AGENT FRAMEWORK FAQ
Frequently asked questions about LangGraph, CrewAI, OpenAI Agents SDK and more
What is the best AI agent framework in 2026?
There is no universal winner. Choose LangGraph when explicit graphs, checkpoints and resume behavior dominate; CrewAI for role-based teams and Flows; OpenAI Agents SDK for a compact code-first handoff and tool loop; Microsoft Agent Framework for Microsoft-oriented typed workflows; or Google ADK for its agent and workflow ecosystem. Validate each against your task and operating constraints.
LangGraph vs CrewAI: which should I choose?
LangGraph exposes graph edges, state and execution control more directly. CrewAI is oriented around role-based crews and structured Flows. Choose with a proof of concept that requires interruption, replay, policy gates and observable handoffs; do not assume a library is faster or cheaper without testing.
Is OpenAI Agents SDK limited to one AI agent?
No. It supports multiple agents through handoffs and agents-as-tools, with sessions, tool use, guardrails and tracing. Model-provider support and specific feature behavior depend on configuration and API compatibility.
Does Microsoft Agent Framework replace AutoGen and Semantic Kernel?
Microsoft describes Agent Framework as their direct successor, combining the earlier projects' agent patterns and enterprise capabilities. Migration still requires checking actual APIs and deployment dependencies.
Is Google ADK a multi-agent framework?
Yes. Google ADK supports multiple agents, workflow patterns and state/sessions. Its documentation notes that newer graph workflows in ADK 2.0 for Python and Go supersede older template workflows for advanced orchestration.
What is the cheapest agent framework?
Do not equate open-source package availability with the cost to operate a workflow. Actual costs come from models, tokens, retries, tools, storage, tracing, human review, networking and infrastructure.
Do agent frameworks automatically make AI agents safe?
No. Frameworks offer hooks and controls, but the application must enforce authentication, approval boundaries, least privilege, idempotency, logging hygiene and policy checks outside the model.
When should I avoid multi-agent frameworks?
When a deterministic function, a simple LLM call or a few explicit conditional steps can solve the task more reliably. Add orchestration only after you can measure why it improves task success, change management or recovery.
How do I benchmark multi-agent frameworks fairly?
Keep the same policy fixtures, model configuration, tool contracts, task budget, retry limits and acceptance conditions. Run repeated, isolated trials, check actual state transitions and report p50/p95 latency, cost and unauthorized action rate; do not declare winners from conceptual code examples.
SOURCE LEDGER · PRIMARY DOCUMENTATION
Official sources and SXF editorial method
Reviewed October 17, 2026. This page relies on official framework documentation for documented capabilities and lifecycle statements. All diagrams, use-case matrices, selector rules, and the refund fixture are original SXF explanatory materials. We did not run paid API calls, production load tests, or a controlled cross-framework benchmark for this publication. Do not interpret recommended starting fits as measured model-quality or latency rankings. Feature stability, package APIs, licensing and hosting may change; check the exact release that you install.