AutoGen, Magentic-One, Semantic Kernel

Microsoft Agentic AI frameworks

Xin Cheng
4 min readApr 8, 2025

Let’s continue Agentic AI framework.

Autogen is generalist multi-agent system for solving open-ended web and file-based tasks.

https://www.microsoft.com/en-us/research/articles/magentic-one-a-generalist-multi-agent-system-for-solving-complex-tasks/

Magentic-One consists of the following agents:

  • Orchestrator: The lead agent responsible for task decomposition, planning, directing other agents in executing subtasks, tracking overall progress, and taking corrective actions as needed
  • WebSurfer: An LLM-based agent proficient in commanding and managing the state of a Chromium-based web browser. For each request, the WebSurfer performs actions such as navigation (e.g., visiting URLs, performing searches), interacting with webpages (e.g., clicking, typing), and reading actions (e.g., summarizing, answering questions). It then reports on the new state of the webpage. The WebSurfer relies on the browser’s accessibility tree and set-of-marks prompting to perform its tasks.
  • FileSurfer: An LLM-based agent that commands a markdown-based file preview application to read local files. It can also perform common navigation tasks such as listing directory contents and navigating through them.
  • Coder: An LLM-based agent specialized in writing code, analyzing information collected from the other agents, and creating new artifacts.
  • ComputerTerminal: Provides access to a console shell for executing programs and installing new libraries.

Generalists framework, not like langgraph specific control of workflow, relying LLM to make decisions

Main code concepts

PlanningAgent: asked to first to engage when given a new task, and manager of coordinating complex task/subtasks between team members. assigning tasks format: <agent> : <task>. Also it controls termination.

3 sub-agents: Story_writer, Story_reviewer, Story_moral

SelectorGroupChat: which has all 4 agents and termination_condition. Code below will terminate chat when “TERMINATE” and max 10 messages.

text_mention_termination = TextMentionTermination("TERMINATE")
max_messages_termination = MaxMessageTermination(max_messages=10)
termination = text_mention_termination | max_messages_termination

Autogen uses prompt-based agent coordination, which is more dynamic and flexible, but limited control and open-ended nature of conversations may lead to less predictable agent behavior, good for dynamic, unstructured problem solving. LangGraph explicit edge and condition-based agent workflow is predictable and structured, lack of flexibility, good for tasks with well-defined steps and decision points.

Agentic Ai talk starts at 29:22

Semantic kernel

Define Plugin. Plugins are collections of functions that can be integrated into an AI application

import asyncio

import nest_asyncio
nest_asyncio.apply()

from typing import TYPE_CHECKING, Annotated

from semantic_kernel import Kernel
from semantic_kernel.agents import ChatCompletionAgent
from semantic_kernel.connectors.ai import FunctionChoiceBehavior
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion
from semantic_kernel.contents import ChatHistory
from semantic_kernel.contents.function_call_content import FunctionCallContent
from semantic_kernel.contents.function_result_content import FunctionResultContent
from semantic_kernel.functions import KernelArguments, kernel_function

if TYPE_CHECKING:
pass


###################################################################
# The following sample demonstrates how to create a simple, #
# non-group agent that utilizes plugins defined as part of #
# the Kernel. #
###################################################################


# Define a sample plugin for the sample
class MenuPlugin:
"""A sample Menu Plugin used for the concept sample."""

@kernel_function(description="Provides a list of specials from the menu.")
def get_specials(self) -> Annotated[str, "Returns the specials from the menu."]:
return """
Special Soup: Clam Chowder
Special Salad: Cobb Salad
Special Drink: Chai Tea
"""

@kernel_function(description="Provides the price of the requested menu item.")
def get_item_price(
self, menu_item: Annotated[str, "The name of the menu item."]
) -> Annotated[str, "Returns the price of the menu item."]:
return "$9.99"

Define agent

# Create the instance of the Kernel
kernel = Kernel()
kernel.add_plugin(MenuPlugin(), plugin_name="menu")

service_id = "agent"
kernel.add_service(OpenAIChatCompletion(ai_model_id="gpt-4o-mini", service_id="agent"))

settings = kernel.get_prompt_execution_settings_from_service_id(service_id=service_id)
# Configure the function choice behavior to auto invoke kernel functions
settings.function_choice_behavior = FunctionChoiceBehavior.Auto()

# Define the agent name and instructions
AGENT_NAME = "Host"
AGENT_INSTRUCTIONS = "Answer questions about the menu."
# Create the agent
agent = ChatCompletionAgent(
service_id=service_id,
kernel=kernel,
name=AGENT_NAME,
instructions=AGENT_INSTRUCTIONS,
arguments=KernelArguments(settings=settings),
)


async def main():
# Define the chat history
chat_history = ChatHistory()

# Respond to user input
user_inputs = [
"Hello",
"What is the special soup?",
"What does that cost?",
"Thank you",
]

for user_input in user_inputs:
# Add the user input to the chat history
chat_history.add_user_message(user_input)
print(f"# User: '{user_input}'")

agent_name: str | None = None
print("# Assistant - ", end="")
async for content in agent.invoke_stream(chat_history):
if not agent_name:
agent_name = content.name
print(f"{agent_name}: '", end="")
if (
not any(isinstance(item, (FunctionCallContent, FunctionResultContent)) for item in content.items)
and content.content.strip()
):
print(f"{content.content}", end="", flush=True)
print("'")


asyncio.run(main())

Choose Semantic Kernel when:

  • Building production-ready enterprise applications are your priority.
  • Stability, robust support, and seamless integration with existing enterprise systems are crucial.

Choose AutoGen when:

  • You’re exploring innovative multi-agent designs and pushing the boundaries of AI.
  • Experimentation, flexibility, and a thriving community are essential for your project.

The Future: A Unified Approach

By early 2025, Microsoft plans to unify the multi-agent runtime of both frameworks. This will empower developers to leverage the best of both worlds:

  • Start with AutoGen for initial experimentation and cutting-edge agent design.
  • Transition seamlessly to Semantic Kernel for enterprise-grade deployment.

https://docs.google.com/document/d/1OQkJQpGXUjAmGw_R0ET-Ztrgtj2ZhTfrYoiewQUe4qI/edit?tab=t.0

--

--

Xin Cheng
Xin Cheng

Written by Xin Cheng

Generative Agentic AI/LLM, Data, ML, Multi/Hybrid-cloud, cloud-native, IoT developer/architect, 3x Azure-certified, 3x AWS-certified, 2x GCP-certified

No responses yet