AI Agent Frameworks Compared: LangChain vs CrewAI vs Custom
We've built production agents on all three. Here is when to use LangChain, when CrewAI is the better call, and when both are wrong and you should write the agent loop yourself in 200 lines of Python.
Quick answer: Use LangGraph (the LangChain Inc subset that matters) when you need rich tool ecosystems, agent observability tooling out of the box, and your team already knows the framework. Use CrewAI when you have multi-agent orchestration with clear role separation. Write the agent loop yourself in 100-300 lines when you need maximum control, minimum overhead, or when the use case is simple enough that framework abstractions slow you down. We've shipped production agents in all three patterns; the right choice depends on the workflow shape.
The honest framework comparison
LangChain / LangGraph
When it shines: single-agent workflows with rich tool use, RAG, and observability via LangSmith. The integration ecosystem is huge — 600+ tools, every LLM provider, every vector DB. LangGraph specifically (the state-machine subset) has matured into a solid foundation for agentic workflows.
Where it bites: the surface area is huge and the abstractions change between versions. Junior engineers can spend a week chasing the right import path. Production debugging requires understanding LangChain internals.
Best fit: single-agent workflows, teams that already use LangChain elsewhere, projects that benefit from LangSmith observability.
CrewAI
When it shines: multi-agent workflows where roles are distinct (researcher + writer + editor, or planner + executor + verifier). The role-based abstraction maps cleanly to how humans think about multi-agent systems.
Where it bites: overkill for single-agent workflows, opinionated about agent-to-agent communication patterns. Less mature observability than LangSmith.
Best fit: multi-agent systems with clear role separation, content production pipelines, research-then-act workflows.
Custom (the unfashionable choice)
When it shines: when the agent loop is conceptually simple — call LLM, parse tool calls, execute tools, loop until done. Most production agents we've shipped are fundamentally a 100-300 line Python file plus tool implementations. No framework needed.
Where it bites: you reimplement basic patterns (retry, logging, observability, eval harness) yourself. If your team grows and others need to extend the agent, lack of conventions hurts.
Best fit: simple workflows, teams that prioritize control over convenience, projects where framework overhead matters (latency-sensitive, embedded use cases).
The pattern we follow
For most production agents, we start with custom. Wire the loop yourself. Add LangSmith for observability (you can use LangSmith without the rest of LangChain). Use Zod or Pydantic for structured outputs. Use the LLM provider's SDK directly.
If the workflow grows into multi-agent orchestration, we evaluate CrewAI. If we need a tool already in LangChain's ecosystem and don't want to wrap it ourselves, we add LangChain selectively.
The mistake we see most often: adopting LangChain "just in case" and then fighting the framework when the use case is simpler than what LangChain optimizes for.
What we'd never do
- Use a framework because the team doesn't know how to write an agent loop. Learning the loop is more durable than learning a framework.
- Use multiple frameworks in the same codebase. Pick one mental model.
- Optimize for "switching providers later." LangChain's provider-agnostic interface is real but the cost of building agnosticism upfront is rarely worth it. Re-write when you actually need to switch.
If you're picking a framework for a real project, an hourly call is usually enough to talk through the trade-offs. We've made the wrong choice ourselves before — happy to share what we learned.
Frequently asked questions
Should I use LangChain for my AI agent project?
Use LangGraph (the LangChain Inc state-machine subset) when you need rich tool ecosystems and want LangSmith observability out of the box. Skip it for simple single-agent workflows where a custom Python loop is faster to ship and easier to maintain.
When is CrewAI the right choice over LangChain?
CrewAI fits multi-agent workflows with clear role separation: researcher + writer + editor, or planner + executor + verifier. The role-based abstraction maps cleanly to how humans think about multi-agent systems. Less compelling for single-agent use cases.
Can I build a production AI agent without any framework?
Yes — and we often do. The agent loop is conceptually simple: call LLM, parse tool calls, execute tools, loop until done. 100-300 lines of Python plus tool implementations is plenty for most workflow agents. Add LangSmith for observability (it works without the rest of LangChain).
What about Pydantic AI, Vercel AI SDK, or other newer frameworks?
Pydantic AI is excellent for typed Python agents with structured outputs — worth considering if you want LangChain's value without LangChain's surface area. Vercel AI SDK is great for AI-in-the-frontend workflows but is not a backend agent framework. Both are valid choices for the right shape of project.
What's the biggest framework mistake teams make?
Adopting LangChain 'just in case' and then fighting the framework when the use case is simpler than what LangChain optimizes for. Start with the simplest thing that could work — usually a custom loop — and adopt a framework when you have a specific need it solves.
Related articles
Ready to ship an AI agent that actually works?
We embed with your team, build the agent, and ship it to production. Founder-led, no slide decks.