Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Lesson 5 of 6 · Concept · 15 min · revision 3

Graph Framework, Agent SDK or Plain Code?

Compare a hand-written loop, provider agent SDKs (OpenAI Agents SDK, Claude Agent SDK, Google ADK), a graph framework such as LangGraph and a durable execution engine, and choose by the requirements each one actually serves.

Contentsand lesson path

On this page

  1. Why it matters
  2. Four ways to run an agent loop
  3. A decision guide with conditions
  4. Check your understanding
  5. Apply it
  6. Review prompt

Lessons of Stateful Agent Graphs

  1. Agents as State Machines Concept · 15 min
  2. State, Nodes and Reducers Worked example · 20 min
  3. Lab: Routing, Cycles and Parallel Branches Lab · 25 min
  4. Checkpoints, Threads and Replay Lab · 25 min
  5. Graph Framework, Agent SDK or Plain Code? Concept · 15 min
  6. Check: Trace a Graph Execution Knowledge check · 8 questions

What you will learn

  • Explain when a graph framework (for example LangGraph) adds value over a hand-written loop or a vendor agent SDK, and when it adds needless complexity.

Prerequisites: Agent Loops & ReAct

01. Why it matters

In the earlier lessons you built a graph with typed state, routing, cycles and checkpoints. Now you need to decide when that machinery is worth having. Every agent needs the same core: a loop that calls a model, runs the tools it asks for and stops. The tools on offer differ in what they add around that loop, such as pausing for approval, resuming after a crash, handing work to other agents and replaying an earlier step.

If you pick too much framework, you pay in concepts, dependencies and debugging layers for features you never use. If you pick too little, you end up rebuilding persistence, approvals and retries by hand, often with bugs. The right choice depends on your requirements, not on which tool is most popular this month.

One name causes confusion. The OpenAI Assistants API was a hosted, stateful API that kept threads and runs on OpenAI servers. It was shut down on 26 August 2026, and OpenAI points new work to the Responses API with Conversations. The OpenAI Agents SDK is a different product: an open-source library whose agent loop runs in your own process. Do not judge one by the other.

02. Four ways to run an agent loop

1. Plain code. You write the loop yourself on top of a model client library. Every step is visible, a normal debugger works, and you add no new dependencies. You also own everything else: saving state, retries, approval pauses, tracing and any multi-agent logic. This is a good fit while those needs are small.

2. Provider agent SDKs. These are libraries that you run in your own process or container. Each one gives you a ready-made loop and some building blocks around it:

  • The OpenAI Agents SDK (Python and TypeScript, MIT licence) has agents, tools, handoffs, agents as tools, guardrails, sessions and built-in tracing. A tool marked with needs_approval pauses the run. The paused RunState can be saved with to_json() and resumed later, even in another process. Other providers work through OpenAI-compatible clients or the beta LiteLLM and Any-LLM adapters. However, its hosted tools, such as web search and file search, work only with OpenAI's Responses API: with another model the SDK raises an error at the first model call if a hosted tool is attached, so you remove it or replace it with a function tool. Traces are sent to OpenAI unless you change the trace processor.
  • The Claude Agent SDK (Python and TypeScript) runs Claude Code's agent loop as a library. It has built-in file, shell and web tools, subagents, hooks, MCP, and permission rules with a canUseTool callback for approvals. Sessions are saved to disk, so you can resume or fork them. It runs Claude models only, but you can reach them through the Claude API, Amazon Bedrock, Google Cloud or Microsoft Foundry.
  • Google ADK (Apache 2.0, with SDKs in Python, TypeScript, Go, Java and Kotlin) offers agents with sub-agents and sequential, parallel and loop workflows. Since ADK 2.0 it also offers graph-based workflows. Gemini is built in, and other models work through adapters such as LiteLLM. Tool confirmation, its human approval step, is stable in Python and still experimental in TypeScript, Go and Kotlin.

3. Graph frameworks such as LangGraph. You declare typed state, nodes and edges. A checkpointer saves the state after every step of a thread. interrupt() pauses the run and Command(resume=...) continues it. Because the history is kept, you can replay or branch from any earlier checkpoint. You pay for this with more concepts and more design work. Note too that on resume the interrupted node runs again from its first line.

4. Durable execution engines such as Temporal. These are not agent libraries. You write workflows as ordinary code, and the engine records an event history. After a crash it replays that history: finished activities are not run again, and timers do not start again. Model calls and tools run as activities. In return, the workflow code itself must be deterministic.

What each option gives you for six common needs (checked 30 October 2026)
Pause for human approval, resume later
  plain loop       build it: save state, reload it, re-enter the loop
  agent SDK        built in: OpenAI needs_approval + RunState; Claude canUseTool;
                   ADK tool confirmation (Python; experimental in TS, Go, Kotlin)
  graph framework  built in: interrupt() with a checkpointer and thread_id
  durable engine   built in: wait for a signal; the wait survives restarts

Resume after the process dies
  plain loop       build it
  agent SDK        from the saved session history or a saved RunState
  graph framework  from the checkpoint saved after the last finished step
  durable engine   by replaying the event history; done activities not rerun

Go back to an earlier step, change it and branch
  plain loop       build it
  agent SDK        not a core feature (Claude sessions can fork a conversation)
  graph framework  built in: state history, update a checkpoint, run from it
  durable engine   not its purpose: replay is for recovery

Several agents (handoffs, sub-agents, agents as tools)
  plain loop       write it
  agent SDK        built in; routing mostly chosen by the model, except ADK's
                   fixed sequential, parallel and loop workflows
  graph framework  subgraphs and routing that you write as code
  durable engine   write it as workflow code

Models from other providers
  plain loop       any client you call
  agent SDK        OpenAI: adapters, some features OpenAI-only; Claude: Claude
                   models only; ADK: Gemini built in, others via adapters
  graph framework  any model you can call from a node
  durable engine   any model you can call from an activity

Waits of hours or days across many external systems
  plain loop       hard to do safely
  agent SDK        possible with saved state; scheduling the wake-up is yours
  graph framework  possible with a durable checkpointer; the wake-up is yours
  durable engine   the main use case

All three SDKs run where you run them, and all three support several agents and human approval. The real trade-off lies elsewhere. With an SDK you accept its opinion of the loop: apart from fixed workflows such as ADK's, the model and the handoff rules decide most of the control flow, and you step in through hooks, guardrails and approvals. With a graph framework you write that control flow as code, and you get state that is saved after every step, which you can inspect, edit and branch from. These lines are blurring: ADK now has graph workflows, and LangChain's higher-level agents run on LangGraph. So always compare the specific versions you would use.

03. A decision guide with conditions

Go through these questions in order. Stop at the first one that settles the choice:

  1. Does a run finish in one sitting, with no approvals and nothing to resume? Use a plain loop, or a provider SDK if you want its tools and tracing. A graph would add structure that nothing uses.
  2. Are you committed to one provider, and do you want its built-in tools? That provider's SDK is usually the shortest path. Write down what would break if you switched provider, such as hosted tools, trace export or the session format.
  3. Must the control flow be checked by code rather than chosen by the model? Examples are fixed routing, bounded retry cycles and parallel branches that must join. The same applies if you need to replay or branch from any saved step. In these cases a graph framework earns its cost.
  4. Does the process wait for hours or days and call many systems whose side effects must survive deploys? Use a durable execution engine, and run the agent steps as activities inside it.
  5. Do the needs mix? Then combine the tools. A graph node can call an SDK agent, and an activity can run a graph. Keep your domain rules in plain functions so that changing the framework does not mean rewriting them.

Before you commit, run a short spike. Build your hardest requirement, for example "approve a refund, restart the server, resume", in your top two candidates. Then compare the code, the traces and the failure behaviour.

04. Check your understanding

Practice check · 3 questions

Choosing an orchestration layer

Pick the best answer for each scenario.

Q1. A colleague rejects the OpenAI Agents SDK for two reasons: it only runs on OpenAI servers, and it cannot pause a run for human approval. How accurate is this?
Q2. A support agent on the OpenAI Agents SDK uses two function tools from your own code, a handoff to a billing agent and the hosted `WebSearchTool`. You switch its model to Claude through the LiteLLM adapter, and keep tracing on with your OpenAI key. Which part must you remove or replace before the agent will run?
Q3. You are choosing between a provider agent SDK and LangGraph for a new support agent. Which question best separates the two?
Practice only: not graded, not saved, not evidence.

05. Apply it

The practice task for this skill asks you to rebuild your framework-free agent as a graph with checkpoints, kill it mid-run, resume it and replay an earlier step. Before you start, write a one-page decision record for that agent:

  1. List its requirements as testable statements, for example "after a restart, an approved refund resumes without asking again".
  2. For each one, note how a plain loop, one provider SDK and LangGraph would meet it. Use the table above, and check the current docs for the versions you would install.
  3. Choose an option and name the requirement that decided it. Also name the change that would make you switch, for example "if runs start to wait for days, move them onto a durable engine".

After the practice, revisit the record. Were checkpoints, interrupts and replay worth the extra code for this agent? See Checkpoints, Threads and Replay if you need a refresher.

06. Review prompt

Without looking back, answer these questions:

  • Name two built-in features that the OpenAI Agents SDK, the Claude Agent SDK and Google ADK all have. Then name one way each is tied to its provider.
  • What does a graph framework give you that an agent SDK usually does not, and what does it cost you?
  • Why is Temporal a different kind of tool from LangGraph, and when would you use the two together?
  • A tool sends an email and runs behind an approval pause. Why can it still send the email twice, and what prevents that?

References

Your progress

Reading state

Sign in to save that you finished reading this lesson.

Sign in to mark reading complete

Prove this skill

8 questions · about 6 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.
Take the skill check