AI Personal Learning
and practical guidance
Ali-painted frog

AutoGen: A Multi-Intelligent Body Dialog Framework Developed by Microsoft

General Introduction

AutoGen is an open source framework developed by a team of Microsoft researchers focused on simplifying the building of large language model (LLM) applications through multi-intelligent body conversations. It allows developers to create AI agents that can talk to each other and collaborate to solve tasks. This approach not only improves the performance of LLMs, but also enhances the flexibility and utility of the system by integrating human input and tool usage.AutoGen supports everything from simple two-intelligent body conversations to complex multi-intelligent body group chats for workflows of all complexities.

Microsoft introduces AutoGen 0.4, a completely rewritten and non-backwards compatible version of AutoGen. The new AutoGen 0.4 version utilizes a layered, extensible, modular architecture and is an asynchronous, message-driven, extensible multi-agent framework for building advanced AI intelligent body systems.

AutoGen: A Multi-Intelligent Body Dialog Framework Developed by Microsoft for Building AI Applications for Complex Tasks-1

 

Function List

  • Multi-Intelligence Collaboration: Allows multiple AI agents to work together through dialog to solve complex tasks.
  • Customization and Extensibility: Developers can customize the behavior and conversation patterns of the intelligences on demand.
  • Support for human engagement: Intelligentsia can interact with human users and receive human feedback to optimize task execution.
  • tool integration: Intelligent bodies can use code or external tools directly to enhance task processing.
  • Diversified application scenarios: There are examples of applications in areas ranging from mathematical problem solving to programming and supply chain optimization.
  • performance optimization: Improving the efficiency of LLM through mechanisms such as multi-configuration reasoning and caching.

 


AutoGen-Core

AutoGen-Core is the core API of the AutoGen framework, based on the Actor model, supporting asynchronous messaging between intelligences and event-driven workflows. It provides the underlying infrastructure that allows developers to create highly flexible and scalable multi-intelligent body systems. Key features include:

  • asynchronous messaging: Intelligentsia communicate with each other via asynchronous messages to ensure efficient concurrent processing.
  • Event Driven Workflow: Supports event-based workflow management, enabling the system to respond to environmental changes and task demands.
  • high flexibility: Provides a high degree of control over the underlying components for deep customization and optimization by advanced users.

AutoGen-AgentChat

AutoGen-AgentChat is a high-level API, built on top of AutoGen-Core, that focuses on building multi-intelligent body dialog applications. It provides developers with a higher level of abstraction that simplifies the creation and management of multi-intelligent body systems. Key features include:

  • mission-driven: Allows defining conversational intelligences and teaming them to solve specific tasks.
  • predetermined behavior: Preset behaviors of intelligences and multi-intelligence design modes are provided for quick start.
  • user-friendly: Suitable for beginners, providing intuitive default settings and an easy-to-understand interface.

 

Using Help

Installation and Setup

To get started with AutoGen, it first needs to be installed via the Python package manager Pip:

pip install -U "autogen-agentchat" "autogen-ext[openai]"

You need an OpenAI API key to use some of the features, which can be set via environment variables:

export OPENAI_API_KEY='your-api-key-here'

Using AutoGen

Creating Basic Intelligence::

from autogen import AssistantAgent, UserProxyAgent
# Define an assistant agent
assistant = AssistantAgent("assistant",
llm_config={
"config_list": [{"model": "gpt-4", "api_key": os.environ["OPENAI_API_KEY"]}]
})
# Create a user proxy
user_proxy = UserProxyAgent("user_proxy",
code_execution_config={"work_dir": "coding", "use_docker": False})
# Starting a dialog
user_proxy.initiate_chat(assistant, message="Explain what AutoGen is?")

Building multi-intelligence systems::

AutoGen supports more complex multi-intelligence interactions, such as group chats:

from autogen import GroupChat, GroupChatManager
# Assuming you have defined multiple intelligences
group_chat = GroupChat(agents=[assistant, another_agent], messages=[], max_round=10)
manager = GroupChatManager(group_chat)
user_proxy.initiate_chat(manager, message="Teamwork to solve this programming problem:...")

Use of tools::

Intelligentsia can invoke tools such as executing code or performing web searches:

# Configuring the code execution environment
user_proxy = UserProxyAgent("user_proxy", code_execution_config={"work_dir": "coding", "use_docker": True})
# Getting an Intelligent Body to Execute Code
user_proxy.initiate_chat(assistant, message="Write and execute a simple Python script to print 'Hello, AutoGen!'")

Customizing Intelligent Body Behavior::

You can define specific behaviors of the intelligence, such as responding under specific conditions:

defcustom_handler(message): if "error" in message.get("content", "").
if "error" in message.get("content", "").lower():: return "Error detected...".
return "Error detected, trying again..."
returnNone
assistant.register_handler(custom_handler, event="on_message")

workflow

  • Starting a dialog: Byinitiate_chatMethods can start communication between intelligences or interaction between intelligences and users.
  • Monitoring and Modification: Intelligentsia can be added or modified during a conversation, or the rules of the conversation can be changed to suit the task.
  • Conclusion and results: At the end of the conversation, you can view the content generated or the results of the execution of the intelligences and analyze their performance and accuracy.

Using AutoGen requires some basic Python programming skills, but the documentation and examples are extensive to help novices get started quickly. With these steps and examples, you can start exploring the power of AutoGen for AI application development.

 

The ecosystem also supports two key developer tools:

AutoGen Studio Provides a code-free GUI for building multi-agent applications.

AutoGen Bench provides a benchmarking suite for evaluating agent performance.

CDN1
May not be reproduced without permission:Chief AI Sharing Circle " AutoGen: A Multi-Intelligent Body Dialog Framework Developed by Microsoft

Chief AI Sharing Circle

Chief AI Sharing Circle specializes in AI learning, providing comprehensive AI learning content, AI tools and hands-on guidance. Our goal is to help users master AI technology and explore the unlimited potential of AI together through high-quality content and practical experience sharing. Whether you are an AI beginner or a senior expert, this is the ideal place for you to gain knowledge, improve your skills and realize innovation.

Contact Us
en_USEnglish