Multi-Agent Systems with LangGraph and CrewAI: Practical Patterns for Coordinated AI Workflows
Explore practical patterns for building multi-agent systems using LangGraph and CrewAI, including sequential chains, hierarchical teams, and dynamic task decomposition.

Is your company ready for AI? Download our free checklist →
Download checklistIntroduction
Multi-agent systems (MAS) enable multiple AI agents to collaborate on complex tasks, each bringing specialized capabilities. Two powerful Python frameworks, LangGraph and CrewAI, offer distinct approaches for orchestrating agent interactions. In this post, we’ll explore practical patterns like sequential chains, hierarchical teams, and dynamic task decomposition, with code examples to get you started.
Why Multi-Agent Systems?
Single-agent systems can struggle with tasks requiring diverse expertise, error recovery, or parallel execution. Multi-agent setups allow:
- Specialization: Each agent focuses on a specific skill (e.g., research, coding, summarization).
- Resilience: Agents can verify each other’s output or retry failures.
- Scalability: Work can be distributed across agents running in parallel.
Overview of LangGraph and CrewAI
LangGraph
LangGraph, built on LangChain, models agent workflows as a directed graph with nodes (agent actions) and edges (transitions). It’s ideal for stateful, cyclic workflows where agents can loop back for refinement.
CrewAI
CrewAI uses a role-based approach: you define “Agents” with specific roles and goals, and a “Crew” manages their collaboration using a sequential or hierarchical process.
Pattern 1: Sequential Chain
In a sequential chain, agents execute one after another, passing results downstream. This pattern is simple and effective for linear tasks like research-to-summary.
CrewAI Example
from crewai import Agent, Task, Crew
researcher = Agent(
role='Senior Researcher',
goal='Find the latest AI safety papers',
backstory='Expert in AI ethics and safety research.',
allow_delegation=False
)
writer = Agent(
role='Technical Writer',
goal='Summarize research findings into a blog post',
backstory='Skilled at distilling complex topics.',
allow_delegation=False
)
research_task = Task(
description='Search for recent papers on AI safety',
expected_output='List of 3-5 papers with summaries',
agent=researcher
)
write_task = Task(
description='Write a 200-word blog intro based on the research',
expected_output='Engaging introduction paragraph',
agent=writer
)
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, write_task],
process='sequential'
)
result = crew.kickoff()
print(result)
LangGraph Alternative
LangGraph can model the same flow with a graph. Use StateGraph to pass messages between nodes.
Want a personalized diagnostic? Complete our free checklist →
Download checklistPattern 2: Hierarchical Team
In this pattern, a manager agent delegates tasks to specialist agents and synthesizes results. Useful for complex projects like building a software module.
CrewAI Hierarchical Process
manager = Agent(
role='Project Manager',
goal='Coordinate the team to build a weather app',
backstory='Experienced in software project management.',
allow_delegation=True
)
backend_dev = Agent(
role='Backend Developer',
goal='Implement the data layer',
backstory='Expert in Python and APIs.',
allow_delegation=False
)
frontend_dev = Agent(
role='Frontend Developer',
goal='Build the UI',
backstory='Expert in React.',
allow_delegation=False
)
crew = Crew(
agents=[manager, backend_dev, frontend_dev],
tasks=[], # tasks created dynamically by manager
process='hierarchical',
manager_llm='gpt-4' # LLM for manager to make decisions
)
LangGraph Hierarchical Flow
Use a graph with conditional edges. The manager node decides which specialist to call next based on current state.
Pattern 3: Dynamic Task Decomposition
Some tasks are too vague to predefine all steps. Dynamic decomposition allows agents to break down a high-level goal into sub-tasks on the fly.
LangGraph with Tool Use
from langgraph.graph import StateGraph, END
from langchain.agents import create_react_agent, AgentExecutor
# Define state
class AgentState(TypedDict):
messages: list
next_step: str
# Define nodes
def planner(state):
# Call planning LLM to generate sub-tasks
plan = llm.invoke(f"Break down: {state['messages'][-1]}")
return {"messages": state["messages"] + [plan], "next_step": "executor"}
def executor(state):
# Execute each sub-task
result = tool_agent.run(state["messages"][-1])
return {"messages": state["messages"] + [result], "next_step": END}
# Build graph
builder = StateGraph(AgentState)
builder.add_node("planner", planner)
builder.add_node("executor", executor)
builder.set_entry_point("planner")
builder.add_conditional_edges("planner", lambda s: s["next_step"])
builder.add_edge("executor", END)
graph = builder.compile()
Pattern 4: Verification & Correction Loop
Agents often produce errors. A verification agent can review outputs and request corrections. This loop improves reliability.
CrewAI Example with Sequential and Condition
CrewAI’s sequential process can be extended by adding a review task and a conditional loop via a custom callbacks or using LangGraph for cycles.
Practical Considerations
- Memory: LangGraph supports state persistence; CrewAI uses roles and context windows.
- Cost: Hierarchical manager LLM calls can be expensive. Use cheaper models for simple decisions.
- Error Handling: Implement retry logic in custom tools or using LangGraph’s node timeouts.
Real-World Use Cases
- Customer Support: A triage agent classifies issues, then routes to specialized support agents.
- Content Generation: Research agent finds data, writer creates draft, editor reviews.
- Code Development: PM decomposes tasks, coders implement, QA tests.
Conclusion
LangGraph and CrewAI provide complementary patterns for building multi-agent systems. CrewAI is excellent for role-based, predefined workflows with minimal code. LangGraph offers fine-grained control over cyclic and conditional flows. Choose based on your need for flexibility vs. simplicity. Experiment with these patterns to find what fits your use case.
Further Reading
- LangGraph Documentation - Official docs and tutorials
- CrewAI Examples Repository - Sample projects and patterns
Start small, iterate, and build intelligent multi-agent systems today!
Ready for the next step? Evaluate your company with our free checklist →
Download checklistRelated posts
- AI & ML◈
Invisible AI Integration: How It's Quietly Reshaping Our Daily Lives
Invisible AI Integration: How It's Quietly Reshaping Our Daily Lives
Sep 30, 2026
- Backend▣
Ada Lovelace: The Victorian Visionary Who Wrote the First Algorithm in 1843
Ada Lovelace: The Victorian Visionary Who Wrote the First Algorithm in 1843
Sep 29, 2026
- AI & ML◈
Apple Unveils 2026 AI Developer Tools: A New Era for On-Device Intelligence
Apple Unveils 2026 AI Developer Tools: A New Era for On-Device Intelligence
Sep 28, 2026