Toggle Theme

OpenAI Agents SDK vs LangGraph: A Practical Engineering Review

Easton editorial illustration: agent framework comparison toolbox

"The OpenAI Agents SDK documentation describes its lightweight agentic-app positioning and core capabilities, including Agents, Handoffs, Guardrails, Tracing, Sessions, HITL, and MCP tools."

A team builds a customer-support agent prototype with LangGraph. Once it runs, most nodes turn out to do the same thing: call a model, then call one tool. The code is tidy, but the boilerplate is not small, so someone asks whether OpenAI Agents SDK could remove that layer.

Another case is harder. A reporting agent runs for 20 minutes every day and has to wait for a human to approve SQL before it continues. At that point, “less code” is no longer the only metric. Pause, resume, and audit matter more. OpenAI Agents SDK has sessions and guardrails, but can it replace LangGraph checkpoints and interrupts?

Both cases lead to the same question: OpenAI Agents SDK looks lightweight, but is it suitable as a LangGraph replacement, or only for part of the workload? The real decision is whether your agent only needs models, tools, and delegation, or whether it already needs durable state, human pauses, resumable execution, and audit replay.

First clarify the layer: they are not the same abstraction

Before talking about replacement, it helps to separate the two frameworks’ jobs. OpenAI describes Agents SDK as a lightweight, easy-to-use, low-abstraction toolkit for building agentic apps. Its center of gravity is the agent loop, tool calls, handoff delegation, guardrails, and tracing. LangGraph describes itself as low-level orchestration infrastructure for long-running, stateful workflows. Its center of gravity is explicit state graphs, checkpoint persistence, interrupts, resume, time travel, and fault tolerance.

One feels closer to a conversation-and-delegation runtime. The other is closer to a directed state machine. The abstraction split looks like this:

DimensionOpenAI Agents SDKLangGraph
Core abstractionAgent loop + tool callingExplicit state graph (nodes + edges)
State managementSessions (conversation continuity)Checkpointers (graph state snapshots)
DelegationHandoffs (agent as tool)Graph routing (node transitions)
ValidationGuardrails (input/output)Interrupts (state-machine pause)
ResumeNo built-in resumeResume from a checkpoint
ReplayNo built-in replayTime travel over state history
Failure recoveryNo built-in fault toleranceContinue after failure
Official positioningAgentic-app toolkitLong-running workflow orchestration

This table shows the core split: Agents SDK is closer to agent runtime primitives, while LangGraph is closer to stateful workflow orchestration. If you only need an agent loop that can call tools and occasionally delegate to a specialist agent, Agents SDK may be enough. If the task must pause, resume, be audited, or continue after failure, LangGraph’s checkpoint and interrupt model is the important part.

This is not about which framework is stronger. They are working at different layers. Agents SDK is like an SDK plus tracing for running agents. LangGraph is like a state-machine engine plus persistence. If your process can be drawn as clear state transitions, LangGraph is usually a better fit. If the process is mostly “model + tools + occasional escalation”, Agents SDK can be lighter. For the deeper boundary between prompts and state machines, see Agent state machines and workflow boundaries.

Capability matrix: 10 practical dimensions

Different abstraction layers do not prevent a practical comparison. The table below compares the two frameworks across 10 engineering dimensions:

DimensionOpenAI Agents SDKLangGraph
Agents/ToolsStrong: Agent + Runner manage tool callsStrong: nodes can wrap agents or pure functions
HandoffsStrong: agent as tool, supports input_filterRequires an explicit graph: routing edges
GuardrailsStrong: input/output + tripwireDifferent abstraction: interrupt is a state-machine pause
TracingStrong: built-in span/model/tool/handoff tracingStrong: usually via LangSmith or custom tracing
Sessions/HITLMedium: session conversation continuity, HITL APIStrong: interrupt pauses, Command(resume=…) resumes
MCPStrong: MCP-backed tools integrationStrong: MCP servers can be called from nodes
State persistenceWeak: session conversation onlyStrong: checkpointers save graph state snapshots
Failure recoveryNone: no built-in fault toleranceStrong: continue after checkpointed failure
Replayable workflowNone: no time travelStrong: time travel over historical states
Production deploymentMedium: bring your own deployment and monitoringStrong: LangSmith Deployment / Agent Server

The most important differences are state persistence, failure recovery, and replayable workflows. Agents SDK sessions are for conversation continuity. LangGraph checkpointers save the whole graph state: node history, intermediate variables, and waiting external input. If a reporting agent crashes halfway through a run, Agents SDK generally has to restart the run. LangGraph can continue from the last checkpoint and avoid repeating completed steps.

HITL is another major split. Agents SDK has guardrails and a HITL API, which are useful for checking inputs and outputs, but the guardrail mechanism is a tripwire: once it fires, execution stops. LangGraph interrupts are state-machine pauses. interrupt() can pause inside a node, the checkpointer stores the current state, and the run resumes later with Command(resume=...). That means LangGraph can pause before a tool call, wait for approval, and continue. Agents SDK guardrails are better for “stop if this input is out of scope” than for “pause, wait for review, then continue.” For a fuller approval boundary, see Human-in-the-loop agent approval design.

The third split is replay. LangGraph time travel lets you return to a checkpoint, inspect the state and execution path, and debug or audit the run. Agents SDK tracing can visualize the execution path, but it cannot return to a historical state and rerun from there. If your scenario includes “why did it take that branch two hours ago?”, LangGraph is the better fit.

What Agents SDK gives you: core primitives

OpenAI Agents SDK centers on five primitives: Agents, Handoffs, Guardrails, Tracing, and Sessions/HITL/MCP. Here is the practical inventory:

Agents: An agent combines an LLM, instructions, tools, and optional runtime behavior. Runtime behavior includes handoffs to other agents, guardrails for input/output checks, and structured outputs for fixed response shapes. Agent and Runner work together so the SDK manages the agent loop, turns, tool calls, guardrail checks, and handoff delegation.

Handoffs: A handoff lets one agent delegate work to another agent. In practice, the target agent is exposed to the LLM as a tool. handoff() can configure the target agent, tool name and description, on_handoff, input_type, input_filter, and is_enabled. This works well for specialist setups, such as a support agent that triages the issue and hands it to technical support or order lookup.

Guardrails: Guardrails run at two levels: input and output. Input guardrails check user input before it enters the agent. Output guardrails check the agent’s response before it returns. A tripwire stops execution when triggered. This is useful for “stop if the input is out of scope” or “block the output if it contains sensitive information.” The official examples use a faster model to check whether the user’s request is in scope.

Tracing: The SDK has built-in tracing for LLM generations, tool calls, handoffs, guardrail checks, and custom events inside an agent run. Each span records timing and metadata, which helps with debugging, visualization, and workflow monitoring. Tracing is on by default, and trace_include_sensitive_data controls whether sensitive fields are recorded.

Sessions, HITL, and MCP tools: Sessions provide conversation continuity: multiple runs with the same session_id share conversation history. The HITL API can wait for external input during execution, but its interruption model is not the same abstraction as LangGraph interrupts. MCP tools let an agent call tools exposed by MCP servers, managed like function tools.

These primitives cover the agent loop, tool calling, delegation, validation, tracing, and conversation continuity. They do not provide an explicit state graph, checkpoint persistence, interrupts, resume, time travel, or fault tolerance. If your task is mostly “model + tools + occasional delegation”, Agents SDK may be enough. If it needs “pause for approval + resume + continue after failure + audit state”, LangGraph matches the requirement better.

LangGraph’s strengths: state mechanisms

LangGraph’s strengths sit in state management and recovery: Checkpointers, Interrupts, Time travel, Fault tolerance, and Stores. Here is the inventory:

Checkpointers: Checkpointers save thread graph state as checkpoints. That includes node history, intermediate variables, pending external input, and the current node position. Each checkpoint is a full state snapshot used for conversation continuity, HITL, time travel, and fault tolerance. The official docs make the distinction clear: Agents SDK sessions are not the same as LangGraph checkpointers. Sessions preserve conversation continuity; checkpointers preserve graph state snapshots.

Interrupts: interrupt() can pause execution inside a graph node. The checkpointer saves the current state and waits for external input. The run resumes with Command(resume=...), and the same thread_id acts as a persistent cursor. The docs list common patterns: approval workflows, review/edit state, interrupting tool calls, and validating human input. This differs from Agents SDK guardrail tripwires. An interrupt is a state-machine pause; a guardrail is an execution-level stop.

Time travel: Time travel lets you return to any checkpoint and inspect the state and execution path at that moment. It is useful for audits, debugging, and reproducing problems, such as “why did it take this branch two hours ago?” Agents SDK tracing can visualize a path, but it cannot return to a historical state and rerun from there.

Fault tolerance: Fault tolerance is the ability to continue after failure. If a reporting agent crashes halfway through a run, LangGraph can resume from the last checkpoint and avoid repeating completed steps. Agents SDK has no built-in fault-tolerance mechanism, so the run usually restarts from the beginning.

Stores: Stores persist long-term data across threads, such as user preferences, history, or business state. The docs distinguish stores from checkpointers: checkpointers save thread graph state; stores save cross-thread long-term data. If your scenario needs shared state across multiple agent runs, stores are the better fit.

These mechanisms make LangGraph a stronger fit for long-running, stateful workflows: long tasks, multiple branches, resumable execution, auditable state, and human intervention. If your project already needs those properties, LangGraph’s complexity is justified. If it is only a simple tool agent or specialist handoff flow, Agents SDK can be lighter.

When to use Agents SDK

Based on the capability matrix and primitive inventory, Agents SDK is a better fit for these scenarios:

  1. Simple tool agents: Retrieval, summarization, and occasional escalation to a human. For example, an internal knowledge-base Q&A agent can retrieve documents, summarize an answer, and tell the user to contact support when it is uncertain. This does not need complex state recovery or approval workflows. Agents SDK tools, handoffs, and guardrails may be enough.

  2. Specialist handoffs: Scenarios that delegate to multiple specialist agents. For example, a customer-support agent first classifies the issue, then hands it to technical support, order lookup, or refund support. Agents SDK handoffs are literally “agent as tool”, so this delegation pattern maps well.

  3. Fast prototypes: Projects that need to validate an idea quickly without drawing an explicit state graph upfront. Agents SDK has less code and a shorter ramp-up. If the prototype later proves it does not need checkpoints or interrupts, it can go to production on Agents SDK.

  4. OpenAI ecosystem fit: If the project mainly uses OpenAI models, the Responses API, or OpenAI hosted tools, Agents SDK is the official toolkit and the integration path is smoother. Real-time voice agents, sandbox agents, or OpenAI-hosted tools are natural examples.

  5. An existing state layer elsewhere: If the project already uses a business database, queue, or workflow engine for state, Agents SDK can run only the agent loop and avoid duplicating the state layer. One node might use Agents SDK to call tools while the business database and message queue own the state.

The common pattern is simple: no explicit state graph, no checkpoint persistence, no interrupt-and-resume flow, and no time travel. If your project fits that profile, starting with Agents SDK can save work.

When to keep LangGraph

If your project hits the cases below, LangGraph’s complexity is likely worth it:

  1. Long tasks (20+ minutes): Reporting agents, data processing, or complex analysis can run for more than 20 minutes and may crash or time out midway. LangGraph checkpointers and fault tolerance let the task continue from the last checkpoint instead of restarting. Agents SDK has no built-in fault tolerance and usually reruns from the beginning.

  2. Human approval is required: Tool-call interrupt scenarios, such as deleting data, sending email, or changing permissions, need human approval before continuing. LangGraph interrupts can pause before the tool call, save state through the checkpointer, and resume with Command(resume=...) after approval. Agents SDK guardrails are “trigger and stop”, not “pause for review and continue.”

  3. Auditable state is required: Some systems need to replay historical state, inspect execution paths, or audit why a decision was made. A compliance question like “why did it take this branch two hours ago?” needs more than an execution trace. LangGraph time travel can return to a checkpoint; Agents SDK tracing can show a path but cannot rerun from a historical state.

  4. Execution must continue after failure: If an agent crashes halfway through a run or the network fails, the system must continue rather than start over. LangGraph fault tolerance can continue from a checkpoint. Agents SDK restarts from the beginning. If the task has external dependencies such as API calls or database writes that must not be repeated, this difference matters.

  5. Multiple branches, conditional routing, or a business state machine: Workflows that have explicit states, conditional branches, or business transitions fit LangGraph better. Order processing is a typical example: payment succeeds -> ship; payment fails -> cancel; payment times out -> human intervention. Agents SDK handoffs are good for delegation, but not for drawing complex routing.

The shared requirement is explicit state: checkpoint persistence, interrupts, resume, time travel, or fault tolerance. If your project needs those, LangGraph’s complexity is not overhead; it is part of the system’s safety.

Replacement decision: a four-step checklist

After the scenarios, the decision may still be fuzzy. Use this four-step checklist:

Step 1: list the core requirements

Break the requirement into concrete capabilities: tool calling, state recovery, human approval, long tasks, branching, audit replay, and failure recovery. Do not write only “we need an agent.” Make it specific. “A reporting agent runs for 20 minutes, waits for SQL approval, and must continue after a crash” is three requirements: long task, approval, and failure recovery.

Step 2: map strong requirements to the capability matrix

Take the list from step 1 and map it to the 10 dimensions above. For example, “long task + approval + failure recovery” maps to state persistence, HITL, and failure recovery. Agents SDK is weak or absent on those dimensions, while LangGraph is strong. If your strongest requirements sit in Agents SDK’s weak areas, replacement is probably not a good fit.

Step 3: decide whether you need an explicit state graph

Ask one question: can my process be drawn as clear state transitions? If yes, such as order processing with success, failure, timeout, and follow-up steps, LangGraph’s explicit state graph is a better fit. If the process is mostly “model + tools + occasional delegation” with no fixed flow, Agents SDK may be lighter.

Step 4: assess the team’s tolerance for complexity

LangGraph asks the team to design graphs, state, and nodes. If the team has little appetite for that complexity, start with an Agents SDK prototype and add a state layer only if needed. If the team already has workflow or state-machine experience, LangGraph’s complexity may not be a burden.

After these four steps, you should be able to choose Agents SDK, LangGraph, or a hybrid. If you are still doing higher-level framework selection, use the AI agent engineering 2026 framework checklist as a companion.

Migration paths for existing LangGraph projects

If you already have a LangGraph prototype and want to remove some complexity with Agents SDK, use this table:

What is in the LangGraph prototypeCan it move to Agents SDK?Why
Simple tool-agent node (model + tool only)YesIt does not depend on checkpoints or interrupts; Agents SDK tools and tracing may be enough
Specialist delegation node (classify, then delegate)YesAgents SDK handoffs are already “agent as tool”, without explicit routing edges
Short task without checkpoints (under 5 minutes)YesThere is no checkpoint requirement; Agents SDK sessions may be enough
Approval flow that depends on interrupts (tool-call interrupt)NoLangGraph interrupts are state-machine pauses; Agents SDK guardrails are execution stops
Long task that depends on checkpoints (20+ minutes)NoAgents SDK has no checkpoint persistence, so a crash means restarting
Audit requirement that needs time travelNoAgents SDK has tracing but no time travel, so it cannot rerun from historical state
Multi-branch routing or business state machineNoAgents SDK handoffs are not designed for complex routing; an explicit state graph is clearer

If you are already using Agents SDK and want to know when to upgrade to LangGraph, use this trigger table:

TriggerSuggested migration pathWhy
Task length grows from 5 minutes to 20+ minutesKeep Agents SDK for short-task nodes, wrap the outer flow in LangGraphLong tasks need checkpoints and fault tolerance
Approval is required for high-risk tool callsMove approval from guardrails to interruptsInterrupts are state-machine pauses; guardrails are execution stops
Crash recovery is requiredIntroduce checkpointersAgents SDK has no built-in fault tolerance
Conditional branching is requiredDraw an explicit state graphAgents SDK handoffs are not built for complex routing

Hybrid pattern example: You do not have to replace everything. Let LangGraph manage the outer state graph while a node uses Agents SDK to run a short-task agent. A reporting agent might use LangGraph for the main flow: data preparation -> SQL generation -> human approval -> query execution -> export. The SQL generation and export nodes do not need their own checkpoint or interrupt logic, so they can use Agents SDK for the agent loop and tool calls while LangGraph keeps state ownership.

The key is ownership: LangGraph owns the state layer; Agents SDK can run short-task nodes. This is not an either-or choice. It is a way to use each framework where it is strongest.

Conclusion

OpenAI Agents SDK and LangGraph are not a binary choice. The real question is whether you need a state layer. If the project only needs an agent loop, tool calls, delegation, and validation, such as knowledge-base Q&A, support triage, or a fast prototype, start with Agents SDK. It is lighter and easier to get running. If the project needs long-task recovery, human approval, state audits, or continuation after failure, such as reporting agents, order workflows, or compliance processes, LangGraph checkpoints, interrupts, time travel, and fault tolerance are necessary capabilities.

You do not have to force a replacement. A practical hybrid is to let LangGraph manage the outer state graph and let Agents SDK run short-task nodes. The decision starts with your requirements: list the core needs, map the strong ones to the capability matrix, then decide whether to keep, replace, or combine the two frameworks.

Next step: if you already have a LangGraph prototype, use the migration table to identify which nodes can move to Agents SDK. If you are still choosing a framework, use the four-step checklist to decide whether the project needs an explicit state graph before you commit.

How to decide whether OpenAI Agents SDK can replace LangGraph

Use task length, state requirements, tool side effects, human review, and observability needs to decide whether to migrate from LangGraph to OpenAI Agents SDK.

⏱️ Estimated time: 30 min

  1. 1

    Step 1: List the runtime length

    Decide whether the agent is a single turn, a short session, or a long-running task that may exceed 20 minutes.
  2. 2

    Step 2: Mark the state requirements

    Check whether you need branching, retries, compensation, approval, resume, replay, or cross-step state audits.
  3. 3

    Step 3: Inspect the tool calling pattern

    Separate simple function tools or MCP tools from multi-step external side effects, which usually need an explicit state layer.
  4. 4

    Step 4: Choose the human review model

    If you only need final output checks, guardrails may be enough. If you need to pause inside a node, edit state, or approve a tool call, prefer LangGraph interrupts.
  5. 5

    Step 5: Check the observability requirements

    Decide whether the team only needs an agent trace, or also needs state transitions, checkpoints, evals, deployment monitoring, and recovery records.
  6. 6

    Step 6: Pick the primary framework

    Prefer Agents SDK when most answers point to short tasks and lightweight tools. Keep or introduce LangGraph when they point to state graphs and long-running work.
  7. 7

    Step 7: Design a hybrid migration

    For an existing LangGraph project, first wrap simple model-tool nodes with Agents SDK, then decide whether the outer graph still needs to stay.

FAQ

Can OpenAI Agents SDK directly replace LangGraph?
Not as a blanket replacement. The two frameworks sit at different abstraction layers: Agents SDK provides agent-loop primitives, while LangGraph provides an explicit state machine. If a project needs checkpoint persistence, interrupts, resume, time travel, or fault tolerance, LangGraph is a better fit. If it is a simple tool agent or specialist handoff flow, Agents SDK may be enough.
Are sessions and checkpoints the same thing?
No. Agents SDK sessions preserve conversation continuity across runs with the same session_id. LangGraph checkpointers save graph state snapshots, including node history, intermediate variables, pending external input, and the current node position. Sessions are conversation history; checkpoints are graph state.
If Agents SDK has HITL, do LangGraph interrupts still matter?
Yes. Agents SDK HITL and guardrails are closer to execution-level stops. LangGraph interrupts are state-machine pauses: a node can pause, the checkpointer saves state, and the run can resume with Command(resume=...) after human approval. One stops execution; the other pauses and continues.
Is LangGraph too heavy?
It depends on the requirement. If the project needs an explicit state graph, checkpoint persistence, interrupts, resume, time travel, or fault tolerance, LangGraph's complexity is necessary. For a simple tool agent or specialist handoff flow, LangGraph may be heavier than needed and Agents SDK is lighter.
How should an existing LangGraph project migrate?
First decide which nodes can move and which cannot. Simple tool-agent nodes, short tasks without checkpoints, and specialist delegation nodes can move to Agents SDK. Approval flows that depend on interrupts, long tasks that depend on checkpoints, audit requirements that need time travel, and complex conditional routing should stay in LangGraph.
Can OpenAI Agents SDK and LangGraph be used together?
Yes. A common pattern is to let LangGraph manage the outer state graph while one node runs a short-task agent with Agents SDK. For example, a reporting agent can keep its main flow in LangGraph, while the SQL generation and result export nodes use Agents SDK for tool calls and leave state management to LangGraph.

16 min read · Published on: Oct 21, 2026

Comments

Sign in with GitHub to leave a comment

Easton BlogEaston Blog