AI AGENT FRAMEWORKS
Comprehensive Class Notes & Interview Guide
LangChain • LangGraph • CrewAI • AutoGen
- Introduction to AI Frameworks
AI frameworks are unified platforms providing ready-made components for building LLM-powered applications. One platform, multiple LLM services — switch between OpenAI, Gemini, and Claude without rewriting code.
The Enterprise Analogy
Just as an enterprise needs different specialists, a GenAI system needs different agents for different roles.
- LangChain
LangChain is a framework for building LLM applications using a linear chain of pre-built components. Most widely used (~60% of GenAI projects).
Core Components
LangChain Flow (Linear Pipeline)
Limitations
❌ No native cycles or loops — chains are strictly linear
❌ Manual memory — developer must wire ConversationBufferMemory
❌ Latency under high query volume — no built-in parallel agents
Quick Code Pattern
- LangGraph
LangGraph is a production-grade framework built on LangChain for stateful, cyclic multi-agent workflows. It models workflows as directed graphs — enabling loops, branching, and human-in-the-loop.
LangGraph Router Workflow — Visual Diagram
The Supervisor Agent routes queries to the correct worker (PDF / SQL / Web), merges their results, and passes them through a human check. Rejections loop back to the Supervisor automatically.
Key Features
Quick Code Pattern
- CrewAI
CrewAI is an open-source framework for orchestrating role-playing AI agents. Agents have defined roles, goals, backstories, and tools — like a real team of specialists.
CrewAI Pipeline — Visual Diagram
The LLM powers both agents. The Research Analyst uses tools to gather and verify information. The Content Writer reads the research report and produces a blog post. Tasks run sequentially — Task 1 must finish before Task 2 starts.
Core Components
Agent Configuration
Crew Setup & Execution
Process Types