learning-it by example

Back to the video

OpenAI Agents SDK vs LangGraph vs Plain Python

One tool kept failing. One agent loop stopped at 6 calls, one at 10, and one kept going.

Video #22 ยท AI agents and MCP

Steps in the video

  1. 0:00 One tool kept failing, and one framework kept going
  2. 0:35 The idea
  3. 1:08 Setup
  4. 1:38 The tools and the stand-in model
  5. 2:08 Plain Python
  6. 2:39 The Agents SDK
  7. 3:09 LangGraph
  8. 3:36 Same task, two failures
  9. 4:47 What this does not show
  10. 5:19 Mistakes to avoid
  11. 5:47 My take and next steps
  12. 6:11 Recap

Files

  • compare.py (43 lines)
  • fakemodel.py (60 lines)
  • graph.py (27 lines)
  • plain.py (39 lines)
  • sdk.py (16 lines)
  • tools.py (23 lines)

Download the code (zip)

Tested with

Python 3.12.15 | openai-agents==0.24.0, langgraph==1.2.16, langchain-openai==1.7.2, langchain-core==1.7.0, openai==3.36.1

What this does not show

A scripted stand-in plays the model and retries a failed tool every time, so this compares code length and default limits only, not how a real model behaves. One small task with two tools. The limit of six in plain Python is the author's choice; the other two are the defaults of openai-agents 0.24.0 and langgraph 1.2.16, and all three limits can be changed. Lines of code are not features.

Sources

Learning IT by Example.