Agent framework
Updated November 24, 2026
An agent framework is a software library with ready-made building blocks for AI agents, such as model clients, tools, the agent loop, memory and tracing. It handles the repeated plumbing of calling a model, running the tools the model picks and feeding the results back, so a team writes the agent's instructions and tools instead of the loop.
In short: An agent framework is a library, such as LangChain or CrewAI, that packages the model loop, tool calling, memory and tracing so developers can build AI agents without writing that plumbing themselves.
How an agent framework works
An AI agent usually runs the same basic loop. The application sends the model a prompt and a list of tools, the model picks a tool, code runs it and the result goes back to the model until the task is done. That loop is tool calling repeated, and an agent framework packages it.
LangChain describes agent frameworks as abstractions that make it easier to get started when building with LLMs, and lists structured content blocks, the agent loop and middleware among its own 1. The OpenAI Agents SDK describes a built-in loop that continues until the task is complete, function tools with automatic schema generation and validation, and sessions that keep working context within the loop 3.
Microsoft's Agent Framework shows the usual parts in one place, offering individual agents that call tools and MCP servers, graph-based workflows with explicit execution paths, and integrations with model providers, tools and evaluation services 2. Its building blocks include model clients, an agent session for state, context providers for memory, middleware that intercepts agent actions and MCP clients for tool integration 2.
Frameworks now connect to the Model Context Protocol as well as to hand-written tools. The OpenAI Agents SDK exposes remote MCP tools to agents alongside function tools 3. A framework can then load a hosted server's tool catalog instead of needing a wrapper per endpoint, and RichAPI's LangChain guide describes loading its MCP server through langchain-mcp-adapters 4.
Frameworks also bundle tracing and safety checks. The OpenAI Agents SDK includes tracing to visualize, debug and monitor workflows, guardrails that validate agent inputs and outputs, and built-in mechanisms for involving humans during agent runs 3. Microsoft's framework brings over type safety and telemetry from Semantic Kernel 2.
Framework, runtime or batteries-included kit
LangChain splits the agent stack into three layers, and the split is useful when choosing a tool 1.
Agent frameworks provide abstractions and integrations for models, tools and agent loops. LangChain, CrewAI, the OpenAI Agents SDK, Google ADK and LlamaIndex are the examples LangChain gives 1.
Agent runtimes provide the tooling for running agents in production, including durable execution, streaming, human-in-the-loop and persistence 1. LangGraph is the example, with Temporal and Inngest named as other runtimes 1.
Batteries-included kits add predefined tools, planning, file systems and subagents for long, multi-step tasks, and LangChain's Deep Agents SDK is its example 1.
Frameworks are generally higher level and run on runtimes, and LangChain notes that LangChain 1.0 is built on top of LangGraph 1. A short agent that answers one request at a time can live in a framework alone. Agents that run for hours, pause for approval or must resume after a crash need a runtime underneath.
Some tasks need no agent at all. Microsoft's guidance is to use an agent when a task is open-ended or needs autonomous tool use and planning, a workflow when the process has well-defined steps, and a plain function when a function can handle the task 2.
The same choice exists one level down. OpenAI says to call its Responses API directly when a team wants to own the loop, tool dispatch and state handling, or when the workflow is short-lived and mainly returns the model's response 3. The Agents SDK fits when the runtime should manage turns, tool execution, guardrails, handoffs or sessions, and OpenAI notes that many applications use the SDK for managed workflows and the API directly for lower-level paths 3.
Example of an agent framework in use
A GTM engineer builds contact research on LangChain with RichAPI as the data source. The first draft is a tool-calling agent with four tools that enriches a company, picks a contact, finds a work email and verifies it.
The traces show the agent making the same calls in the same order on every row. RichAPI's LangChain guide says a fixed sequence such as domain, company, decision-maker, email and verify is a chain and should be written as one 4. The engineer rewrites it the way the guide does.
pipeline = (
RunnableLambda(clean_domain)
| RunnableLambda(enrich_company)
| RunnableLambda(top_contact)
| RunnableLambda(find_work_email)
)
rows = pipeline.batch(domains, config={"max_concurrency": 8})The framework stays for the one step with a real decision. When a row has a name and maybe a domain or a LinkedIn URL, something has to choose which lookup to run, and the guide reserves bind_tools for that kind of ambiguous routing 4.
The code now sets the cost. Waterfall endpoints such as email_finder return success false and billed false on a miss and cost zero credits, while all other endpoints bill on a successful 2xx response 4. The chain makes a known number of calls per row, and only the routing step varies. The guide also recommends logging the execution_log from waterfall calls inside the chain, so a run that returns nothing can be traced to the attempts behind it 4.
Agent framework vs agent runtime
LangChain draws this line inside its own stack, with LangChain as the framework and LangGraph as the runtime underneath 1.
| Agent framework | Agent runtime | |
|---|---|---|
| What it answers | How do I build the agent quickly? | How does the agent run reliably in production? |
| Input | Models, tools, prompts and the loop | Graphs, state and checkpoints |
| Output | A working agent with less code | Durable runs that stream, pause and resume |
| Cost driver | Model calls the loop decides to make | Long runs and stored state |
| Main risk | Abstractions that hide each call | More code for low-level control |
| Use it when | Standard patterns cover the task | Runs are long, stateful or need approval |
Frequently asked questions
What are examples of agent frameworks?
LangChain names its own framework plus CrewAI, the OpenAI Agents SDK, Google ADK, LlamaIndex and Vercel's AI SDK 1. Microsoft offers Agent Framework, which combines the agent abstractions of AutoGen with the enterprise features of Semantic Kernel 2. Microsoft describes it as the direct successor to both, built by the same teams 2.
What is the difference between an agent framework and an agent runtime?
A framework gives abstractions for models, tools and the agent loop so teams can start quickly. A runtime such as LangGraph runs agents in production with durable execution, streaming, human-in-the-loop and persistence 1. LangChain notes that frameworks are generally higher level and run on runtimes 1.
Do I need an agent framework to build an AI agent?
No. A model API with tool calling is enough for a simple loop, and Microsoft advises writing a plain function when a function can handle the task 2. A framework pays off when a team needs tracing, memory, guardrails, MCP support or many tools managed in one place.
Do agent frameworks support MCP?
Several do. The OpenAI Agents SDK exposes remote MCP tools to agents alongside function tools 3, and Microsoft's Agent Framework includes MCP clients for tool integration 2. That lets an agent load a hosted server's tools without a hand-written wrapper for each endpoint.
The bottom line
An agent framework packages the model loop, tool calling, memory and tracing so a team can build AI agents without writing that plumbing 1. Use one where the task needs judgment, and keep fixed sequences in plain code or a chain 4. Pick a framework that supports MCP, shows every tool call in traces and caps loop iterations, and add a runtime when agents run long or need approval 1.
Sources
- Runtimes, frameworks, and harnesses, LangChain
- Microsoft Agent Framework overview, Microsoft Learn
- OpenAI Agents SDK, OpenAI
- LangChain integration guide, RichAPI