█

AI/TLDR

मुझे पिलाएं कॉफ़ी
मुझे एक कॉफ़ी पिलाएँ

AutoGen क्या है? Microsoft के कन्वर्सेशन-आधारित एजेंट

AutoGen का मूल विचार समझें: ऐसे एजेंट जो एक-दूसरे से बात करके समस्याएँ हल करते हैं, और कब बातचीत-आधारित तरीका कठोर orchestration से बेहतर होता है।

शुरुआती12 मिनट पढ़ेंअपडेट 12 जून 2026

सरल भाषा में

AutoGen एक Microsoft Research का ओपन सोर्स फ्रेमवर्क है, जो एक देखने में सरल लगने वाले विचार पर बना है: AI एजेंट्स से कठिन समस्याएँ हल करवाने का सबसे अच्छा तरीका यह है कि उन्हें एक-दूसरे से बात करने दिया जाए। कदमों का तय flowchart बनाने के बजाय, आप एजेंट्स का एक समूह बनाते हैं, जिनमें से हर एक की अपनी भूमिका और कुछ स्किल्स होते हैं, और कार्य पूरा होने तक उन्हें आपस में बातचीत करने देते हैं।

AutoGen — आरेख
AutoGen — microsoft.com

एक ठोस उदाहरण लेते हैं: मान लीजिए किसी छोटे Slack चैनल में एक coding problem भेजी गई। एक व्यक्ति solution लिखता है, दूसरा उसकी समीक्षा करके एक bug पकड़ता है, पहला व्यक्ति सुधार करके संशोधित version पोस्ट करता है, और तीसरा व्यक्ति tests चलाकर पुष्टि करता है कि वह पास होता है। किसी project manager को हर कदम समझाने की ज़रूरत नहीं पड़ी — बातचीत ही workflow थी। AutoGen ठीक यही dynamic बनाता है, पर चैनल के participants LLM-संचालित एजेंट होते हैं और 'tests चलाना' वाला कदम sandboxed Python process के अंदर असली code execution होता है।

यह framework 2023 के एक Microsoft Research paper में पेश किया गया था, AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation, और तब से इसका एक बड़ा rewrite हो चुका है (v0.4, फिर फ़रवरी 2026 में 1.0 GA), जिसने इसके architecture को synchronous exchanges से पूरी तरह asynchronous, event-driven messaging layer की ओर ले जाया। High-level conversation API, जिसे AgentChat कहा जाता है, ज़्यादातर builders के लिए अब भी प्रवेश का मुख्य बिंदु है।

यह क्यों मायने रखता है

ज़्यादातर वे समस्याएँ जो 'किसी expert human team के लिए आसान' लगती हैं, एक अकेले LLM call के लिए आश्चर्यजनक रूप से कठिन होती हैं। कोड लिखना, जाँचना और उसे ठीक करना कम से कम तीन अलग-अलग मानसिक चरणों से जुड़ा है: generation, critique और verification। इन तीनों को एक ही prompt में ठूँसने से ऐसा model बनता है जिसे भीतर ही भीतर context बदलना पड़ता है, और अक्सर वह critique वाला कदम पूरी तरह छोड़ देता है।

AutoGen का conversation model इसे एजेंट्स में ज़िम्मेदारियाँ बाँटकर हल करता है। एक AssistantAgent कोड लिखता है; एक UserProxyAgent (या एक समर्पित executor agent) उसे असल में चलाता है और stdout/stderr लौटाता है; assistant आउटपुट पढ़कर दोहराता है। हर एजेंट को केवल अपना काम अच्छी तरह करना होता है, और बातचीत का इतिहास साझा working memory का काम करता है। नतीजतन AutoGen के एजेंट अपने ही डाले bugs पकड़ते हैं, खुद को सुधारते हैं, और single-shot prompt की तुलना में कहीं ज़्यादा दर पर काम करने वाला कोड बनाते हैं।

कोडिंग के अलावा, यह conversation model वहाँ भी लागू होता है जहाँ critique से गुणवत्ता सुधरती है: data analysis pipelines, research का सारांश, reviewer के साथ content generation, और multi-step tool use जहाँ एक एजेंट का output दूसरे एजेंट का input बन जाता है। मूल paper के अनुभवजन्य अध्ययनों ने mathematics, operations research, online decision-making और software engineering benchmarks में मज़बूत परिणाम दिखाए।

AutoGen को अन्य विकल्पों के बजाय कब चुनें

स्थितिउपयुक्त है?
ऐसे एजेंट जो कोड बार-बार बनाते और चलाते हैंहाँ — पहली श्रेणी का built-in समर्थन
समूह में गतिशील, LLM-निर्देशित turn orderहाँ — LLM speaker selection के साथ GroupChat
तय, deterministic pipelines जिनमें state पर सटीक नियंत्रण होLangGraph के लिए बेहतर विकल्प
manager/crew जैसे भाव वाली भूमिका-आधारित task delegationCrewAI के लिए बेहतर विकल्प
Research prototyping और academic experimentsहाँ — सक्रिय research community

यह कैसे काम करता है

AutoGen का AgentChat API तीन परतों पर बना है। Core परत एक निम्न-स्तरीय actor framework है: हर एजेंट एक async actor है जो messages प्राप्त करता है, काम करता है और messages emit करता है। AgentChat परत Core को उच्च-स्तरीय primitives से लपेटती है, जैसे AssistantAgent, UserProxyAgent, GroupChat और termination conditions, जो actor internals को छुए बिना 90% use cases को कवर कर लेते हैं। तीसरी परत AutoGen Studio है, जो prototyping टीमों के लिए no-code GUI देती है।

दो मूल एजेंट प्रकार

classic AutoGen में (और AgentChat 1.0 में अब भी) दो मुख्य हिस्से हैं। एक AssistantAgent एक LLM को लपेटता है: वह बातचीत का इतिहास पढ़ता है, सोचता है और जवाब देता है, या तो सामान्य भाषा में या code block के रूप में। एक UserProxyAgent किसी इंसान (या स्वचालित feedback) के लिए proxy का काम करता है: जब उसे message में code block मिलता है, तो वह उस code को चलाता है और आउटपुट अपने अगले जवाब के रूप में भेज देता है। जब तक कोई stopping condition पूरी नहीं होती, बातचीत अपने आप चक्र में चलती रहती है।

Group chat और speaker selection

दो से अधिक एजेंट वाले कार्यों के लिए AutoGen GroupChat (v0.2 शैली) या AgentChat के team primitives (RoundRobinGroupChat, SelectorGroupChat) देता है। GroupChatManager या SelectorGroupChat बातचीत को orchestrate करता है: हर turn के बाद या तो वह एजेंट्स को round-robin क्रम में घुमाता है, या LLM को role-play prompt के साथ बुलाकर अब तक की बातचीत को देखते हुए सबसे उपयुक्त अगला speaker चुनवाता है। सभी एजेंट्स एक ही conversation context साझा करते हैं, इसलिए हर participant देख सकता है कि बाकी हर participant ने क्या कहा।

Termination conditions

किसी भी multi-agent loop में एक अहम डिज़ाइन सवाल है: हम कब रुकें? AutoGen composable termination conditions देता है, जिन्हें | (OR) या & (AND) से जोड़ा जा सकता है: MaxMessageTermination N संदेशों के बाद रुकता है, TextMentionTermination तब रुकता है जब कोई एजेंट "TERMINATE" जैसा कोई खास string बोले, TokenUsageTermination token budget पर रुकता है, और HandoffTermination तब रुकता है जब कोई एजेंट किसी इंसान को handoff करे। इससे एक safety ceiling तय करना आसान हो जाता है, और एजेंट्स को यह अधिकार भी रहता है कि जब वे मानें कि कार्य पूरा हो गया है तो वे खुद रुक जाएँ।

न्यूनतम दो-एजेंट coding लूप (AgentChat 1.0 API)python
import asyncio
from autogen_agentchat.agents import AssistantAgent, CodeExecutorAgent
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.conditions import TextMentionTermination
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_ext.code_executors.local import LocalCommandLineCodeExecutor

async def main():
    model_client = OpenAIChatCompletionClient(model="gpt-5.5")
    executor = LocalCommandLineCodeExecutor(work_dir="/tmp/coding")

    assistant = AssistantAgent(
        name="assistant",
        model_client=model_client,
        system_message="Write Python code to solve tasks. Say TERMINATE when done.",
    )
    code_runner = CodeExecutorAgent(
        name="code_runner",
        code_executor=executor,
    )

    team = RoundRobinGroupChat(
        participants=[assistant, code_runner],
        termination_condition=TextMentionTermination("TERMINATE"),
    )

    result = await team.run(task="Write a script that prints the first 10 Fibonacci numbers.")
    print(result.messages[-1].content)

asyncio.run(main())

गतिशील speaker selection वाले group chats

SelectorGroupChat pattern ही AutoGen को सरल pipeline से वास्तव में अलग बनाता है। तय क्रम के बजाय selector (जो खुद एक LLM call है) अब तक की बातचीत पढ़कर तय करता है कि अगला कौन सा एजेंट बोले। इसका मतलब है कि अगर Researcher एजेंट को समझ आए कि उसे और डेटा चाहिए, तो बातचीत स्वाभाविक रूप से उसी की ओर लौट सकती है, बजाय आँख मूँदकर Writer की ओर आगे बढ़ने के।

यहाँ SelectorGroupChat के साथ जुड़ी एक विशिष्ट तीन-एजेंट research team दी गई है। selector_prompt एक role-play prompt है जो आप देते हैं: यह बताता है कि हर एजेंट किसमें अच्छा है और LLM से सबसे अच्छा अगला speaker चुनने को कहता है। अगर आप चाहें कि कोई एजेंट जब उचित लगे तो लगातार कई turns ले, तो आप allow_repeated_speaker=True भी दे सकते हैं।

तीन-एजेंट selector group chatpython
from autogen_agentchat.teams import SelectorGroupChat
from autogen_agentchat.conditions import MaxMessageTermination

researcher = AssistantAgent(
    name="Researcher",
    model_client=model_client,
    system_message="You search the web and gather facts. Return findings as bullet points.",
)
writer = AssistantAgent(
    name="Writer",
    model_client=model_client,
    system_message="You synthesize research into a concise report. Write in plain English.",
)
critic = AssistantAgent(
    name="Critic",
    model_client=model_client,
    system_message="You review drafts for factual errors and clarity. Say TERMINATE when satisfied.",
)

team = SelectorGroupChat(
    participants=[researcher, writer, critic],
    model_client=model_client,           # LLM that picks the next speaker
    termination_condition=MaxMessageTermination(20),
)

result = await team.run(task="Summarise the key papers on multi-agent LLM systems from 2023-2025.")

Group chat pattern उन open-ended कार्यों में सबसे अच्छा काम करता है जहाँ workflow को पहले से तय करना कठिन हो। इसकी कीमत है non-determinism: एक ही कार्य की दो runs अलग speaker क्रम अपना सकती हैं। अगर reproducibility बेहद ज़रूरी है, जैसे production billing pipeline में, तो RoundRobinGroupChat या LangGraph जैसा graph-आधारित framework आपको अधिक नियंत्रण देता है।

AutoGen बनाम CrewAI और LangGraph

तीनों frameworks multi-agent systems बनाने देते हैं, लेकिन वे अलग-अलग mental models से शुरू होते हैं। यह अंतर समझना अपने प्रोजेक्ट के लिए सही चुनाव करने का सबसे तेज़ तरीका है।

मोटा नियम: अगर आपका workflow emergent है (एजेंट्स काम शुरू करने तक आपको सटीक कदम पता नहीं होते), तो AutoGen का conversation model जीतता है। अगर आपका workflow पहले से तय है और आपको ऐसे deterministic state transitions चाहिए जिन्हें आप replay और audit कर सकें, तो LangGraph बेहतर विकल्प है। CrewAI बीच में बैठता है: यह पढ़ने में सहज रूप से संरचित है, और graph के बिना multi-step delegation संभालने के लिए पर्याप्त गतिशील भी है।

और गहराई में

Core API और async actors

AgentChat ज़्यादातर उपयोग-मामलों को कवर करता है, लेकिन AutoGen का Core API नीचे के async actor model तक सीधी पहुँच देता है। Core में हर एजेंट एक class है जो उसके समझे जाने वाले हर message type के लिए handle method लागू करती है। एजेंट्स एक AgentRuntime में चलते हैं: स्थानीय scripts के लिए SingleThreadedAgentRuntime, या cross-process या cross-language deployments के लिए distributed runtime। इसी तरह आप ऐसा एजेंट बना सकते हैं जो किसी inline team.run() call का इंतज़ार करने के बजाय एक Kafka topic को subscribe करे, मान लीजिए।

v0.4/1.0 architecture ने cross-language support पेश किया: एक Python एजेंट और एक .NET एजेंट distributed runtime के ज़रिए एक ही बातचीत में भाग ले सकते हैं। Message protocol language-agnostic है। enterprise परिवेश में यह उपयोगी है, जहाँ मौजूदा services अलग-अलग भाषाओं में लिखी हैं और आप उन्हें external processes को shell के ज़रिए चलाने के बजाय पहली श्रेणी के AutoGen एजेंट्स के रूप में लपेटना चाहते हैं।

Human-in-the-loop पैटर्न

AutoGen HandoffTermination को UserProxyAgent के साथ जोड़कर एजेंट run को रोकने और किसी असली इंसान तक सवाल पहुँचाने का समर्थन करता है। Team साफ़-सुथरे तरीके से रुक जाती है, calling code को HandoffMessage मिलता है, application उपयोगकर्ता से पूछता है, और उपयोगकर्ता का जवाब इतिहास में जोड़कर बातचीत फिर शुरू होती है। इससे ऐसे workflows बनाना संभव है जिनमें एजेंट जो कुछ भी खुद कर सकते हैं वह सब करते हैं, और अनिश्चितता आने पर सहजता से इंसान तक मामला पहुँचाते हैं।

Observability और AutoGen Studio

लंबी चलने वाली multi-agent बातचीत को debug करना कुख्यात रूप से कठिन है। AutoGen हर team run पर एक event stream देता है: आप async for event in team.run_stream(task=...) लिखकर हर एजेंट message, token count और tool call को real time में देख सकते हैं। AutoGen Studio (v0.4+) एक स्थानीय web UI देता है, जहाँ आप visually agent teams जोड़ सकते हैं, tools परिभाषित कर सकते हैं और conversation traces में step-by-step चल सकते हैं। कोड पर प्रतिबद्ध होने से पहले prototyping के लिए यह उपयोगी है।

Microsoft Agent Framework की ओर सफ़र

अक्टूबर 2025 में Microsoft ने Microsoft Agent Framework (public preview) लॉन्च किया, जो AutoGen के गतिशील conversation model को Semantic Kernel की enterprise सुविधाओं के साथ मिलाता है: session-आधारित state management, type safety, middleware और telemetry। नए production प्रोजेक्ट्स के लिए Microsoft Agent Framework की सलाह दी जाती है। AutoGen के packages (autogen-agentchat, autogen-core, autogen-ext) maintenance में बने रहेंगे, यानी bug fixes और security patches मिलेंगे, पर कोई नया feature नहीं। मौजूदा AutoGen कोड चलता रहता है; जब आप तैयार हों, तब Agent Framework में जाने के लिए migration guides उपलब्ध हैं।

अक्सर पूछे जाने वाले प्रश्न

AutoGen v0.2 और AutoGen 1.0 में क्या अंतर है?

v0.2 (मूल संस्करण, जो pyautogen के रूप में install होता था) एक synchronous, callback-आधारित architecture और एकल ConversableAgent class इस्तेमाल करता था। Version 1.0 (जो autogen-agentchat + autogen-core के रूप में install होता है) एक ground-up async rewrite है, जिसमें actor-आधारित runtime, streaming सपोर्ट, cross-language एजेंट्स और composable termination conditions हैं। दोनों के APIs संगत नहीं हैं, इसलिए v0.2 के कोड को migration की ज़रूरत पड़ेगी।

क्या AutoGen के लिए OpenAI ज़रूरी है? क्या इसे Claude या local models के साथ इस्तेमाल किया जा सकता है?

AutoGen model-agnostic है। autogen-ext package OpenAI, Azure OpenAI, Anthropic (Claude) और OpenAI-compatible endpoint वाले किसी भी provider के लिए clients देता है। दूसरे providers के लिए आप ChatCompletionClient interface भी लागू कर सकते हैं।

क्या production में code execution के लिए AutoGen सुरक्षित है?

AutoGen का LocalCommandLineCodeExecutor कोड को सीधे होस्ट मशीन पर चलाता है। यह स्थानीय प्रयोगों के लिए ठीक है, पर production में खतरनाक है। सुरक्षित deployments के लिए DockerCommandLineCodeExecutor (जो कोड को Docker container के अंदर चलाता है) या E2B जैसा cloud sandbox इस्तेमाल करें। जिस infrastructure की आपको परवाह है, उस पर एजेंट-जनित कोड चलाने से पहले उसे हमेशा sandbox में रखें।

AutoGen में 'GroupChat' का क्या मतलब है और speaker selection कैसे काम करता है?

GroupChat एक तीसरा एजेंट, यानी GroupChatManager या SelectorGroupChat, जोड़ता है, जो बातचीत के ऊपर बैठकर तय करता है कि अगला कौन बोलेगा। selector mode में manager हर एजेंट की विशेषता बताने वाले role-play prompt के साथ एक LLM को बुलाता है और सबसे उपयुक्त अगला speaker चुनता है। round-robin mode में वह बस एजेंट्स को क्रम से घुमाता है।

नए प्रोजेक्ट्स AutoGen से शुरू करने चाहिए या Microsoft Agent Framework से?

सीखने, prototyping और research के लिए AutoGen 1.0 (autogen-agentchat) अब भी एक बढ़िया शुरुआती बिंदु है। यह सरल है, इसका documentation उत्कृष्ट है, और यह सीधे academic papers से मेल खाता है। session persistence, telemetry और enterprise support चाहने वाले production systems के लिए Microsoft Agent Framework से शुरू करने की सलाह दी जाती है, जो उसी Core layer पर बना है।

multi-agent pipelines बनाने के लिए AutoGen, CrewAI से कैसे तुलना करता है?

AutoGen conversation-driven है: workflow संदेशों के आदान-प्रदान से उभरता है, जिसमें LLM द्वारा गतिशील speaker selection भी शामिल है। CrewAI role-driven है: आप एजेंट्स को job titles और स्पष्ट tasks के साथ परिभाषित करते हैं, और एक manager उन्हें क्रम से काम सौंपता है। open-ended कार्यों और iterative coding के लिए AutoGen अधिक लचीला है; जब workflow पहले से पता हो, तब CrewAI अधिक पठनीय है।

आगे पढ़ें