원클릭으로
create-agent-team
// Scaffold a complete AG2 multi-agent team with agents, tools, group chat configuration, and an entry point. Use when the user wants to create a new multi-agent workflow from scratch.
// Scaffold a complete AG2 multi-agent team with agents, tools, group chat configuration, and an entry point. Use when the user wants to create a new multi-agent workflow from scratch.
Add code execution capability to AG2 agents using LocalCommandLineCodeExecutor or Docker. Use when the user wants agents that can write and run Python code.
Add safety guardrails to AG2 agents using LLMGuardrail and RegexGuardrail. Use when the user wants to enforce safety constraints, filter PII, or redirect off-topic responses.
Wire a Model Context Protocol (MCP) server into AG2 agents using create_toolkit. Use when the user wants to connect external tools via MCP.
Build an AG2 handoff-driven workflow with DefaultPattern, agent handoffs, context variables, and routing. Use when the user wants customer service routing, state-machine workflows, or explicit agent-to-agent transitions.
Build a Retrieval-Augmented Generation (RAG) agent using AG2's RetrieveUserProxyAgent with vector database support. Use when the user wants agents that can query documents or knowledge bases.
Build an AG2 ReasoningAgent that uses tree-of-thought reasoning with beam search, MCTS, or LATS strategies. Use when the user needs advanced reasoning for complex problem solving.
| name | create-agent-team |
| description | Scaffold a complete AG2 multi-agent team with agents, tools, group chat configuration, and an entry point. Use when the user wants to create a new multi-agent workflow from scratch. |
You are an expert AG2 framework developer. The user wants to scaffold a multi-agent team. Follow these steps:
Ask the user (if not already clear):
Create a Python file with this structure:
import os
from typing import Annotated
from autogen import ConversableAgent, LLMConfig
from autogen.agentchat import run_group_chat
from autogen.agentchat.group.patterns import AutoPattern
# 1. LLM Configuration
llm_config = LLMConfig(
{"model": "gpt-4o-mini", "api_key": os.environ["OPENAI_API_KEY"]},
)
# 2. Define Agents
# - Give each agent a clear name (no whitespace), system_message, and description
# - description is used by AutoPattern's LLM to select the next speaker
# - Set human_input_mode appropriately
user = ConversableAgent(
name="user",
human_input_mode="NEVER",
llm_config=False,
)
# ... define role-specific agents ...
# 3. Register Tools (if needed)
# - Use @agent.register_for_llm() and @agent.register_for_execution() decorators
# - Or use Tool/Toolkit classes
# - For pre-built tools: from autogen.tools.experimental import DuckDuckGoSearchTool
# 4. Orchestration — choose pattern based on workflow:
# - AutoPattern: LLM picks next speaker (best for dynamic collaboration)
# - RoundRobinPattern: sequential pipeline (each agent adds to output)
# - DefaultPattern: pure handoff-driven (you define all transitions)
result = run_group_chat(
pattern=AutoPattern(
initial_agent=first_agent,
agents=[agent1, agent2, agent3],
user_agent=user,
group_manager_args={"llm_config": llm_config},
),
messages="Describe the task here.",
max_rounds=15,
)
# 5. Results
result.process()
print(result.summary)
When agents should explicitly route to each other:
from autogen.agentchat.group import (
OnCondition, AgentTarget, TerminateTarget, StringLLMCondition,
)
from autogen.agentchat.group.patterns import DefaultPattern
# Define handoffs
researcher.handoffs.add_llm_condition(
OnCondition(
target=AgentTarget(analyst),
condition=StringLLMCondition(prompt="Research is complete and ready for analysis"),
)
)
analyst.handoffs.set_after_work(TerminateTarget())
result = run_group_chat(
pattern=DefaultPattern(
initial_agent=researcher,
agents=[researcher, analyst],
user_agent=user,
),
messages="Start researching...",
max_rounds=20,
)
autogen, not ag2LLMConfig() class, never raw dicts for llm_configdescriptionregister_for_llm() with a register_for_execution()human_input_mode="NEVER" for fully autonomous agentsAnnotated[type, "description"] for all tool parametersmax_rounds to prevent infinite loopsAutoPattern, always provide llm_config in group_manager_args