## What Is AutoGen?
AutoGen is Microsoft's framework for building multi-agent systems where AI agents converse with each other and humans to solve complex tasks.
### Core Concepts
- ConversableAgent: Base agent that can send and receive messages
- AssistantAgent: AI-powered agent with LLM capabilities
- UserProxyAgent: Represents a human user, can execute code
- GroupChat: Multi-agent conversation with turn management
### Installation
```bash pip install autogen-agentchat ```
### Two-Agent Chat
```python from autogen import AssistantAgent, UserProxyAgent
assistant = AssistantAgent( name="assistant", llm_config={"model": "gpt-4o", "api_key": os.environ["OPENAI_API_KEY"]}, )
user_proxy = UserProxyAgent( name="user", human_input_mode="NEVER", # Automated code_execution_config={"work_dir": "output", "use_docker": False}, )
user_proxy.initiate_chat( assistant, message="Create a bar chart of the top 5 programming languages by popularity.", ) ```
### How It Works
- User proxy sends the initial message
- Assistant generates a response (possibly with code)
- User proxy executes any code and returns the result
- Assistant refines based on execution output
- Loop continues until task is complete or max rounds reached