con un clic
con un clic
REST and WebSocket endpoint patterns, error handling, and Pydantic schema conventions for the backend
Architecture, directory layout, communication protocol, and conventions for the full-stack multi-agent application
Step-by-step guide to add a new REST or WebSocket endpoint to the backend
Step-by-step guide to add a new page or component to the React frontend
How the Code Reviewer agent conducts systematic code reviews with prioritized findings
How the Research Analyst agent conducts research, evaluates sources, and produces structured reports
| name | add-agent-to-team |
| description | Step-by-step guide to add a new agent to the multi-agent team |
| license | Apache-2.0 |
backend/app/agents.pyAdd the agent inside the with config: block alongside the existing agents:
with config:
planner = AssistantAgent(...)
coder = AssistantAgent(...)
reviewer = AssistantAgent(...)
# New agent
tester = AssistantAgent(
name="tester",
system_message=(
"You are a testing agent. Given the coder's implementation, "
"write comprehensive unit tests covering edge cases and error "
"conditions. Use pytest conventions."
),
)
AGENTS = [planner, coder, reviewer, tester]
AGENT_NAMES updates automatically since it's derived from AGENTS.
For RoundRobinPattern, agents execute in list order — place the new agent where it should speak in the sequence.
If switching to AutoPattern for dynamic routing:
from autogen.agentchat.group.patterns.pattern import AutoPattern
pattern = AutoPattern(
initial_agent=planner,
agents=AGENTS,
)
max_rounds in run_team()Each agent takes one round. If you added an agent, increase max_rounds to allow at least 2 full cycles:
result = await run_group_chat(
pattern=pattern,
messages=message,
max_rounds=8, # was 6 with 3 agents
)
In frontend/src/components/Chat.tsx, add a color entry:
const AGENT_COLORS: Record<string, string> = {
planner: "#2563eb",
coder: "#059669",
reviewer: "#d97706",
tester: "#7c3aed", // new
system: "#6b7280",
};
In backend/tests/test_api.py:
async def test_health(client: AsyncClient) -> None:
resp = await client.get("/api/health")
body = resp.json()
assert "tester" in body["agents"]
AGENTS list in the correct positionmax_rounds updated to accommodate the new agent