Agent frameworks: build direct or adopt one?
A framework is a ready-made kit of code you build on. Agent frameworks like LangGraph and the OpenAI Agents SDK come with the loop, saved state, and agent-to-agent handoffs already built — but they add a layer between you and the model. The standing advice: start with direct API calls, and adopt a framework only when your agent outgrows them.
The heart of an agent is a small loop — a few hundred lines of code. Frameworks sell everything around it. They also put an extra layer between you and what the model actually sees.
First, the word itself. A framework is a ready-made kit of code you build on, so you don't write everything from scratch. What do the serious ones give you? LangGraph, a well-known agent framework, lets you map multi-step flows as a graph, pause for a human to step in, keep state between sessions, and stream results as they arrive [1]. The OpenAI Agents SDK, OpenAI's own framework, is built on three pieces — agents, handoffs (one agent passing work to another), and guardrails (safety checks) — plus sessions and tracing, a record of what the agent did [2]. These are real features. Building them well yourself takes real time.
The cost is the layer itself. This is what abstraction means: the framework hides detail to make things easier, and that hiding can get in your way. Anthropic's engineering guidance is blunt: frameworks make starting easy, but they can hide the actual prompts and responses, which makes problems harder to find. So start by calling the model API directly — many patterns are just a few lines of code. If you do adopt a framework, make sure you understand what it does under the hood [3].
Adopt a framework when your agent outgrows a few hundred lines — not before.
Do you need an agent framework?
A framework starts to pay off when your needs match what it comes with: several agents working together with real routing (guide 07), memory that lasts across sessions, human-approval stops in long workflows, or a team that wants one shared way of building. The picking test is simple: choose the smallest kit that covers those needs, and check you can still read the final prompt the model receives. When the agent misbehaves, that prompt is where the debugging starts.

Sources
- LangChain — LangGraph (langchain.com/langgraph)
- OpenAI — Agents SDK documentation (openai.github.io/openai-agents-python)
- Anthropic — Building effective agents, 19 Dec 2024 (frameworks and abstraction)
Frequently asked questions
Do I need a framework to build an AI agent?
No. The core loop — a model, some tools, act-observe-repeat — is a few hundred lines of code against a model API, and Anthropic's advice is to start exactly there. A framework earns its place later, when saved state, human check-ins, and coordination between agents outgrow hand-written code.
What do agent frameworks actually provide?
Ready-made plumbing: ways to route work between agents, state that survives across sessions, guardrail (safety-check) hooks, pauses for human approval, streaming, and tracing. LangGraph and the OpenAI Agents SDK are two examples — different shapes, same kind of plumbing.
Which agent framework should I choose?
Pick the smallest one that covers your real needs, in your language, and make sure you can still read the final prompts the model receives. If you cannot see what the model saw, you cannot fix the agent — that matters more than a long feature list.