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
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)
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
- https://docs.langchain.com/oss/python/langgraph/graph-api
- https://genai.owasp.org/llmrisk/llm062025-excessive-agency/
- https://openai.github.io/openai-agents-python/running_agents/
- https://openai.github.io/openai-agents-python/tools/
- https://openai.github.io/openai-agents-python/tracing/
- https://pypi.org/project/langchain-openai/1.7.2/
- https://pypi.org/project/langgraph/1.2.16/
- https://pypi.org/project/openai-agents/0.24.0/
- https://pypi.org/project/openai/3.36.1/
Learning IT by Example.