AI agents اب research demos سے production systems میں منتقل ہو چکے ہیں۔ 2026 تک 60% سے زیادہ enterprise AI applications میں agentic components شامل ہونے کی توقع ہے۔ لیکن agents کو scratch سے بنانا - tool loops، state، memory، error handling، اور multi-agent coordination کا انتظام - پیچیدہ ہے۔ یہاں 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 کرنے جیسا سمجھیں جہاں ہر رکن کا ایک مخصوص 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 نہیں
- جب agents متفق نہ ہوں تو hierarchical process غیر متوقع ہو سکتا ہے
- 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 جو tool call کر سکتا ہے اس طرح 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 استعمال کریں اس کے لیے 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: خصوصی 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 استعمال کرنے ہیں
CrewAI چنیں اگر:
- آپ ایک بدیہی، role-based abstraction چاہتے ہیں
- آپ کے task میں مختلف specialties والے متعدد agents شامل ہیں
- آپ کو agents کو collaborate کرنے اور ایک دوسرے کو context pass کرنے کی ضرورت ہے
- آپ سب سے بڑی community اور سب سے زیادہ built-in integrations چاہتے ہیں
OpenAI Agents SDK چنیں اگر:
- آپ کا بنیادی pattern conversations کو specialists تک route کرنا ہے
- آپ کو guardrails چاہیے جو parallel میں input/output validate کریں
- آپ کم سے کم boilerplate کے ساتھ سب سے سادہ abstraction چاہتے ہیں
- Built-in tracing اور observability اہم ہیں
Claude Agent SDK چنیں اگر:
- آپ کے agents کو code read، write، اور execute کرنا ہے
- آپ first-class MCP server integration چاہتے ہیں
- آپ کو autonomous agents چاہیے جو iterate اور self-correct کریں
- آپ پہلے سے Claude استعمال کر رہے ہیں اور گہرا ترین integration چاہتے ہیں
کیا آپ Frameworks کو Combine کر سکتے ہیں؟
ہاں۔ ایک عام pattern یہ ہے کہ orchestration کے لیے ایک framework اور individual agents کے لیے دوسرا:
- LangGraph مجموعی workflow graph کے لیے
- CrewAI ایک مخصوص node کے لیے جس میں multi-agent collaboration چاہیے
- Claude Agent SDK MCP کے ذریعے coding-related sub-tasks کے لیے
- OpenAI Agents SDK customer-facing triage اور routing کے لیے
یہ frameworks باہمی طور پر خارج نہیں ہیں۔ اپنے system کے ہر حصے کے لیے جو موزوں ہو وہ استعمال کریں۔
نتیجہ
ہر 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 پر پہنچیں تو دوسروں کو شامل کریں۔