Multi-Agent Frameworks
Wissen
Before we talk about frameworks, the most important question first:
!Rule of Thumb: Under 4 Agents, No Framework Needed
If your system consists of 2-3 agents communicating through simple function calls, you don't need a framework. An orchestrator script with API calls is enough. Frameworks bring overhead that only pays off above a certain complexity threshold.
When does a framework pay off?
- 4+ agents with complex communication patterns
- When you need dynamic workflows (agents created/removed at runtime)
- When you need state management across multiple agent steps
- When you don't want to implement parallelization and error handling yourself
| Category | |||
|---|---|---|---|
| Language | Python (+ JS Beta) | TypeScript | Python |
| Agent Types | Graph-based, freely definable | Event-driven, tool-based | Role-based (Agent, Task, Crew) |
| Orchestration | StateGraph with Nodes & Edges | Workflow Engine, Event Streams | Sequential / Hierarchical Crews |
| State Management | Typed State, Checkpointing, Time-Travel | Built-in Persistence, Workflow State | Simple — task output as input |
| Learning Curve | Steep — requires graph concepts | Moderate — TypeScript skills sufficient | Flat — quick to get started |
| Community | Large (LangChain ecosystem) | Growing, still small | Medium, actively growing |
| Pricing | Open Source (LangSmith paid) | Open Source | Open Source (Enterprise Plan available) |
Click on a framework to see all details
LangGraph (Python/TypeScript, Graph-Based)
LangGraph models multi-agent workflows as directed graphs. Each node is an agent or function, each edge defines the data flow. This gives you maximum control over the workflow -- at the cost of more boilerplate.
from langgraph.graph import StateGraph, END
# State defines what's shared between agents
class AgentState(TypedDict):
messages: list[str]
current_task: str
results: dict
# Build the graph
workflow = StateGraph(AgentState)
# Add agents as nodes
workflow.add_node("researcher", research_agent)
workflow.add_node("analyzer", analysis_agent)
workflow.add_node("writer", writer_agent)
# Edges define the workflow
workflow.add_edge("researcher", "analyzer")
workflow.add_conditional_edges(
"analyzer",
should_continue, # Function decides the next step
{"write": "writer", "research_more": "researcher"}
)
workflow.add_edge("writer", END)
Strengths: Full control, state management, checkpointing, debugging (Graph-Viz), broad ecosystem. Weaknesses: Verbose, steep learning curve.
Mastra (TypeScript, Declarative / Graph-Based)
Mastra uses a declarative, graph-based model and is built for TypeScript/Node.js teams. Workflows are defined as steps with conditions, and the graph emerges from the declared step sequence.
import { Agent, Workflow } from '@mastra/core';
const researchAgent = new Agent({
name: 'researcher',
model: 'claude-sonnet-5',
instructions: 'You research information on a given topic.',
tools: [webSearch, documentReader],
});
const analysisWorkflow = new Workflow({
name: 'analysis-pipeline',
steps: [
{ agent: researchAgent, input: (ctx) => ctx.query },
{ agent: analyzerAgent, input: (prev) => prev.result },
{
condition: (prev) => prev.confidence < 0.8,
then: { agent: researchAgent, input: (prev) => prev.gaps },
else: { agent: writerAgent, input: (prev) => prev.analysis },
},
],
});
Strengths: TypeScript-native, declarative, less boilerplate, web integration. Weaknesses: Younger ecosystem, less control, checkpoint support not as mature.
CrewAI (Python, Role-Based)
CrewAI thinks in roles and teams, not graphs or events. You define agents with roles ("Senior Developer", "QA Engineer"), give them tasks, and let them collaborate as a team.
from crewai import Agent, Task, Crew
researcher = Agent(
role="Senior Research Analyst",
goal="Find the most relevant information on the topic",
backstory="You have 15 years of experience in market research.",
tools=[web_search, document_reader],
llm="claude-sonnet-5"
)
writer = Agent(
role="Technical Writer",
goal="Create a clear, structured report",
backstory="You've been writing technical documentation for years.",
llm="claude-haiku-4-5"
)
research_task = Task(
description="Analyze the current state of {topic}",
agent=researcher,
expected_output="Structured summary with sources"
)
write_task = Task(
description="Write a report based on the research",
agent=writer,
expected_output="Finished report in Markdown format",
context=[research_task] # Dependency
)
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, write_task],
verbose=True
)
Strengths: Intuitive, minimal code, delegation, quick start. Weaknesses: Less control, harder debugging, scaling limitations.
Verstehen
Framework Comparison: When to Use Which?
| Criterion | LangGraph | Mastra | CrewAI |
|---|---|---|---|
| Language | Python, TypeScript | TypeScript | Python |
| Paradigm | Graph-based | Declarative / Graph-based | Role-based |
| Control | Maximum | Medium | Minimum |
| Learning curve | Steep | Medium | Flat |
| Boilerplate | High | Low | Very low |
| Debugging | Excellent (Graph-Viz) | Good | Medium |
| Best for | Complex, plannable workflows | TypeScript teams, web apps | Prototypes, simple teams |
| Production-ready | Yes | Increasingly | For simple use cases |
*Decision Guide
LangGraph when you need full control (Python or TypeScript). Mastra when you want a TypeScript-native declarative framework. CrewAI when you want a quick prototype. And none of them when you have fewer than 4 agents.
Anwenden
Your team needs declarative workflows with webhook integration in an existing Next.js app. The workflow has 6 agents with conditional branching. Which framework do you choose?
You want to build a weekend prototype: 3 agents should collaboratively research, write, and review a blog post. You're working alone. What's the most pragmatic approach?
Reflect
Frameworks are tools, not solutions. The most important decision is not which framework to use, but whether you need one at all. With the rule of thumb "under 4 agents, no framework needed" and an understanding of each framework's strengths, you can make informed architectural decisions.