A Field Guide to Open-Source Python Agent Harnesses
Eight open-source Python harnesses for building AI agents, from deepagents and LangGraph to the Claude Agent SDK. What each one is good at, where it struggles, and how to choose between them.

Why the harness matters more than the model
It is easy to obsess over which model to use. But the model is increasingly a commodity. The frontier labs ship comparable capabilities within weeks of each other, and swapping one for another is often a one-line change. What actually determines whether your agent works in production is the harness: the code around the model that handles planning, tool calls, memory, retries, and control flow.
The harness is where your real engineering lives. It decides how a task gets decomposed, what the agent is allowed to do, how state survives across steps, and what happens when something fails. Two teams using the exact same model can ship very different products depending on the harness they build.
The good news is that you no longer have to write one from scratch. A healthy set of open-source Python harnesses now covers everything from a bare runtime to a fully assembled agent. They make different bets, and this guide walks through the main ones without crowning a winner.
What these harnesses have in common
Every option below shares two traits: they are written in Python and they are open source.
Python matters because that is where the ecosystem lives. The model SDKs, the evaluation tooling, the vector stores, the data libraries, and the notebook workflows your team already uses are Python first. A harness in the same language plugs straight into them.
Open source matters because an agent harness is infrastructure you will need to debug. When an agent loops forever, picks the wrong tool, or drops context on a handoff, being able to open the source and trace the control flow is the difference between a fix and a support ticket. You can also fork it when an abstraction leaks.
The honest tradeoff: with an open-source harness you own more of the maintenance, the upgrades, and the operational work than you would with a fully managed platform. That is a real cost. Whether it is worth paying depends on how much you expect to customize and how much you value seeing inside. This guide does not assume an answer. It maps the options so you can decide.
The shortlist
A handful of open-source Python harnesses have become the serious options. They differ less in raw capability than in how much they decide for you. Some hand you a low-level runtime and let you assemble everything. Others ship an opinionated agent out of the box. Here is roughly how they sit:
deepagents (LangChain)
deepagents packages the "deep agent" pattern: a planning tool, sub-agents with isolated context, and a virtual file system for working memory, all on top of LangGraph. It is close to a turnkey agent that can run long, multi-step tasks without you wiring the loop yourself. Creating one is deliberately small:
from deepagents import create_deep_agent
def get_weather(city: str) -> str:
"""Get weather for a given city."""
return f"It's always sunny in {city}!"
agent = create_deep_agent(
model="anthropic:claude-sonnet-4-6",
tools=[get_weather],
system_prompt="You are a helpful assistant.",
)
agent.invoke({"messages": [{"role": "user", "content": "What is the weather in SF?"}]})Strong at research, multi-source reports, and anything that benefits from a planner and delegated sub-tasks. Watch out for a young, still-evolving API, so pin your version, and an opinionated model you may end up fighting on unusual workflows.
LangGraph
LangGraph is the low-level graph runtime that deepagents is built on. You define agents as explicit state machines: nodes, edges, and a typed state object that flows between them, with durable execution and human-in-the-loop checkpoints. Strong at determinism and total control over the flow. Watch out for the boilerplate: for a simple agent you assemble more yourself than the higher-level options ask of you.
Claude Agent SDK (Anthropic)
Claude Agent SDK is the open-source harness behind Claude Code, available in Python and TypeScript. It drives a Claude agent through a production-tested loop with built-in tools (file edits, shell, search), MCP support, sub-agents, permission modes, and per-run budget caps. The Python entry point is async:
import asyncio
from claude_agent_sdk import query, ClaudeAgentOptions
async def main():
options = ClaudeAgentOptions(
system_prompt="You are a research assistant.",
max_turns=4,
max_budget_usd=0.50,
)
async for message in query(prompt="Summarize the state of agent harnesses.", options=options):
print(message)
asyncio.run(main())Strong at a battle-tested agent loop with real tool permissions and native cost controls like max_budget_usd. Watch out for its orientation around Claude models and the MCP tool model, which makes it the most opinionated option about the runtime it expects.
AutoGen (Microsoft)
AutoGen models a problem as a conversation between agents that message one another until the work is done. It is strong at multi-agent collaboration and at agents that write and run code while critiquing each other's output, and it is backed by Microsoft Research. Watch out for the conversational model, which can be harder to make deterministic, and an API that changed substantially in the v0.4 rewrite.
CrewAI
CrewAI models a problem as a crew of role-playing agents: a researcher, a writer, an editor, each with a goal and a backstory, collaborating on tasks. Strong at fast prototyping; it reads almost like describing a team. Watch out for the role metaphor obscuring the control flow when you need precise, fine-grained orchestration.
Agno
Agno is a full-stack framework for building agents with memory, knowledge, and tools built in, with a strong focus on speed and low runtime overhead. It scales from a single agent to teams of agents and treats multimodal input as a first-class concern. Strong at batteries-included agents with memory and retrieval out of the box. Watch out for a larger surface area and more conventions to learn than the minimal options.
PydanticAI
PydanticAI brings type safety to agents. Tools and outputs are defined as Pydantic models, so you get validated, structured I/O and editor autocomplete, with ergonomics that feel like FastAPI. Strong at typed, structured, reliable single agents. Watch out for multi-agent orchestration, which is not its main focus.
smolagents (Hugging Face)
smolagents is a minimal harness built around code-acting agents that write and run Python to accomplish tasks. Strong at staying small and getting out of your way. Watch out for the need to sandbox code execution, and fewer built-ins than the heavier frameworks.
At a glance
| Harness | Sweet spot | Multi-agent | Watch out for |
|---|---|---|---|
| deepagents | Long tasks needing planning and delegation | Yes, via sub-agents | Young, opinionated API |
| LangGraph | Explicit, durable orchestration | Yes | More to assemble yourself |
| Claude Agent SDK | Production agent loop with tools and budgets | Yes, via sub-agents | Centered on Claude and MCP |
| AutoGen | Agents that solve tasks by conversing | Yes | Harder to make deterministic |
| CrewAI | Role-based teams, fast to prototype | Yes | Less fine-grained control |
| Agno | Batteries-included agents, speed at scale | Yes, via teams | Larger surface to learn |
| PydanticAI | Typed, structured single agents | Limited | Not built for orchestration |
| smolagents | Minimal code-acting agents | Limited | Needs sandboxed execution |
How to choose
The patterns are not mutually exclusive, and neither are the libraries. deepagents and the Claude Agent SDK both run an agent loop you can drop beneath when you need to. A rough guide:
- Want a deep agent that plans and delegates with minimal setup? Start with deepagents.
- Want a production-tested loop with tools, permissions, and budget caps? Use the Claude Agent SDK.
- Want explicit, durable orchestration you fully control? Use LangGraph.
- Want agents that collaborate by conversing? Reach for AutoGen.
- Want a multi-agent team defined by roles, fast? Try CrewAI.
- Want batteries-included agents with memory and speed? Use Agno.
- Want typed, structured, single-agent reliability? Use PydanticAI.
- Want the smallest possible code-acting agent? Look at smolagents.
A few rules of thumb that hold across all of them:
- Start with the smallest harness that fits. Reach for the lower layer only when the higher one gets in your way.
- Prefer the harness whose primitives match your problem shape. A research task wants a planner; a structured-extraction task wants types; a contested decision wants a conversation.
- Value the escape hatch. The shared advantage of every option here is that you can read it and change it. Use that.
Where AIFlow fits
These harnesses give you the agent. What they do not give you, by design, is the layer an enterprise needs around every agent: single sign-on, role-based access, audit trails, data residency, model guardrails, and cost controls on inference. Bolt that onto each project individually and every new agent becomes its own compliance review and its own budgeting exercise.
AIFlow is the orchestration and governance perimeter that those harnesses run inside. A deepagents research agent, a hand-built LangGraph flow, a Claude Agent SDK loop, and a CrewAI crew can all run on AIFlow under the same controls, with the same observability, behind the same security boundary. Spend is tracked and capped per agent, per team, and per model from one place, so a runaway loop becomes a budget alert instead of a surprise invoice. You keep the open-source harness that fits each problem, and you stop rebuilding governance and cost tracking for every one.
The bottom line
There is no single best harness. deepagents and the Claude Agent SDK hand you a working agent loop; LangGraph hands you the runtime to build your own; AutoGen and CrewAI organize agents into conversations and teams; Agno bundles memory and speed; PydanticAI keeps everything typed; smolagents stays minimal. The right choice depends on the shape of your problem: planning, roles, dialogue, types, or raw control. Pick the harness whose primitives match your problem, and whose source you would be comfortable reading at 2 a.m., because eventually you will.