← Back to list

AutoGen by Microsoft: A Framework for Conversational AI Agent

Introduction:

Nagh · 2025-08-04 08:34 · 1 claps · 3.9 min read
#autogen #genai #llm #azure #openai
Open on Medium ↗
Wiki topics: LLM · Large Language Models AGT · AI Agents AI · AI · General ☁️ · DevOps & Cloud

AutoGen by Microsoft: A Framework for Conversational AI Agent

Introduction:

AutoGen is an open-source framework designed to orchestrate multi-agent LLM systems using a conversational programming paradigm. It allows developers to create and manage AI agents that can communicate, delegate tasks, and collaborate — just like human teams do. Whether you’re building a code generation assistant, an automated researcher, or a multi-agent RAG pipeline, AutoGen makes it easy to define roles, structure agent interactions, and execute complex tasks with minimal boilerplate.

There are multiple versions available for Autogen, be cautious while using code completions like chatgpt, perplexity as it may provide older version functionalities (V0.2)

📚 A Word on Documentation: Surprisingly Enjoyable!

One of the most pleasant surprises I encountered while working with AutoGen was its exceptional documentation. I’ve never been the type to enjoy reading long docs before diving into code — but AutoGen changed that for me. The documentation is clean, intuitive, and beginner-friendly, even for developers who are new to multi-agent frameworks or LLM orchestration.

From clear examples to step-by-step guides, the docs make it easy to go from “What is this?” to “I just built something useful!” in no time. Huge kudos to the AutoGen documentation team — you’ve made the learning curve not just manageable, but actually enjoyable. 👏👏👏

📊 Comparison of AutoGen with Other AI Frameworks

When it comes to building agentic or LLM-powered applications, several frameworks are available — each with its own strengths and ideal use cases. Here’s how AutoGen v0.4 stacks up against popular alternatives:

source

Connect AzureOpenAI Model

provider: autogen_ext.models.openai.AzureOpenAIChatCompletionClient
config:
  azure_deployment: "<deployment_name>"
  model: <model_name>
  api_version: <api_key>
  azure_endpoint: https://<openai_service_name>.openai.azure.com/openai/deployments/gpt-4o/chat/completions?api-version=2025-01-01-preview
  api_key: <api_key>
# uv add pyyaml                     "pyyaml>=6.0.2"
# uv add autogen-ext[azure,openai]  "autogen-ext[azure,openai]>=0.7.1"
import yaml
with open("model_config.yaml", "r") as f:
    model_config = yaml.safe_load(f)
model_client = ChatCompletionClient.load_component(model_config)

🧩 Types of Agents in AutoGen

AutoGen comes with several built-in agent types, each designed for a specific purpose:

🔹 UserProxyAgent

  • Represents a human or external user.
  • Can inject messages, execute code, or act as a proxy for human interaction.

🔹 AssistantAgent

  • A general-purpose LLM assistant.
  • Often acts as the primary problem solver in an agent team.

🔹 Custom Agents

  • You can subclass any agent to create a custom role with unique behavior.

Add-on feature is that you can define the agent output schema using pydantic

# The response format for the agent as a Pydantic base model.
class AgentResponse(BaseModel):
    thoughts: str
    response: Literal["happy", "sad", "neutral"]

agent = AssistantAgent(
    "assistant",
    model_client=model_client,
    system_message="Categorize the input as happy, sad, or neutral following the JSON format.",
    # Define the output content type of the agent.
    output_content_type=AgentResponse,
)

Most of the use cases you solve can be acheived using AssistantAgent, but in case you have to define a custom agent that can also be done


class RequirementsGatheringAgent(BaseChatAgent):
    def __init__(self, name: str, user_message: str, llm_client:AzureOpenAIChatCompletionClient, requirement_gathering_agent_prompt: str) -> None:

        super().__init__(name, "An LLM-powered requirement gathering agent.")
        self._user_message = user_message
        self._llm_client = llm_client
        self._requirement_gathering_agent_prompt = requirement_gathering_agent_prompt.format(user_message=self._user_message)

    @property
    def produced_message_types(self) -> Sequence[type[BaseChatMessage]]:
        return (TextMessage,) [4-6]

    async def on_messages(self, messages: Sequence[BaseChatMessage], cancellation_token: CancellationToken) -> Response:
        # Calls the on_messages_stream.
        response: Response | None = None
        async for message in self.on_messages_stream(messages, cancellation_token):
            if isinstance(message, Response):
                response = message
        assert response is not None
        return response

    async def on_messages_stream(
        self, messages: Sequence[BaseChatMessage], cancellation_token: CancellationToken
    ) -> AsyncGenerator[BaseAgentEvent | BaseChatMessage | Response, None]:
        inner_messages: List[BaseAgentEvent | BaseChatMessage] = []
        result = await self._llm_client.create([UserMessage(content=self._requirement_gathering_agent_prompt, source="user")])
        # Create a proper message from result
        response_msg = TextMessage(content=result.content, source=self.name)
        inner_messages.append(response_msg)

        # Return actual model output as chat_message
        yield response_msg  # Optionally yield it as a normal message too
        yield Response(chat_message=response_msg, inner_messages=inner_messages)

🤖 Teams in AutoGen: Coordinated Agent Collaboration

  • RoundRobinGroupChat: A simple coordination model where agents take turns in a fixed sequence, like a roundtable discussion. This is ideal for structured conversations where each agent needs to contribute in order.
  • SelectorGroupChat: This preset uses an LLM-powered selector to decide which agent should speak next after each message. It’s useful for dynamic conversations where the most relevant agent is chosen based on context.
  • MagenticOneGroupChat: A general-purpose multi-agent system designed for solving open-ended tasks across domains like web search, file analysis, and information retrieval. It leverages AutoGen’s tooling and agent roles to handle complex, cross-domain workflows.
  • Swarm: A more advanced and flexible preset where agents use **HandoffMessage** to explicitly transfer control of the conversation to another agent. This allows for fine-grained coordination and delegation between agents.
from autogen_agentchat.teams import RoundRobinGroupChat

planning_group = RoundRobinGroupChat(
        participants=[
            team.create_backend_requirements_agent(),
            team.create_frontend_planner_agent(),
            team.create_user_proxy_agent()
        ],
        termination_condition=MaxMessageTermination(max_messages=4),
    )

print("\n🚀 Starting Planning Phase...\n")
planning_response = await Console(planning_group.run_stream(task=initial_task))

Upcoming Blog: Building a Mini-Manus with AutoGen

In my next blog, I’ll walk you through building a lightweight version of Manus using AutoGen’s multi-agent framework. The idea is simple but powerful: A user provides a prompt describing an application — including frontend, backend, and business logic — and a team of AI agents collaboratively gathers requirements, confirms them, and generates complete code for:

  • ✅ Backend (e.g., APIs, DB models)
  • 🎨 Frontend (UI code)
  • 🧪 Test cases (unit + integration)

Think of it as an AI-powered product engineer — fast, structured, and test-aware.

Stay tuned to see how I design the agent team, manage the user flow, and orchestrate everything using AutoGen’s latest features.


메타데이터
post_id
15cde5ba97af
slug
autogen-by-microsoft-a-framework-for-conversational-ai-agent-15cde5ba97af
url
https://medium.com/@17nagh/autogen-by-microsoft-a-framework-for-conversational-ai-agent-15cde5ba97af
canonical_url
https://medium.com/@17nagh/autogen-by-microsoft-a-framework-for-conversational-ai-agent-15cde5ba97af
author_url
https://medium.com/@17nagh
status
ok
fetched_at
2026-06-15 20:49:13