Documentation Index
Fetch the complete documentation index at: https://mintlify.com/microsoft/autogen/llms.txt
Use this file to discover all available pages before exploring further.
Quickstart
This guide will get you up and running with AutoGen in under 5 minutes. You’ll create a simple agent that can use tools to answer questions.Prerequisites
Before you begin, ensure you have:- Python 3.10 or later installed
- An OpenAI API key (or another supported LLM provider)
Don’t have an OpenAI API key? Get one at platform.openai.com. You can also use other providers like Azure OpenAI, Anthropic, or local models.
Installation
Install AutoGen packages
Install both AgentChat and the OpenAI extension:This installs:
autogen-agentchat: High-level API for building agentsautogen-ext[openai]: OpenAI model client extension
Hello World: Your First Agent
Let’s create a simple assistant agent that responds to a task.The agent uses OpenAI’s GPT-4o model by default. You can change this to
gpt-4o-mini for faster/cheaper responses or gpt-4 for maximum quality.Adding Tools to Your Agent
Now let’s make it more interesting by giving the agent access to a tool. We’ll create a weather agent that can look up weather information.AutoGen automatically:
- Converts your Python function into a tool schema
- Passes it to the LLM via function calling
- Executes the function when the model requests it
- Returns results back to the model for final response generation
Understanding the Code
Let’s break down the key components:Model Client
OpenAIChatCompletionClientfor OpenAIAzureOpenAIChatCompletionClientfor Azure OpenAIAnthropicClientfor Claude- And more…
Assistant Agent
AssistantAgent is a pre-configured agent type that:
- Uses an LLM to process messages
- Can call tools when needed
- Reflects on tool results when
reflect_on_tool_use=True - Follows instructions in the
system_message
Running the Agent
run() method executes the agent and returns a TaskResult with:
- All messages exchanged
- The final stop reason
- Usage statistics
run_stream() with the Console helper:
Next Steps
Congratulations! You’ve created your first AutoGen agent. Here’s what to explore next:Core Concepts
Understand agents, teams, tools, and the architecture
Multi-Agent Teams
Create teams of agents that collaborate on complex tasks
Advanced Tools
Integrate MCP servers, code execution, and custom tools
Example Gallery
Browse complete examples and use cases
Common Next Tasks
Use a Different Model Provider
Switch to Azure OpenAI:Add Multiple Tools
Agents can use multiple tools:Create a Multi-Agent Team
Combine multiple agents:Teams are covered in detail in the AgentChat documentation.
Troubleshooting
Module not found errors
Module not found errors
Make sure you installed both packages:If using a virtual environment, ensure it’s activated.
API key errors
API key errors
Verify your API key is set correctly:Or pass it explicitly:
Async/await issues
Async/await issues
AutoGen uses async/await throughout. If running in a Jupyter notebook, you can use In a Python script, wrap in
await directly:asyncio.run():Rate limit errors
Rate limit errors
If you hit rate limits:
- Use a smaller/cheaper model like
gpt-4o-mini - Add delays between requests
- Check your OpenAI usage limits
Getting Help
If you run into issues:- Check the Installation guide for detailed setup instructions
- Browse Examples for more code samples
- Ask questions on GitHub Discussions
- Join the Discord community
Ready to learn more? Continue to Core Concepts to understand how AutoGen works under the hood.