Contents · 14 sections↓
- 01What is the best AI agent framework in 2026?
- 02What is an AI agent framework, and do you need one?
- 03How do you choose an AI agent framework?
- 04AI agent framework comparison (2026)
- 05What you need to run the examples
- 06The best Python agent frameworks, one by one
- 07Where does Promptise Foundry fit?
- 08What are the best multi-agent frameworks?
- 09Other agent frameworks you will see in 2026 lists
- 10Running it in production
- 11Common problems and fixes
- 12Limitations
- 13Frequently asked questions
- 14Next steps
The best AI agent framework in 2026 depends on what you are building: a durable production workflow, a team of agents, a typed app, a tool-heavy agent on MCP, or an agent inside a Microsoft or Google stack. This guide sorts the main Python options by use case, explains how to choose, and compares nine frameworks feature by feature. Every framework then runs the same small agent with an approval rule, with its real output.
What is the best AI agent framework in 2026?
There is no single best one. The top agentic AI frameworks of 2026 split by use case, and each kind of project has one to three that fit it well, so start from the row that matches your hardest requirement:
If you need | Strong fit | Also consider | Why |
|---|---|---|---|
Production workflows that pause and resume | LangGraph | Pydantic AI | Checkpoints and interrupts that survive a restart |
Multi-agent teams | CrewAI | Microsoft Agent Framework | Crews of role-based agents; MAF adds graph workflows |
Typed, structured apps | Pydantic AI | OpenAI Agents SDK | Validated inputs and outputs, token and tool-call limits |
MCP-heavy tools | OpenAI Agents SDK, Promptise Foundry | Pydantic AI | Built-in MCP clients with per-tool approval; Promptise also builds MCP servers |
Beginners | OpenAI Agents SDK | smolagents | Few concepts to learn |
Microsoft, Azure and .NET | Microsoft Agent Framework | Semantic Kernel (existing apps) | The successor to AutoGen and Semantic Kernel, for Python and .NET |
Google Cloud and Gemini | Google ADK | LangGraph | Workflow agents, graph workflows and deployment to Google Cloud |
Agents over your documents | LlamaIndex | Haystack | Retrieval and agents in one ecosystem |
Agents that write code | smolagents | Promptise Foundry | CodeAgent writes Python as its action; Promptise has a code-action pattern |
Promptise Foundry is made by the team behind this site. Every claim about the other tools was checked against their own docs and repositories on October 21, 2026. The Promptise rows are our judgment, and the sections below say where the others are stronger.
Key takeaways:
Pick by your hardest requirement, not the shortest demo. With the same model and tools, all nine frameworks here made the same decision. They differ in approvals, limits, durability and scope.
Durable approvals are the biggest split. LangGraph, Pydantic AI, the OpenAI Agents SDK and Microsoft Agent Framework return a paused run you can store, and CrewAI Flows can save a pending human review and resume it. CrewAI's tool hooks and Promptise decide inside the running process.
AutoGen is no longer maintained. Its README says the project is archived and points new users to Microsoft Agent Framework.
Serve tools over MCP to stay portable. Every framework here can call MCP tools, so a later switch doesn't touch them.
[02]
What is an AI agent framework, and do you need one?
A Python AI agent framework is a library that runs the agent loop for you. It sends the conversation and the tool definitions to a model, runs the tools the model asks for, feeds the results back, and stops when the model answers. What is an agent framework explains each part in depth.
The loop itself is about 20 lines of Python. A framework earns its place with what it builds around the loop:
You need a framework when the agent runs without a person watching, when its tools change data, when several agents work together, or when runs must pause and resume. You don't need one for a single model call or a script with one or two read-only tools. There, the provider's SDK and a short loop are easier to read and debug. How to build an AI agent in Python writes that loop by hand.
[03]
How do you choose an AI agent framework?
Score each candidate against the questions that cost the most to get wrong later.
Approvals. Can a person approve a risky tool call hours later, and does the pending request survive a restart?
Limits. Can you cap model calls, tokens or tool calls per run, and does the cap raise an error or quietly return an answer?
Durability. If the process crashes mid-run, can the run resume, or does it start over and repeat side effects?
Tools. Does it have a built-in MCP client, and can you build MCP servers with it?
Multi-agent model. Handoffs, crews, graphs or supervisor calls: which matches how your work splits?
Observability. Where do traces go by default, and can you export OpenTelemetry to your own backend?
Models and lock-in. Does it support your providers, and how much code is framework-specific?
Project health. Release pace, license, and whether it is still maintained.
Then build one small agent with your real tools in your top two candidates, as the nine versions below do.
[04]
AI agent framework comparison (2026)
Versions were checked on PyPI on 20 October 2026, Promptise on 24 October 2026. Each cell comes from the framework's documentation; defaults in brackets come from its source code.
Framework | Core idea | Multi-agent | MCP client | Approval and resume | Step limit (default) | Tracing default | License |
|---|---|---|---|---|---|---|---|
LangGraph 1.2.16 | Graph of nodes with shared state | Subgraphs, supervisor, handoffs | langchain.mcp (beta) or the archived langchain-mcp-adapters | Interrupt plus checkpointer; survives a restart with a database checkpointer | recursion_limit (very high); call-limit middleware | LangSmith, opt-in | MIT |
Pydantic AI 2.58.0 | Typed agent | Delegation, hand-off, graphs | Built in | Deferred tools; resume from stored message history | request_limit (50); token and tool-call limits | Logfire or OpenTelemetry, opt-in | MIT |
OpenAI Agents SDK 0.24.0 | Agents, handoffs, guardrails | Handoffs, agents as tools | Built in (stdio, HTTP, hosted) | RunState serializes to JSON | max_turns (10) | On, sent to OpenAI | MIT |
CrewAI 1.15.28 | Crews of role-based agents; Flows | Sequential or hierarchical crews | Built in (mcps=) | Tool-call hooks that block or ask a person, in process; Flows' @human_feedback saves a pending review and resumes | max_iter (25), then a forced answer | Anonymous telemetry on | MIT |
Google ADK 2.12.0 | LLM agents plus workflow agents and graphs | Sub-agents; sequential, parallel, loop | Built in (McpToolset) | Tool confirmation (experimental); before_tool_callback | max_llm_calls (500) | Logs, metrics, traces (configure) | Apache-2.0 |
Microsoft Agent Framework 1.22.0 | Agents plus graph workflows | Sequential, concurrent, handoff, group chat, Magentic | Built in (MCPStdioTool, HTTP) | Approval request; resume with the same session, which serializes | max_iterations (40) | OpenTelemetry built in, no exporter by default | MIT |
LlamaIndex 0.14.25 | Event-driven workflows | AgentWorkflow handoffs | llama-index-tools-mcp | Wait for a human event; Context serializes | max_iterations (20) | Instrumentation, opt-in | MIT |
smolagents 1.26.0 | Agents that write Python | Managed agents | MCPClient (needs mcp<2) | None built in | max_steps (20) | OpenTelemetry, opt-in | Apache-2.0 |
Promptise Foundry 1.10.0 | MCP-first agent | Cross-agent calls, supervisor | Built in, plus an MCP server framework | ApprovalPolicy handler in process; lost on restart | max_agent_iterations (25); budgets | Opt-in, HTML report or OTLP | Apache-2.0 |
Watch the limit column: CrewAI's max_iter returns whatever the model said last instead of raising, and LangChain's create_agent, which runs on LangGraph, sets a very high recursion_limit, so add ModelCallLimitMiddleware for a real cap.
[05]
What you need to run the examples
Python 3.11 or later (Pydantic AI and Google ADK require it) and an OpenAI API key in OPENAI_API_KEY. Every example uses gpt-5-mini.
One virtual environment per framework, because their MCP dependencies conflict: smolagents 1.26, CrewAI 1.15 and Microsoft Agent Framework 1.22 need mcp<2, while LangChain's MCPAdapter, Pydantic AI, the OpenAI Agents SDK and llama-index-tools-mcp 0.6 install mcp 2.x. Promptise 1.10 works with either.
Promptise in the environment that runs the shared MCP server, because each example starts it with python orders_server.py.
pip install "promptise==1.10.0" # the server and the Promptise agent
pip install "langchain[mcp]==1.4.6" "langgraph==1.2.16" langchain-openai # LangGraph
pip install "pydantic-ai-slim[openai,mcp]==2.58.0" # Pydantic AI
pip install "openai-agents==0.24.0" # OpenAI Agents SDK
pip install "crewai[mcp]==1.15.28" # CrewAI
pip install "google-adk[mcp]==2.12.0" litellm # Google ADK, OpenAI via LiteLLM
pip install "agent-framework-core==1.22.0" "agent-framework-openai==1.17.0" # Microsoft Agent Framework
pip install "llama-index-core==0.14.25" llama-index-llms-openai "llama-index-tools-mcp==0.6.0" # LlamaIndex
pip install "smolagents[mcp,openai]==1.26.0" "mcp<2" # smolagentsThe agent answers order questions and can refund an order. The rule is the same everywhere: refunds up to $100 are approved, larger ones are refused before the tool runs, and a run makes at most six model calls. Both tools live on one MCP server:
"""The MCP server every version connects to: two tools over stdio."""
from promptise.mcp.server import MCPServer
ORDERS = {
"O-1001": {"order_id": "O-1001", "item": "Desk lamp", "amount": 49.00, "status": "delivered"},
"O-1002": {"order_id": "O-1002", "item": "Office chair", "amount": 219.00, "status": "delivered"},
}
server = MCPServer(name="orders")
@server.tool(read_only_hint=True)
async def get_order(order_id: str) -> dict:
"""Look up an order by ID: item, amount in USD and status."""
return ORDERS.get(order_id.strip().upper(), {"error": f"No order {order_id}"})
@server.tool(destructive_hint=True)
async def refund_order(order_id: str, amount: float) -> dict:
"""Refund an order. Moves money, so it needs approval."""
return {"refunded": True, "order_id": order_id, "amount": amount}
if __name__ == "__main__":
server.run()Each version asks the same question: "Order O-1002 arrived broken. Please refund it in full." The order costs $219, so the refund must be refused.
[06]
The best Python agent frameworks, one by one
Each profile says where the framework is strongest and weaker, then runs the same agent.
LangGraph: best for durable production workflows
LangGraph 1.2 is LangChain's low-level runtime: you define state, nodes and edges, and compile the graph with a checkpointer. LangChain 1.x's create_agent builds on it. It is the strongest choice when a run must pause for a person and resume after a restart, or when you need branches and parallel steps you control. The cost is more wiring for simple agents. Tracing goes to LangSmith only if you turn it on.
import asyncio
import uuid
from fastmcp.client.transports import StdioTransport
from langchain.agents import create_agent
from langchain.agents.middleware import HumanInTheLoopMiddleware, ModelCallLimitMiddleware
from langchain.mcp import MCPAdapter # beta in langchain 1.4
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.types import Command
PROMPT = "You are an order-support agent. Use the tools. If a refund is refused, say why. Answer in one sentence."
QUESTION = "Order O-1002 arrived broken. Please refund it in full."
async def main():
async with MCPAdapter(StdioTransport(command="python", args=["orders_server.py"])) as orders:
agent = create_agent(
model="openai:gpt-5-mini",
tools=await orders.list_tools(),
system_prompt=PROMPT,
middleware=[
HumanInTheLoopMiddleware(interrupt_on={"refund_order": {"allowed_decisions": ["approve", "reject"]}}),
ModelCallLimitMiddleware(run_limit=6, exit_behavior="error"),
],
checkpointer=InMemorySaver(), # an interrupt needs a checkpointer
)
config = {"configurable": {"thread_id": str(uuid.uuid4())}}
result = await agent.ainvoke({"messages": [{"role": "user", "content": QUESTION}]}, config, version="v2")
while result.interrupts: # the run paused for approval
decisions = []
for interrupt in result.interrupts:
for action in interrupt.value["action_requests"]:
if action["args"]["amount"] <= 100:
decisions.append({"type": "approve"})
else:
decisions.append({"type": "reject", "message": "Refunds over $100 need a manager."})
result = await agent.ainvoke(Command(resume={"decisions": decisions}), config, version="v2")
print(result.value["messages"][-1].content)
asyncio.run(main())I can't issue the full $219.00 refund for Order O-1002 because refunds over $100 require manager approval.Approval and the call limit are middleware. The run stops with interrupts, and a Command with your decisions resumes it. That needs a checkpointer even for one run; with a database checkpointer the paused run survives a restart.
Pydantic AI: best for typed, structured apps
Pydantic AI 2.58 treats an agent as a typed function: validated dependencies in, validated output out. Version 2.0 shipped in June 2026. It limits requests, tokens and tool calls per run, which few frameworks do, and integrates with Temporal, DBOS and Prefect, among others, for durable runs. Pick it if your team likes Pydantic and wants type errors before runtime.
import asyncio
from fastmcp.client.transports import StdioTransport
from pydantic_ai import Agent, DeferredToolRequests, DeferredToolResults, ToolDenied
from pydantic_ai.mcp import MCPToolset
from pydantic_ai.usage import UsageLimits
PROMPT = "You are an order-support agent. Use the tools. If a refund is refused, say why. Answer in one sentence."
QUESTION = "Order O-1002 arrived broken. Please refund it in full."
orders = MCPToolset(StdioTransport(command="python", args=["orders_server.py"]))
agent = Agent(
"openai:gpt-5-mini",
instructions=PROMPT,
toolsets=[orders.approval_required(lambda ctx, tool, args: tool.name == "refund_order")],
output_type=[str, DeferredToolRequests],
)
LIMITS = UsageLimits(request_limit=6) # at most 6 model requests
async def main():
async with agent:
result = await agent.run(QUESTION, usage_limits=LIMITS)
while isinstance(result.output, DeferredToolRequests): # the run paused for approval
approvals = {}
for call in result.output.approvals:
ok = call.args_as_dict()["amount"] <= 100
approvals[call.tool_call_id] = True if ok else ToolDenied("Refunds over $100 need a manager.")
result = await agent.run(
message_history=result.all_messages(),
deferred_tool_results=DeferredToolResults(approvals=approvals),
usage_limits=LIMITS, usage=result.usage,
)
print(result.output)
asyncio.run(main())I couldn't issue a full refund for order O-1002 ($219) because refunds over $100 require manager approval.The toolset is marked approval_required. The run ends with DeferredToolRequests, and a new run continues from the message history with your decisions. usage=result.usage keeps the limit counting across the pause. Use an explicit StdioTransport: a bare script path starts the server with the agent's own interpreter.
OpenAI Agents SDK: best for beginners and OpenAI-first teams
The OpenAI Agents SDK 0.24 has few concepts: agents, tools, handoffs, guardrails and sessions. MCP servers are built in, including OpenAI's hosted MCP tool. It works with other providers through any OpenAI-compatible endpoint or an adapter, but it is designed around OpenAI, and it is still 0.x, so minor versions can change the API. Tracing is on by default and goes to OpenAI.
import asyncio
import json
from agents import Agent, Runner
from agents.mcp import MCPServerStdio
PROMPT = "You are an order-support agent. Use the tools. If a refund is refused, say why. Answer in one sentence."
QUESTION = "Order O-1002 arrived broken. Please refund it in full."
async def main():
async with MCPServerStdio(
params={"command": "python", "args": ["orders_server.py"]},
require_approval={"always": {"tool_names": ["refund_order"]}},
) as orders:
agent = Agent(name="support", instructions=PROMPT, model="gpt-5-mini", mcp_servers=[orders])
result = await Runner.run(agent, QUESTION, max_turns=6)
while result.interruptions: # the run paused for approval
state = result.to_state()
for item in result.interruptions:
if json.loads(item.arguments)["amount"] <= 100:
state.approve(item)
else:
state.reject(item, rejection_message="Refunds over $100 need a manager.")
result = await Runner.run(agent, state, max_turns=6)
print(result.final_output)
asyncio.run(main())Refund for O-1002 was refused because refunds over $100 require manager approval.Approval is declared on the MCP server connection. The run returns interruptions, you approve or reject each one on a RunState, and run again. RunState serializes to JSON, so a paused run can wait in a database you trust. Set OPENAI_AGENTS_DISABLE_TRACING=1 if traces must stay in your systems.
CrewAI: best for multi-agent teams
CrewAI 1.15 describes agents by role, goal and backstory and groups them into crews that work through tasks, in sequence or under a manager agent. Flows add event-driven steps with persisted state. It is the most direct way to express "a researcher and a writer working together". It is weaker as a single strict agent: approval is a hook you write rather than a per-tool setting, and max_iter forces a final answer instead of raising. It sends anonymous telemetry unless you set CREWAI_DISABLE_TELEMETRY=true.
from crewai import LLM, Agent, Crew, Task
from crewai.hooks import before_tool_call
from crewai.mcp import MCPServerStdio
PROMPT = "You are an order-support agent. Use the tools. If a refund is refused, say why. Answer in one sentence."
QUESTION = "Order O-1002 arrived broken. Please refund it in full."
@before_tool_call
def review(context):
# MCP tool names get a prefix, so match the end of the name.
if context.tool.name.endswith("refund_order") and context.tool_input["amount"] > 100:
return False # blocks the call
return None
agent = Agent(
role="Order support agent",
goal="Answer order questions and process refunds correctly",
backstory=PROMPT,
llm=LLM(model="gpt-5-mini"),
mcps=[MCPServerStdio(command="python", args=["orders_server.py"])],
max_iter=5, # CrewAI makes one more call after max_iter to force an answer
)
task = Task(description=QUESTION, expected_output="A one-sentence answer.", agent=agent)
print(Crew(agents=[agent], tasks=[task]).kickoff().raw)I couldn't refund the full $219.00 for order O-1002 because the refund tool was blocked by a security hook—refunds require additional approval, so please contact finance or provide authorization to proceed.The global before_tool_call hook returns False to block the call. MCP tools from mcps= get a server prefix, so the hook matches the end of the name; a hook that compares the exact name never fires. A call blocked with False carries no reason, so the model guesses at one. CrewAI's newer execution hooks can filter by tool name, ask a person with ctx.request_human_input() and raise HookAborted with a reason.
Google ADK: best for Gemini and Google Cloud
Google ADK 2.12 combines LLM agents with workflow agents that run sub-agents in sequence, in parallel or in a loop, and 2.0 (May 2026) added graph workflows. It runs in Python, TypeScript, Go, Java and Kotlin, has a dev UI, and deploys to Google Cloud. Other models work through LiteLLM, as here. Tool confirmation, ADK's pause-for-a-person feature, is marked experimental and doesn't work with the database or Vertex AI session services yet, so this version uses a callback.
import asyncio
from google.adk.agents import LlmAgent
from google.adk.agents.run_config import RunConfig
from google.adk.models.lite_llm import LiteLlm
from google.adk.runners import InMemoryRunner
from google.adk.tools.mcp_tool import McpToolset, StdioConnectionParams
from google.genai import types
from mcp import StdioServerParameters
PROMPT = "You are an order-support agent. Use the tools. If a refund is refused, say why. Answer in one sentence."
QUESTION = "Order O-1002 arrived broken. Please refund it in full."
def review(tool, args, tool_context):
# Returning a dict skips the tool and hands the dict to the model as the result.
if tool.name == "refund_order" and args["amount"] > 100:
return {"error": "Refund not approved: refunds over $100 need a manager."}
return None
orders = McpToolset(connection_params=StdioConnectionParams(
server_params=StdioServerParameters(command="python", args=["orders_server.py"])))
agent = LlmAgent(name="support", model=LiteLlm(model="openai/gpt-5-mini"), instruction=PROMPT,
tools=[orders], before_tool_callback=review)
async def main():
runner = InMemoryRunner(agent=agent, app_name="orders")
session = await runner.session_service.create_session(app_name="orders", user_id="u1")
message = types.Content(role="user", parts=[types.Part(text=QUESTION)])
async for event in runner.run_async(user_id="u1", session_id=session.id, new_message=message,
run_config=RunConfig(max_llm_calls=6)):
if event.is_final_response() and event.content and event.content.parts:
print(event.content.parts[0].text)
await orders.close()
asyncio.run(main())I attempted a full $219 refund for order O-1002 but it was refused because refunds over $100 require manager approval.before_tool_callback runs before every tool. Returning a dict skips the tool and hands the dict to the model as its result. RunConfig(max_llm_calls=6) sets the cap; the default is 500. Expect "experimental feature" warnings on stderr in 2.12.
Microsoft Agent Framework: best for Microsoft, Azure and .NET teams
Microsoft Agent Framework 1.22 is the successor to AutoGen and Semantic Kernel, built by the same teams; 1.0 shipped in April 2026. It pairs agents with graph workflows (sequential, concurrent, handoff, group chat and Magentic orchestration), has middleware, MCP tools and OpenTelemetry built in, and runs in Python and .NET, with Go in preview. It releases often: from 1.0 to 1.22 in about six months.
import asyncio
import json
from agent_framework import Agent, MCPStdioTool, Message
from agent_framework.openai import OpenAIChatCompletionClient
PROMPT = "You are an order-support agent. Use the tools. If a refund is refused, say why. Answer in one sentence."
QUESTION = "Order O-1002 arrived broken. Please refund it in full."
async def main():
client = OpenAIChatCompletionClient(model="gpt-5-mini")
client.function_invocation_configuration["max_iterations"] = 6 # at most 6 model round trips
orders = MCPStdioTool(name="orders", command="python", args=["orders_server.py"],
approval_mode={"always_require_approval": ["refund_order"]})
async with Agent(client=client, name="support", instructions=PROMPT, tools=orders) as agent:
session = agent.create_session() # resuming an approval needs the same session
result = await agent.run(QUESTION, session=session)
while result.user_input_requests: # the run paused for approval
replies = []
for request in result.user_input_requests:
args = request.function_call.arguments
args = json.loads(args) if isinstance(args, str) else args
replies.append(Message("user", [request.to_function_approval_response(args["amount"] <= 100)]))
result = await agent.run(replies, session=session)
print(result.text)
asyncio.run(main())I couldn't issue the full $219.00 refund for order O-1002 because the refund tool call was rejected by the system, indicating the refund requires additional approval or permission.approval_mode on the MCP tool turns a refund_order call into an approval request. You answer with to_function_approval_response() and resume with the same AgentSession; an approval that doesn't match a request recorded in that session is ignored. The response carries no reason, which shows in the vaguer answer.
LlamaIndex: best for agents over your documents
LlamaIndex 0.14 started as a data framework, and its agents run as event-driven workflows next to its indexing and retrieval tools. AgentWorkflow hands work between agents, and MCP tools come from llama-index-tools-mcp. Its README says the company's focus has shifted to LlamaParse while the open-source framework stays available.
import asyncio
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
from llama_index.tools.mcp import BasicMCPClient, McpToolSpec
PROMPT = "You are an order-support agent. Use the tools. If a refund is refused, say why. Answer in one sentence."
QUESTION = "Order O-1002 arrived broken. Please refund it in full."
client = BasicMCPClient("python", args=["orders_server.py"])
async def refund_order(order_id: str, amount: float) -> str:
"""Refund an order. Moves money, so it needs approval."""
# No approval setting for a tool: check in a wrapper, then call the MCP tool.
if amount > 100:
return "Refund not approved: refunds over $100 need a manager."
return str(await client.call_tool("refund_order", {"order_id": order_id, "amount": amount}))
async def main():
tools = await McpToolSpec(client=client, allowed_tools=["get_order"]).to_tool_list_async()
agent = FunctionAgent(tools=[*tools, refund_order], llm=OpenAI(model="gpt-5-mini"),
system_prompt=PROMPT)
print(await agent.run(QUESTION, max_iterations=6))
asyncio.run(main())Refund for order O-1002 cannot be processed because refunds over $100 require manager approval.allowed_tools leaves refund_order out, and a plain function with the check replaces it. For a human decision, LlamaIndex's documented pattern is a tool that waits for a HumanResponseEvent, with a serializable Context while it waits.
smolagents: best for agents that write code
smolagents 1.26, from Hugging Face, is a small library whose main agent, CodeAgent, writes Python code as its action instead of JSON tool calls. Its docs recommend running that code in a sandbox such as E2B or Docker. It has no approval setting, its MCP client needs mcp<2 (which it doesn't pin, so pin it yourself), and its latest release is from May 2026.
from mcp import StdioServerParameters
from smolagents import MCPClient, OpenAIModel, Tool, ToolCallingAgent
PROMPT = "You are an order-support agent. Use the tools. If a refund is refused, say why. Answer in one sentence."
QUESTION = "Order O-1002 arrived broken. Please refund it in full."
class ReviewedRefund(Tool):
"""smolagents has no approval setting, so wrap the tool and check first."""
skip_forward_signature_validation = True
def __init__(self, inner):
self.name, self.description = inner.name, inner.description
self.inputs, self.output_type, self.inner = inner.inputs, inner.output_type, inner
super().__init__()
def forward(self, **kwargs):
if kwargs["amount"] > 100:
return "Refund not approved: refunds over $100 need a manager."
return self.inner(**kwargs)
params = StdioServerParameters(command="python", args=["orders_server.py"])
with MCPClient(params, structured_output=False) as tools:
tools = [ReviewedRefund(t) if t.name == "refund_order" else t for t in tools]
agent = ToolCallingAgent(tools=tools, model=OpenAIModel(model_id="gpt-5-mini"),
instructions=PROMPT, max_steps=6, verbosity_level=0)
print(agent.run(QUESTION))I can't process the full $219 refund for order O-1002 because refunds over $100 require manager approval; I'll escalate this to a manager for approval.ToolCallingAgent makes JSON tool calls like the others, and a wrapper class checks the amount before the MCP tool runs. The answer promises an escalation that no tool performs. That is the model, not the framework: give the agent a real escalation tool or say in the prompt that it can't.
[07]
Where does Promptise Foundry fit?
Promptise Foundry 1.10.0, which we make, builds an agent from MCP servers with one call, build_agent(), and puts the production parts next to it: approvals, budgets, guardrails, sandboxed code execution, observability, an MCP server framework (the orders_server.py above is one), and promptise run for deployment. It runs on LangChain's packages and accepts LangChain models and tools.
import asyncio
from promptise import build_agent
from promptise.approval import ApprovalDecision, ApprovalPolicy
from promptise.config import StdioServerSpec
PROMPT = "You are an order-support agent. Use the tools. If a refund is refused, say why. Answer in one sentence."
QUESTION = "Order O-1002 arrived broken. Please refund it in full."
async def review(request): # the approval rule: refunds up to $100
ok = request.arguments["amount"] <= 100
return ApprovalDecision(approved=ok, reason=None if ok else "Refunds over $100 need a manager.")
async def main():
agent = await build_agent(
model="openai:gpt-5-mini",
servers={"orders": StdioServerSpec(command="python", args=["orders_server.py"])},
instructions=PROMPT,
approval=ApprovalPolicy(tools=["refund_order"], handler=review),
max_agent_iterations=6, # at most 6 model calls
)
try:
result = await agent.ainvoke({"messages": [{"role": "user", "content": QUESTION}]})
print(result["messages"][-1].content)
finally:
await agent.shutdown()
asyncio.run(main())I attempted to refund order O-1002 for $219, but it was denied because refunds over $100 require manager approval.The approval rule is a policy on the agent. The handler runs when the model calls refund_order, and a refusal reaches the model with its reason. There is no resume loop to write, which also means the run waits in the process while the handler decides.
Choose it when you build the tools as well as the agent, or want approvals, budgets and guardrails as settings. Choose another framework when:
A person approves tomorrow. A pending Promptise approval doesn't survive a restart. LangGraph, Pydantic AI, the OpenAI Agents SDK and Microsoft Agent Framework store the paused run, and so do CrewAI Flows.
You need typed output from the agent. build_agent() has no built-in typed output. Pydantic AI does this best.
You want role-based teams. CrewAI's crews are a closer model.
You want a large community or a language other than Python. Promptise is a young project with a small community, and it is Python only. LangGraph, CrewAI and the OpenAI Agents SDK have far more users, examples and answers, and Google ADK and Microsoft Agent Framework also run outside Python.
[08]
What are the best multi-agent frameworks?
The useful question is which coordination model fits your work:
Coordination model | Frameworks | Fits when |
|---|---|---|
Role-based crew | CrewAI | Work splits into roles that hand results to each other |
Graph or workflow | LangGraph, Microsoft Agent Framework, Google ADK | The order of steps is known and must be enforced |
Handoffs | OpenAI Agents SDK, LlamaIndex AgentWorkflow | One agent passes the conversation to a specialist |
Supervisor calls other agents as tools | OpenAI Agents SDK, Pydantic AI, ADK, Promptise | A coordinator delegates and combines answers |
Managed sub-agents | smolagents | A code-writing agent delegates subtasks |
Add a second agent only when one prompt and tool set can't do the job. Multi-agent systems in Python covers the patterns.
[09]
Other agent frameworks you will see in 2026 lists
These appear in many top-ranking lists and are real options, without a runnable section here:
Claude Agent SDK (0.2.170) packages Claude Code as a library, with subagents and MCP. Pick it for Claude agents that work with files and shells.
Agno (3.1.8), formerly Phidata, offers agents, teams and workflows plus AgentOS, a runtime for serving them.
Strands Agents (1.61.1), from AWS, is a model-driven SDK with agents as tools, swarms and graphs, and MCP built in. Pick it on AWS and Bedrock.
Haystack (3.4.0), by deepset, builds search-heavy pipelines with an Agent component.
DSPy (3.4.1) optimizes prompts against a metric. Use it with an agent framework, not instead of one.
Mastra and the Vercel AI SDK are TypeScript frameworks; this guide covers Python only.
What happened to AutoGen, Semantic Kernel and AG2?
AutoGen's README now says the project is archived and no longer maintained, and points new users to Microsoft Agent Framework. Its last release, autogen-agentchat 0.7.5, is from September 2025. Semantic Kernel still ships releases, but its README calls Microsoft Agent Framework its successor. AG2, the community fork of AutoGen, released 1.0 in July 2026 with a new API that is not a drop-in upgrade. Migrate from AutoGen shows how to port an AutoGen team.
If you are leaving LangChain rather than choosing from scratch, LangChain alternatives covers that move, including tools, prompts and memory.
[10]
Running it in production
Whichever framework you pick, check these before the first unattended run:
The limit raises. Give the agent a task that needs more steps than the limit and confirm your code sees an error, not a normal answer.
The approval can't be skipped. Test a call that must be refused and check that the tool never ran. Name matching is the usual failure.
Refusals carry a reason the model can pass on, not a bare "rejected".
Traces go where you expect. Turn default exporters off or point them at your backend. AI agent observability lists what to record.
Dependencies are pinned, framework and mcp together, with evals after every upgrade.
[11]
Common problems and fixes
Symptom | Cause | Fix |
|---|---|---|
| The meta-package pulls subpackages that only exist as betas | Install agent-framework-core and the provider package you need, or pass --prerelease=allow |
| smolagents 1.26's MCP client needs mcp<2 but doesn't pin it | Install "mcp<2" in its own environment |
| An adapter version older than 0.3.2 next to mcp 2.x | Use langchain.mcp.MCPAdapter, or pin mcp<2 for the adapters package |
CrewAI runs a refund the hook should block | MCP tool names get a server prefix | Match context.tool.name.endswith("refund_order") |
Google ADK has no MCP toolset | mcp is an optional extra in ADK 2.x | |
A Microsoft Agent Framework approval is ignored | The approval was sent without the session that recorded the request | Pass the same AgentSession to every run() |
Traces appear in an OpenAI dashboard you didn't expect | The Agents SDK exports traces by default | OPENAI_AGENTS_DISABLE_TRACING=1 |
The agent says it "escalated" something | The model invents an action no tool performs | Add a real escalation tool, or say in the prompt what the agent can't do |
[12]
Limitations
This is a feature comparison, not a benchmark. It doesn't rank accuracy, speed or cost. With the same model and tools, answers depend mostly on the model.
The ecosystem moves fast. Most frameworks here shipped a release in the week before this guide.
We make Promptise. Every claim about other frameworks comes from their own documentation or source, and the profiles say where they are stronger.
[13]
Frequently asked questions
What is the best AI agent framework in 2026?
There is no single best one; it depends on the project. For production workflows that pause and resume, LangGraph. For multi-agent teams, CrewAI. For typed apps, Pydantic AI. For beginners and OpenAI-first projects, the OpenAI Agents SDK. For Azure and .NET, Microsoft Agent Framework. For Gemini and Google Cloud, Google ADK. For MCP-heavy tools, the OpenAI Agents SDK or Promptise Foundry, which also builds MCP servers.
What is the best Python agent framework for beginners?
The OpenAI Agents SDK has the fewest concepts and short examples, and it runs other providers through OpenAI-compatible endpoints or adapters. smolagents is also small and readable. Both let you learn the agent loop before you need graphs or crews.
What are the best multi-agent frameworks in 2026?
CrewAI for role-based teams, LangGraph and Microsoft Agent Framework for graph workflows with explicit control, the OpenAI Agents SDK for handoffs between specialists, and Google ADK for sequential, parallel and loop workflow agents. Promptise and Pydantic AI support a supervisor agent that calls other agents as tools.
Is AutoGen still maintained?
No. AutoGen's GitHub README says the project is archived and no longer maintained, and it points new users to Microsoft Agent Framework, its successor from the same teams. AG2, a community fork, continues separately with a new API since its 1.0 release in July 2026.
Which AI agent frameworks support MCP?
All nine in this guide can use MCP servers. Pydantic AI, the OpenAI Agents SDK, CrewAI, Google ADK, Microsoft Agent Framework, smolagents and Promptise have a client built in. LangChain's client is in beta in langchain.mcp, and LlamaIndex uses llama-index-tools-mcp. Promptise also includes a framework for building MCP servers.
How does Promptise Foundry compare to LangGraph and CrewAI?
Promptise builds an agent from MCP servers with one call and adds approvals, budgets, guardrails and an MCP server framework. LangGraph gives finer control and approvals that survive a restart, which Promptise doesn't. CrewAI's crews are a better model for teams of agents, and both have much larger communities than Promptise, which is young and Python only. Promptise fits teams that build their own tools.
Can I switch agent frameworks later?
Yes, if you serve tools over MCP and keep prompts and approval rules outside framework classes. A switch then means rewriting the agent setup and the approval resume logic. State stored by one framework, such as LangGraph checkpoints, doesn't move to another.
[14]
Next steps
Leaving LangChain instead: LangChain alternatives.
Build the tools once for every framework: build a production MCP server in Python.
Compare graph frameworks: LangGraph alternatives and CrewAI alternatives.
Reference: the Promptise docs for building agents and approval.