Agent Frameworks

LangGraph vs OpenAI Agents SDK: When We Use Each (and Why We Use Both)

By Expedey Engineering · Updated · 3 min read

Short answer

Use LangGraph when the workflow matters: explicit steps, shared state, branching and checkpoints for long or resumable runs. Use the OpenAI Agents SDK when the agent matters: instructions, tools, structured output and handoffs with very little code. In production we often use both: LangGraph runs the pipeline and Agents SDK agents do the AI work inside its steps.

What each one is

LangGraph, from the LangChain team, builds stateful workflows as graphs. Nodes are functions, edges set the order (including conditional branches), a typed state object is passed from node to node, and checkpointers save that state so a run can pause, resume or wait for a person.

The OpenAI Agents SDK is a lightweight Python framework for agents. An Agent has instructions, a model, tools (plain Python functions), an optional output_type for structured results, and optional handoffs to other agents. Runner runs the agent loop, and tracing is built in.

Side by side

As of October 2026. Both projects move quickly; check their docs for current features.
LangGraphOpenAI Agents SDK
Core ideaA graph of steps over shared stateAn agent with instructions, tools and a run loop
Who decides the next stepYou, through edges and conditionsMostly the model, through tool calls and handoffs
StateTyped state object with checkpointsThe conversation plus a context object you pass in
Multiple agentsNodes or sub-graphs, wired explicitlyHandoffs, or agents used as tools
Pausing for a personBuilt around checkpoints and interruptsYou build it around tool calls
Structured outputVia the model integration you useoutput_type with a Pydantic model
Best fitMulti-step pipelines and long-running jobsFocused agents and conversational assistants

When we reach for LangGraph

  • The steps are known in advance: download, extract, merge, analyse, draft.
  • A run takes minutes and must be able to resume after a failure.
  • The workflow branches on validated results, not on what the model feels like doing next.
  • A person must approve something in the middle of the run.

When we reach for the Agents SDK

  • One agent with a handful of tools, such as a support or operations assistant.
  • Structured extraction, where output_type hands back a validated object.
  • A conversation that should pass between specialists (handoffs).
  • A quick prototype that may later become a node in a bigger workflow.

Using both: agents inside a graph

In our multi-agent RFP pipeline, LangGraph runs the stages and each stage calls a focused Agents SDK agent. A minimal version of the pattern:

from typing import Literal, TypedDict
from pydantic import BaseModel
from agents import Agent, Runner
from langgraph.graph import StateGraph, START, END

class Requirement(BaseModel):
    requirement: str
    type: Literal["uploadable", "text"]
    deadline: str | None = None

class Extraction(BaseModel):
    requirements: list[Requirement]

extractor = Agent(
    name="RequirementExtractor",
    instructions=(
        "Extract every requirement that needs a file, form or certification "
        "(type 'uploadable') or a written answer (type 'text')."
    ),
    model="gpt-4o-mini",
    output_type=Extraction,   # the SDK returns a validated Extraction object
)

class State(TypedDict):
    chunks: list[str]
    requirements: list[dict]
    errors: list[str]

async def extract(state: State) -> dict:
    found, errors = [], []
    for i, chunk in enumerate(state["chunks"]):
        try:
            result = await Runner.run(extractor, chunk)
            found += [r.model_dump() for r in result.final_output.requirements]
        except Exception as error:   # record it and keep going
            errors.append(f"chunk {i}: {error}")
    return {"requirements": found, "errors": state["errors"] + errors}

graph = StateGraph(State)
graph.add_node("extract", extract)
graph.add_edge(START, "extract")
graph.add_edge("extract", END)
app = graph.compile()
LangGraph owns order and state; the Agents SDK owns the agent and its structured output.

Do you need either?

Not always. A simple agent is a loop around a model call with a few tools, and plain code is easier to debug than a framework you don't fully know. Our open-source agent harness template uses neither, to show what sits underneath: the loop, stop conditions, typed tools, approvals, tracing and evaluations. Whichever you choose, production reliability comes from that harness, not from the framework's name.

Frequently Asked Questions

Can LangGraph use OpenAI models?

Yes. LangGraph is model-agnostic; nodes can call OpenAI, Google, Anthropic or other models, directly or through LangChain integrations, and can call Agents SDK agents as in the example above.

Can the OpenAI Agents SDK use models from other providers?

It is designed around OpenAI models and also supports other providers through model integrations such as LiteLLM. Check the SDK documentation for current support before choosing it for a non-OpenAI model.

Which is better for production?

Neither on its own. Use LangGraph when you need explicit control of a multi-step workflow and resumable state, and the Agents SDK for focused agents. Reliability comes from evaluations, permissions, approvals, tracing and failure handling around either.

Choosing a Stack for Your Agent?

Expedey is a team of forward-thinking individuals working and servicing clientele across the globe for their software development requirements.

Our Offices

Contact Us

© 2024 Expedey. All Rights Reserved.