Introducing Duet Autopilot.
Learn more
Glossary

AI agent framework

An AI agent framework is a software library or SDK that provides the primitives, abstractions, and infrastructure needed to build AI agents. Rather than reinvent tool-calling loops, state management, retry logic, and observability for every new agent, developers use a framework that ships these capabilities out of the box.

The AI agent framework category has grown rapidly since 2023, with several distinct approaches and a fast-moving landscape. Choice of framework has material consequences: it constrains which LLMs you can use easily, how you structure logic, how you observe production behavior, and how portable your agent is if you switch vendors.

What a framework provides

Every serious AI agent framework provides roughly the same set of building blocks. LLM abstractions let you swap between OpenAI, Anthropic, Google, and open-source models without rewriting call sites. Tool abstractions let you define functions, describe them, and let the LLM invoke them. State management persists conversation history and intermediate variables across turns. Prompt templates centralize prompt logic instead of scattering strings across the codebase. Streaming support handles token-by-token responses for lower perceived latency. Callbacks and observability hooks capture every LLM call, tool invocation, and error for debugging and evaluation. Retry and rate-limit logic handles transient failures. Memory abstractions manage short-term and long-term context.

Major frameworks

LangChain is the most widely adopted framework and the one most tutorials assume. It provides comprehensive abstractions for LLMs, tools, vector stores, memory, and chains. Its breadth is both its strength and its criticism — LangChain covers almost every use case but has a reputation for complex abstractions and a steep learning curve. Recent versions have simplified the API considerably.

LangGraph is LangChain's graph-based framework for building stateful, multi-step agents. It represents agent workflows as a directed graph of nodes (each performing a step) and edges (each defining a transition). This makes complex agent workflows more explicit and easier to reason about, at the cost of some upfront design work.

OpenAI Agents SDK is OpenAI's official framework, released in 2025. It emphasizes simplicity: a small number of primitives (agents, handoffs, guardrails, sessions), tight integration with OpenAI's models and tools, and minimal ceremony. It's the fastest way to ship an agent on OpenAI's stack and is intentionally opinionated about model choice.

LlamaIndex started as a data-framework for LLMs — the leading library for indexing and retrieving documents — and has grown into a full agent framework. It's especially strong for RAG-heavy applications where the agent's primary job is querying and synthesizing information from a knowledge base.

CrewAI focuses on multi-agent orchestration. It models systems as "crews" of specialized agents that collaborate on tasks, with an emphasis on role-based prompting and inter-agent communication. It's popular for research and content-generation workloads where multiple agents naturally divide the work.

Anthropic's SDK, Google's ADK, and other vendor-specific frameworks provide native paths to build on those providers' models with tight platform integration.

Framework vs custom code

Not every team should use a framework. Frameworks add abstractions, and abstractions add complexity, learning cost, and dependencies. For a simple agent that makes one LLM call and one tool call per turn, framework overhead may exceed the code you would write yourself.

Frameworks win as complexity grows. When your agent needs to maintain conversation state across turns, coordinate multiple tools, retry on failure, stream responses, integrate with observability, and swap between LLM providers, the framework's abstractions become genuinely useful. Teams that start by writing everything from scratch typically end up building an internal framework that duplicates 80% of what LangChain or LangGraph already provide.

The practical rule: if your agent is a proof of concept or a single-turn utility, skip the framework. If it's a production system that will grow in complexity, adopt a framework early — the cost of retrofitting one after your agent has grown is higher than the cost of learning it upfront.

Choosing a framework

Three dimensions dominate the choice. First, LLM commitment: if you're standardized on one provider, a native framework (OpenAI Agents SDK, Anthropic SDK) will be simpler and often more capable than a multi-provider option. If you want portability, LangChain or LangGraph give you it. Second, workflow style: for simple sequential or single-turn agents, a light framework is fine; for complex stateful agentic systems, a graph-based framework like LangGraph pays off. Third, ecosystem depth: LangChain's ecosystem of integrations (vector stores, tools, model providers) is unmatched; if you're integrating with many external systems, that ecosystem is a genuine productivity multiplier.

Framework choice is not permanent. It's not painless to switch, but the underlying primitives — LLMs, tools, prompts — are portable, and most agents that outgrow one framework migrate to another over time.

Deliver the concierge experiences your customers deserve

Get a demo