AI agents अब research demos से production systems में आ गए हैं। 2026 तक 60% से अधिक enterprise AI applications में agentic components शामिल होने की उम्मीद है। लेकिन agents को scratch से बनाना - tool loops, state, memory, error handling, और multi-agent coordination को manage करना - जटिल है। यहीं पर frameworks काम आते हैं।
2026 में चार frameworks प्रमुख हैं: LangGraph, CrewAI, OpenAI Agents SDK, और Claude Agent SDK। हर एक एक ही समस्या के लिए मूल रूप से अलग दृष्टिकोण अपनाता है: LLMs को reason करने, plan बनाने, tools का उपयोग करने, और collaborate करने की क्षमता देना।
एक नज़र में
| पहलू | LangGraph | CrewAI | OpenAI Agents SDK | Claude Agent SDK |
|---|---|---|---|---|
| निर्माता | LangChain | CrewAI Inc. | OpenAI | Anthropic |
| Architecture | Graph-based | Role-based | Handoff-based | Autonomous loop |
| दर्शन | अधिकतम नियंत्रण | Team collaboration | न्यूनतम abstraction | Agent को computer दो |
| भाषाएं | Python, TypeScript | Python | Python | Python, TypeScript |
| Model support | कोई भी (OpenAI, Claude, local) | कोई भी | कोई भी (नाम के बावजूद) | केवल Claude |
| GitHub stars | ~29k | ~40k | ~21k | ~6k |
| सबसे अच्छा | Complex stateful workflows | Multi-agent specialization | Routing और triage | Coding और file-heavy tasks |
LangGraph: The Graph Builder
LangGraph agent workflows को directed cyclic graphs के रूप में model करता है। आप nodes (functions जो काम करती हैं) और edges (उनके बीच transitions, वैकल्पिक रूप से conditional) define करते हैं। State graph से होकर बहता है और checkpointing के माध्यम से persist होता है।
यह सबसे explicit और controllable framework है - आप हर step को खुद wire करते हैं।
मुख्य अवधारणाएं
- StateGraph: typed state के साथ graph definition
- Nodes: Python functions जो state को transform करती हैं
- Edges: nodes के बीच connections, conditional हो सकती हैं
- Checkpointing: long-running workflows के लिए built-in persistence
Code Example
from langgraph.graph import StateGraph, MessagesState, START, END from langchain_openai import ChatOpenAI llm = ChatOpenAI(model="gpt-4o") def call_agent(state: MessagesState): response = llm.invoke(state["messages"]) return {"messages": [response]} def should_continue(state: MessagesState): last = state["messages"][-1] if last.tool_calls: return "tools" return END def call_tools(state: MessagesState): # Execute tool calls and return results results = [] for tool_call in state["messages"][-1].tool_calls: result = execute_tool(tool_call) results.append(result) return {"messages": results} graph = StateGraph(MessagesState) graph.add_node("agent", call_agent) graph.add_node("tools", call_tools) graph.add_edge(START, "agent") graph.add_conditional_edges("agent", should_continue, {"tools": "tools", END: END}) graph.add_edge("tools", "agent") app = graph.compile() result = app.invoke({"messages": [{"role": "user", "content": "What's the weather?"}]})
ताकतें
- हर step और transition पर बारीक नियंत्रण
- Built-in checkpointing और human-in-the-loop
- पूर्ण TypeScript parity
- किसी भी LLM provider के साथ काम करता है
- Conditional branching और loops वाली complex workflows के लिए सबसे अच्छा
कमज़ोरियां
- सीखने का curve तेज है - आपको graph theory concepts समझने होंगे
- साधारण use cases के लिए verbose - एक basic agent को अन्य frameworks की तुलना में अधिक boilerplate चाहिए
- LangSmith के बिना graph flows को debug करना चुनौतीपूर्ण हो सकता है
मूल्य निर्धारण
Open-source (MIT)। LangSmith (managed observability platform) में production monitoring के लिए paid tiers हैं।
CrewAI: The Team Assembler
CrewAI एक मानवीय रूपक का उपयोग करता है: आप विशेष agents की एक crew बनाते हैं, जिनमें से प्रत्येक की एक role, goal, और backstory होती है। Agents tools का उपयोग करके tasks पर collaborate करते हैं, जिन्हें एक process (sequential, hierarchical, या consensual) द्वारा coordinate किया जाता है।
इसे एक team hire करने जैसा समझें जहां हर सदस्य का एक specific job title और specialty है।
मुख्य अवधारणाएं
- Agent: role, goal, backstory, और tools के साथ एक persona
- Task: description, expected output, और assigned agent के साथ एक assignment
- Crew: साथ मिलकर काम करने वाले agents का समूह
- Process: execution strategy (sequential, hierarchical, consensual)
- Flow: कई crews को जोड़ने के लिए event-driven orchestration layer
Code Example
from crewai import Agent, Task, Crew, Process researcher = Agent( role="Senior Research Analyst", goal="Find comprehensive data about the given topic", backstory="You have 10 years of experience in technology research. " "You are thorough and always verify facts from multiple sources.", tools=[web_search_tool], verbose=True, ) writer = Agent( role="Technical Writer", goal="Create clear, engaging technical content", backstory="You write for a developer audience. " "Your articles are practical and include code examples.", tools=[file_tool], verbose=True, ) research_task = Task( description="Research the latest developments in WebAssembly in 2026. " "Focus on WASI, Component Model, and production use cases.", expected_output="A structured research document with key findings and sources.", agent=researcher, ) writing_task = Task( description="Write a blog post based on the research. " "Include code examples and Mermaid diagrams.", expected_output="A complete blog post in Markdown format.", agent=writer, context=[research_task], # Writer receives researcher's output ) crew = Crew( agents=[researcher, writer], tasks=[research_task, writing_task], process=Process.sequential, verbose=True, ) result = crew.kickoff() print(result.raw)
ताकतें
- सहज role-based abstraction - समझने में आसान
- 100+ built-in tool integrations
- Agents के बीच shared memory (short-term, long-term, entity)
- सबसे बड़ा community (~40k GitHub stars)
- एक "manager" agent के साथ hierarchical process जो delegate और validate करता है
कमज़ोरियां
- LangGraph की तुलना में कम बारीक नियंत्रण - आप roles define करते हैं, exact execution paths नहीं
- Hierarchical process अप्रत्याशित हो सकता है जब agents असहमत हों
- Multi-agent conversations को debug करना single-agent flows से कठिन है
मूल्य निर्धारण
Open-source core (free)। CrewAI Platform: $99/month (Teams) से $120k/year (Enterprise)। मूल्य live crews और monthly executions पर आधारित।
OpenAI Agents SDK: The Router
OpenAI Agents SDK (Swarm का spiritual successor) handoffs पर केंद्रित है - agents conversations को अन्य specialized agents को transfer करते हैं। यह सबसे minimal framework है: agents, tools, handoffs, और guardrails। बस इतना।
मुख्य अवधारणाएं
- Agent: model + instructions + tools + handoffs
- Handoff: दूसरे agent को transfer (LLM द्वारा call किए जाने वाले tool के रूप में modeled)
- Guardrail: agent के साथ parallel में चलने वाला input/output validation
- Runner: agent loop को execute करता है
- Tracing: सभी LLM calls, tool invocations, और handoffs के लिए built-in observability
Code Example
from agents import Agent, Runner, handoff, InputGuardrail, GuardrailFunctionOutput from pydantic import BaseModel class SafetyCheck(BaseModel): is_safe: bool reason: str async def content_safety(ctx, agent, input_text): result = await Runner.run( Agent(name="Safety", instructions="Check if input is safe. No PII."), input_text, context=ctx, ) output = SafetyCheck.model_validate_json(result.final_output) return GuardrailFunctionOutput( output_info=output, tripwire_triggered=not output.is_safe ) billing_agent = Agent( name="Billing Agent", instructions="You handle billing inquiries. Be precise with numbers.", tools=[lookup_invoice, process_payment], ) refund_agent = Agent( name="Refund Agent", instructions="You process refund requests. Always verify the order first.", tools=[lookup_order, issue_refund], ) triage_agent = Agent( name="Triage Agent", instructions="Route the customer to the right specialist. " "Ask clarifying questions if needed.", handoffs=[billing_agent, refund_agent], input_guardrails=[InputGuardrail(guardrail_function=content_safety)], ) result = await Runner.run(triage_agent, "I need a refund for order #4521") print(result.final_output) # The triage agent routes to refund_agent, which processes the refund
ताकतें
- Clean handoff pattern - routing/triage workflows के लिए स्वाभाविक
- Guardrails execution के साथ parallel में चलती हैं (fail-fast, blocking नहीं)
- Debugging के लिए built-in tracing dashboard
- नाम के बावजूद, non-OpenAI models को support करता है
- Minimal abstraction - समझने और extend करने में आसान
कमज़ोरियां
- LangGraph की तुलना में कम mature state management
- कोई built-in persistence या checkpointing नहीं
- Third-party tools का ecosystem छोटा है
- Handoff-centric design हर architecture के लिए उपयुक्त नहीं हो सकता
मूल्य निर्धारण
Open-source (MIT)। आप जो भी model use करें उसके लिए per-token भुगतान करें।
Claude Agent SDK: The Developer
Claude Agent SDK एक अलग दृष्टिकोण अपनाता है: workflows या roles define करने के बजाय, आप agent को tools का एक set देते हैं और उसे यह पता लगाने देते हैं कि task कैसे पूरा करना है। यह वही autonomous loop उपयोग करता है जो Claude Code को power करता है - read, act, verify, iterate।
मुख्य अवधारणाएं
- query(): agent loop शुरू करने का main entry point
- Built-in tools: Read, Write, Edit, Bash, Glob, Grep, WebSearch, WebFetch
- MCP के माध्यम से custom tools: in-process MCP servers के रूप में tools define करें
- Sub-agents: specialized agents जिन्हें parent delegate कर सकता है
- Sessions: कई interactions में context बनाए रखें
Code Example
import { tool, createSdkMcpServer, query } from "@anthropic-ai/claude-agent-sdk"; import { z } from "zod"; const searchDocs = tool( "search_docs", "Search the internal documentation for relevant information", { query: z.string().describe("Search query") }, async ({ query }) => { const results = await vectorStore.similaritySearch(query, 5); return { content: [{ type: "text", text: results.map(r => r.pageContent).join("\n\n") }], }; } ); const docsServer = createSdkMcpServer({ name: "docs", version: "1.0.0", tools: [searchDocs], }); for await (const message of query({ prompt: "Find how authentication works in our system and write a summary", options: { mcpServers: { docs: docsServer }, allowedTools: ["Read", "Glob", "Grep", "mcp__docs__search_docs"], }, })) { if (message.type === "result" && message.subtype === "success") { console.log(message.result); } }
ताकतें
- First-class MCP integration - किसी भी MCP server ecosystem से जुड़ें
- File operations, terminal, और web access के लिए built-in tools
- बड़े codebases के लिए automatic context compaction
- Complex tasks के लिए sub-agent parallelism
- Claude Code जैसा ही engine - असली development workflows पर battle-tested
कमज़ोरियां
- केवल Claude models - कोई multi-provider support नहीं
- छोटे community के साथ नया framework
- Python SDK के लिए भी Node.js runtime आवश्यक
- LangGraph की तुलना में कम explicit workflow control
मूल्य निर्धारण
Open-source। Standard Claude API token rates। Managed Agents (hosted version): token costs के अलावा $0.08 per session-hour।
कब किसे चुनें
LangGraph चुनें अगर:
- आपको workflow के हर step पर सटीक नियंत्रण चाहिए
- आपके use case में complex conditional logic और loops शामिल हैं
- आपको built-in persistence और human-in-the-loop checkpoints चाहिए
- आपको एक ही workflow में कई LLM providers use करने हैं
CrewAI चुनें अगर:
- आप एक सहज, role-based abstraction चाहते हैं
- आपके task में अलग-अलग specialties वाले कई agents शामिल हैं
- आपको agents को collaborate करने और एक-दूसरे को context pass करने की ज़रूरत है
- आप सबसे बड़ा community और सबसे अधिक built-in integrations चाहते हैं
OpenAI Agents SDK चुनें अगर:
- आपका प्राथमिक pattern conversations को specialists तक route करना है
- आपको guardrails चाहिए जो input/output को parallel में validate करें
- आप सबसे सरल possible abstraction चाहते हैं न्यूनतम boilerplate के साथ
- Built-in tracing और observability महत्वपूर्ण हैं
Claude Agent SDK चुनें अगर:
- आपके agents को code read, write, और execute करना है
- आप first-class MCP server integration चाहते हैं
- आपको autonomous agents चाहिए जो iterate और self-correct करें
- आप पहले से Claude use कर रहे हैं और सबसे गहरा integration चाहते हैं
क्या आप Frameworks को Combine कर सकते हैं?
हां। एक सामान्य pattern है orchestration के लिए एक framework और individual agents के लिए दूसरा:
- LangGraph overall workflow graph के लिए
- CrewAI एक specific node के लिए जिसमें multi-agent collaboration चाहिए
- Claude Agent SDK MCP के माध्यम से coding-related sub-tasks के लिए
- OpenAI Agents SDK customer-facing triage और routing के लिए
ये frameworks परस्पर अनन्य नहीं हैं। अपने system के हर हिस्से के लिए जो fit करे वो इस्तेमाल करें।
निष्कर्ष
हर framework एक स्पष्ट दांव लगाता है:
- LangGraph control के लिए optimize करता है - आप हर transition तय करते हैं
- CrewAI collaboration के लिए optimize करता है - agents एक team के रूप में काम करते हैं
- OpenAI Agents SDK simplicity के लिए optimize करता है - minimal abstraction, clean handoffs
- Claude Agent SDK autonomy के लिए optimize करता है - tools दो और काम करने दो
सही चुनाव आपके workflow, आपकी team, और आपके मौजूदा stack पर निर्भर करता है। वो चुनें जो आपके primary use case से मेल खाता हो, उसे अच्छी तरह सीखें, और जब उनके sweet spot पर पहुंचें तो दूसरों को शामिल करें।