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.
pip install -U "autogen-agentchat" "autogen-ext[openai]"Verified import paths — ran on the pinned version, not inferred.
Single AssistantAgent with OpenAI — v0.4+ API
Follow the official migration guide: https://microsoft.github.io/autogen/stable/user-guide/agentchat-user-guide/migration-guide.html
Always use asyncio.run(main()) at the entry point. Use await for all agent calls.
pip install 'autogen-ext[openai]' for OpenAI/OpenAI-compatible models. Use 'autogen-ext[azure]' for Azure OpenAI, 'autogen-ext[anthropic]' for Claude.
Install via autogen-agentchat (for v0.4+) or autogen-agentchat~=0.2 (for legacy v0.2). Never use pyautogen.
For Microsoft AutoGen 0.4+, install autogen-agentchat and autogen-ext. For AG2/legacy API, install ag2 or pin autogen-agentchat~=0.2.
Always verify against the official docs at https://microsoft.github.io/autogen/stable/
Use try/finally or async context managers: async with OpenAIChatCompletionClient(...) as client: ...
Ensure that necessary build tools are installed in your environment. For Alpine Linux, this typically means running `apk add build-base` before installing Python packages. Example Dockerfile: `FROM python:3.13-alpine RUN apk add build-base RUN pip install autogen-agentchat 'autogen-ext[openai]'`