{"id":"autogen-agentchat","title":"AutoGen (Microsoft)","library":"autogen-agentchat","description":"Microsoft's framework for building multi-agent AI applications. As of v0.4+, AutoGen is a layered system: autogen-core (event-driven actor runtime), autogen-agentchat (high-level conversational agents), and autogen-ext (extensions for OpenAI, Azure, MCP, etc.). Completely async. The 0.2 API is a separate, deprecated architecture. NOT the same as AG2.","status":"active","version":"0.7.5","install":[{"cmd":"pip install -U \"autogen-agentchat\" \"autogen-ext[openai]\"","lang":"bash","label":"AgentChat + OpenAI extension (recommended starting point)"},{"cmd":"pip install -U autogen-core","lang":"bash","label":"Core runtime only (event-driven actor model)"},{"cmd":"pip install -U autogenstudio","lang":"bash","label":"AutoGen Studio (no-code UI, separate package)"}],"dependencies":[{"package":"autogen-ext[openai]","reason":"OpenAIChatCompletionClient lives in autogen-ext, not autogen-agentchat. Required for any OpenAI or OpenAI-compatible model use.","optional":false},{"package":"Python >=3.10","reason":"Hard requirement across all autogen packages.","optional":false}],"imports":[{"symbol":"AssistantAgent (v0.4+)","correct":"from autogen_agentchat.agents import AssistantAgent\nfrom autogen_ext.models.openai import OpenAIChatCompletionClient","wrong":"from autogen.agentchat import AssistantAgent\nfrom autogen.oai import OpenAIWrapper","note":"The v0.2 import paths (autogen.agentchat, autogen.oai) are completely different from v0.4+. Mixing them causes immediate ImportError or silent wrong behavior."},{"symbol":"RoutedAgent (Core API)","correct":"from autogen_core import RoutedAgent, message_handler","wrong":"from autogen_core.components import RoutedAgent","note":"RoutedAgent is in autogen_core directly, not autogen_core.components. LLM-generated code frequently gets this wrong."}],"quickstart":{"code":"import asyncio\nfrom autogen_agentchat.agents import AssistantAgent\nfrom autogen_ext.models.openai import OpenAIChatCompletionClient\n\nasync def main() -> None:\n    model_client = OpenAIChatCompletionClient(model='gpt-4o')\n    agent = AssistantAgent('assistant', model_client=model_client)\n    result = await agent.run(task='Say Hello World!')\n    print(result)\n    await model_client.close()\n\nasyncio.run(main())","lang":"python","description":"Single AssistantAgent with OpenAI — v0.4+ API"},"warnings":[{"severity":"breaking","message":"AutoGen v0.4+ is a complete ground-up rewrite with a fully incompatible API from v0.2. All v0.2 imports (from autogen.agentchat, autogen.oai, AssistantAgent with llm_config dict, UserProxyAgent) are broken in v0.4.","affected_versions":">=0.4.0","fix":"Follow the official migration guide: https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/migration-guide.html"},{"severity":"breaking","message":"All v0.4+ AutoGen APIs are fully async. Calling agent.run() without await in an async context, or calling it in a sync context without asyncio.run(), will fail or produce no output.","affected_versions":">=0.4.0","fix":"Always use asyncio.run(main()) at the entry point. Use await for all agent calls."},{"severity":"breaking","message":"OpenAIChatCompletionClient is in autogen-ext, not autogen-agentchat. pip install autogen-agentchat alone is insufficient — model clients require autogen-ext[openai] or the relevant provider extra.","affected_versions":">=0.4.0","fix":"pip install 'autogen-ext[openai]' for OpenAI/OpenAI-compatible models. Use 'autogen-ext[azure]' for Azure OpenAI, 'autogen-ext[anthropic]' for Claude."},{"severity":"breaking","message":"pyautogen on PyPI is no longer maintained by Microsoft as of v0.2.34+. Control of that package was lost to an AG2-affiliated fork. Do not use pyautogen for Microsoft AutoGen.","affected_versions":"all","fix":"Install via autogen-agentchat (for v0.4+) or autogen-agentchat~=0.2 (for legacy v0.2). Never use pyautogen."},{"severity":"gotcha","message":"AG2 (pip install ag2 or pip install autogen) is a community fork of AutoGen 0.2, NOT Microsoft's AutoGen 0.4. The autogen PyPI package is currently controlled by the AG2 project. Code written for AG2 and code written for Microsoft AutoGen 0.4 are NOT compatible.","affected_versions":"all","fix":"For Microsoft AutoGen 0.4+, install autogen-agentchat and autogen-ext. For AG2/legacy API, install ag2 or pin autogen-agentchat~=0.2."},{"severity":"gotcha","message":"LLM-generated AutoGen code is highly unreliable. Most AI assistants (as of early 2026) mix v0.2 and v0.4 imports, use wrong module paths (autogen_core.components vs autogen_core), or use synchronous patterns on async-only APIs.","affected_versions":">=0.4.0","fix":"Always verify against the official docs at https://microsoft.github.io/autogen/stable/"},{"severity":"gotcha","message":"model_client.close() must be explicitly called after use to avoid resource leaks. The client does not auto-close.","affected_versions":">=0.4.0","fix":"Use try/finally or async context managers: async with OpenAIChatCompletionClient(...) as client: ..."}],"last_verified":"2026-02-28","next_check":"2026-05-28","source_url":"https://microsoft.github.io/autogen/stable/","language":"en","source_language":"en","tags":["agents","orchestration","multi-agent","autogen","microsoft","async","event-driven","python"]}