What Is an AI Agent Framework?
An AI agent is an LLM that works in a loop: it reads a goal, decides which tool to call (search, run code, query a database), looks at the result, and repeats until the job is done. You can build that loop yourself in about 50 lines of code.
Frameworks exist for everything around the loop: tool definitions, memory, multi-step workflows, multiple agents, human approval, tracing and deployment. There are now many of them. This guide explains how they differ and how to choose.
๐ฏ Quick Answer (30-Second Read)
- All agents share one loop: model โ tool call โ result โ model, until done.
- Model-provider SDKs (Claude Agent SDK, OpenAI Agents SDK, Google ADK) are the fastest way to build agents on that provider's models.
- LangGraph is the go-to for complex, stateful, controllable workflows across any model.
- CrewAI focuses on teams of role-based agents.
- TypeScript apps: Vercel AI SDK or Mastra.
- Start simple: one agent, a few good tools, clear instructions. Add frameworks and multi-agent setups only when needed.
The Loop Every Framework Wraps
next step"] M -->|"tool call"| T["Run tool
(search, code, API, DB)"] T -->|"result"| M M -->|"done"| A["โ Answer / action"] M -.->|"risky action"| H["๐ง Human approval"] H -.-> T
What frameworks add around it:
- Tool schemas generated from your functions
- Memory and conversation state across steps and sessions
- Workflow control: branching, retries, parallel steps
- Multiple agents handing work to each other
- Human-in-the-loop approvals
- Tracing, evaluation and guardrails
- MCP support for plugging in external tools (How to Build an MCP Server)
The Main Options
| Framework | Language | Best for | Model support |
|---|---|---|---|
| Claude Agent SDK (Anthropic) | Python, TypeScript | Agents with file, shell and tool use, built on the same harness as Claude Code | Claude |
| OpenAI Agents SDK | Python, TypeScript | Lightweight agents with handoffs and guardrails | OpenAI-first, others via adapters |
| Google ADK | Python, Java, others | Agents on Gemini and Google Cloud | Gemini-first, others supported |
| LangGraph | Python, TypeScript | Complex stateful workflows, durable execution, human-in-the-loop | Any |
LangChain (create_agent) |
Python, TypeScript | Quick agents with many integrations, built on LangGraph | Any |
| CrewAI | Python | Role-based multi-agent "crews" | Any |
| Microsoft Agent Framework | Python, .NET | Enterprise agents on Azure (successor to AutoGen and Semantic Kernel) | Any, Azure-first |
| Vercel AI SDK | TypeScript | Agents inside Next.js and web apps, with streaming UI | Any |
| Mastra | TypeScript | Full TypeScript agent framework with workflows and memory | Any |
| LlamaIndex | Python, TypeScript | Agents centred on retrieval over your data | Any |
Frameworks evolve fast. Check each project's current docs before committing.
How to Choose
on Claude"| CA["Claude Agent SDK"] S -->|"Simple agent on one
provider's models"| PS["That provider's SDK
(Claude, OpenAI, Google ADK)"] S -->|"Complex workflow, needs state,
retries, approvals"| LG["LangGraph"] S -->|"Chat UI in a
Next.js app"| VS["Vercel AI SDK"] S -->|"Agents mostly answering
from documents"| LI["LlamaIndex"] S -->|"Several role-based agents
collaborating"| CR["CrewAI / LangGraph"]
Single Agent vs Multi-Agent
| Single agent + tools | Multiple agents | |
|---|---|---|
| Complexity | Low | Higher: coordination, handoffs |
| Debugging | Easier | Harder to trace |
| Good for | Most tasks | Large tasks that split cleanly (research + writing + review), parallel work |
| Cost | Lower | More tokens across agents |
Most production agents are one capable agent with good tools. Reach for multi-agent designs when a task genuinely splits into independent parts.
Production Checklist
- Limit tools to what the task needs (least privilege)
- Require human approval for irreversible actions (payments, deletes, sending emails)
- Set step and cost limits per run
- Log every tool call with inputs and outputs (tracing)
- Build an evaluation set of real tasks and test changes against it
- Use prompt caching for long, repeated instructions (Claude Prompt Caching Guide)
Frequently Asked Questions
What is the best AI agent framework?
There's no single best one. Model-provider SDKs like the Claude Agent SDK or OpenAI Agents SDK are quickest for agents on those models. LangGraph suits complex, stateful workflows across models. Vercel AI SDK fits TypeScript web apps. Choose based on your language, models and workflow complexity.
Do I need a framework to build an AI agent?
No. A basic agent is a loop that sends messages and tool definitions to a model, runs the tools it requests and returns results. Frameworks help with state, workflows, multiple agents, approvals and tracing as projects grow.
What is the difference between LangChain and LangGraph?
LangGraph is a lower-level runtime for building agent workflows as graphs with state, persistence and human-in-the-loop control. LangChain 1.0 provides higher-level building blocks, including a create_agent function that runs on LangGraph underneath.
Conclusion
Every agent framework wraps the same loop of model, tool and result. Use a model provider's SDK for the fastest start, LangGraph for complex controllable workflows, and Vercel AI SDK or Mastra for TypeScript apps. Whatever you pick, invest most in good tools, clear instructions, safety limits and evaluation.
Sources
- Anthropic: Claude Agent SDK overview
- OpenAI Agents SDK documentation
- LangGraph documentation
- CrewAI documentation
- Google Agent Development Kit (ADK)
- Vercel AI SDK: Agents
Last verified: 2 November 2026.
Related reads: LangChain vs LlamaIndex ยท How AI Agents Work ยท How to Build an MCP Server in Python ยท RAG vs Fine-Tuning
I write about building with AI and how real products work. Follow on LinkedIn or X, or invite me to speak.