By Sagar Shankaran, Founder of CallSphere
Explore Microsoft's AutoGen framework for building multi-agent systems using conversable agents, group chat orchestration, and integrated code execution for collaborative problem solving.
Key takeaways
AutoGen, developed by Microsoft Research, is built around a single powerful abstraction: conversable agents. Every agent in AutoGen can send and receive messages to other agents. The framework models multi-agent collaboration as conversations — agents literally talk to each other, and the conversation transcript becomes the shared context.
This design choice is intentional. Instead of rigid pipelines or predefined workflows, AutoGen lets agents negotiate, debate, and iteratively refine their outputs through natural language dialogue. The result is a framework that handles open-ended, exploratory tasks particularly well.
The ConversableAgent is AutoGen's foundational class. Every agent type — assistant agents, user proxies, and custom agents — inherits from it. A conversable agent has three key capabilities: it can generate replies using an LLM, execute code, and interact with humans.
flowchart LR
USER(["UserProxyAgent"])
subgraph CHAT["GroupChat"]
C1["Coder agent"]
C2["Reviewer agent"]
C3["Executor agent<br/>Docker sandbox"]
end
MGR["GroupChatManager<br/>next speaker selection"]
OUT(["Termination<br/>stop word reached"])
USER --> MGR --> C1 --> MGR
MGR --> C2 --> MGR
MGR --> C3 --> MGR
MGR --> OUT
style MGR fill:#4f46e5,stroke:#4338ca,color:#fff
style C3 fill:#ede9fe,stroke:#7c3aed,color:#1e1b4b
style OUT fill:#059669,stroke:#047857,color:#fff
from autogen import ConversableAgent
# A simple conversable agent
assistant = ConversableAgent(
name="Assistant",
system_message="""You are a helpful AI assistant.
Solve tasks carefully and explain your reasoning.""",
llm_config={"model": "gpt-4o", "temperature": 0},
)
# A user proxy that can execute code
user_proxy = ConversableAgent(
name="UserProxy",
human_input_mode="NEVER", # Fully autonomous
code_execution_config={
"work_dir": "coding_output",
"use_docker": False,
},
is_termination_msg=lambda msg: "TERMINATE" in msg.get("content", ""),
)
The human_input_mode parameter controls how much human oversight the agent requires. NEVER means fully autonomous, ALWAYS asks for human input at every step, and TERMINATE only asks when the conversation is about to end.
The simplest AutoGen pattern is a two-agent conversation. One agent generates solutions, the other validates or executes them:
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
# Start a conversation between two agents
user_proxy.initiate_chat(
assistant,
message="""Write a Python function that finds the longest
palindromic substring in a given string. Include test cases.""",
)
When this runs, the assistant generates Python code, the user proxy executes it in a sandboxed environment, and the result is sent back to the assistant. If the code fails, the assistant sees the error and iterates. This loop continues until the task succeeds or hits the termination condition.
AutoGen's group chat is where the framework truly differentiates itself. You can put multiple agents in a shared conversation where they take turns contributing:
from autogen import GroupChat, GroupChatManager
# Define specialized agents
coder = ConversableAgent(
name="Coder",
system_message="""You write Python code to solve problems.
Always include type hints and docstrings.""",
llm_config={"model": "gpt-4o"},
)
reviewer = ConversableAgent(
name="Reviewer",
system_message="""You review code for bugs, edge cases,
and performance issues. Be thorough but constructive.""",
llm_config={"model": "gpt-4o"},
)
tester = ConversableAgent(
name="Tester",
system_message="""You write comprehensive test cases.
Cover edge cases, boundary conditions, and error scenarios.""",
llm_config={"model": "gpt-4o"},
)
executor = ConversableAgent(
name="Executor",
human_input_mode="NEVER",
code_execution_config={"work_dir": "output", "use_docker": False},
is_termination_msg=lambda msg: "ALL_TESTS_PASSED" in msg.get("content", ""),
)
# Create group chat
group_chat = GroupChat(
agents=[coder, reviewer, tester, executor],
messages=[],
max_round=12,
speaker_selection_method="auto",
)
manager = GroupChatManager(
groupchat=group_chat,
llm_config={"model": "gpt-4o"},
)
# Kick off the group conversation
executor.initiate_chat(
manager,
message="Build a thread-safe LRU cache in Python with TTL support.",
)
The speaker_selection_method="auto" lets the GroupChatManager use an LLM to decide which agent should speak next based on the conversation context. The coder writes the implementation, the reviewer critiques it, the tester writes tests, and the executor runs everything.
AutoGen supports Docker-based code execution for sandboxing. In production, always enable this:
code_execution_config = {
"work_dir": "output",
"use_docker": "python:3.11-slim",
"timeout": 60,
}
This runs all generated code inside a Docker container, preventing agents from modifying the host system. The timeout parameter kills long-running code that might be stuck in an infinite loop.
AutoGen supports several conversation patterns. Sequential chat chains conversations so the output of one becomes the input of the next. Nested chat lets an agent spawn a sub-conversation with other agents to answer a specific question before returning to the main conversation.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
# Nested chat: agent consults sub-agents for specific questions
assistant.register_nested_chats(
[
{
"recipient": fact_checker,
"message": "Verify these claims",
"max_turns": 3,
}
],
trigger=lambda sender: "fact check" in sender.last_message().get("content", "").lower(),
)
AutoGen is strongest for iterative, code-heavy workflows where agents need to write, execute, debug, and refine code collaboratively. The built-in code execution and conversation-based architecture make it natural for coding assistants, data analysis pipelines, and research tasks.
It is less suited for simple tool-calling agents or production APIs where you need deterministic, low-latency responses. The conversation overhead adds latency, and the autonomous nature makes outputs less predictable.
AutoGen has multiple safeguards: the max_round parameter on GroupChat limits conversation turns, is_termination_msg functions detect completion signals, and you can set max_consecutive_auto_reply on individual agents to cap their responses.
Yes. You can register functions as tools on any ConversableAgent using register_for_llm() and register_for_execution(). These work like OpenAI function calling — the agent decides when to invoke them.
AutoGen is designed more for batch processing and complex reasoning tasks than for low-latency API endpoints. For production APIs, consider wrapping AutoGen workflows in async task queues rather than running them synchronously in request handlers.
#AutoGen #Microsoft #MultiAgentSystems #GroupChat #CodeExecution #AgenticAI #LearnAI #AIEngineering

Written by
Sagar Shankaran· Founder, CallSphere
LinkedInSagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
How we built a fault-tolerant HVAC emergency triage and tech-dispatch platform on Kubernetes — three-tier CQRS, 11 micro-agents on the OpenAI Agents SDK + LangGraph, NATS JetStream, DTMF/SMS/WebSocket acceptance, circuit breakers, and an evaluation pipeline that catches regressions before they wake a tech at 3 AM.
Five proven multi-agent architecture patterns built on A2A — orchestrator, peer mesh, hub-and-spoke, marketplace, and tiered specialist.
Langgraph multi-agent supervisor handoffs docs: the supervisor pattern in LangGraph for coordinating specialist agents, with full code, an eval pipeline that scores routing accuracy, and the failure modes to watch for.
Handoffs done right — when one agent should hand control to another, how to preserve context, and how to evaluate the handoff decision itself.
Microsoft's Copilot for Sales shipped 2026 updates that knit Dynamics, Outlook, and Teams into a single agentic surface. Here's the playbook, the per-seat pricing.
Microsoft's late-April 2026 earnings reaffirmed an $85B+ FY2026 capex envelope, with Azure AI revenue growth still pacing above 65% YoY. Coverage tuned for Boston, AZ.
© 2026 CallSphere Inc. All rights reserved.
Made within San Francisco
Watch how CallSphere handles real customer calls, schedules appointments, and processes payments — live.
Try Live DemoBook a DemoCalculate Your ROI