Agent Roles
Every agent in a multi-agent system has a defined role. Roles determine what the agent is responsible for, what tools it has access to, and which agents it communicates with.
Core Agent Roles
Coordinator Agent:
- Orchestrates the overall workflow
- Assigns tasks to worker agents
- Collects results and decides the next step
- Does not perform detailed work itself
Worker Agents:
- Perform specific, well-defined tasks
- Each has a narrow scope and specialised tools
- Report results back to the coordinator
Reviewer Agent:
- Evaluates the output of worker agents
- Checks for quality, accuracy, and completeness
- Approves output or sends it back for revision
Gatekeeper Agent:
- Validates inputs before they enter the system
- Sanitises outputs before they leave the system
- Enforces security and format constraints
Role Definition Example
# Agent role definition system
from dataclasses import dataclass
from typing import List, Set
@dataclass
class AgentRole:
name: str
description: str
responsibilities: List[str]
allowed_tools: Set[str]
allowed_communications: Set[str] # Which agents this agent can talk to
# Define agent roles for a research system
roles = {
"coordinator": AgentRole(
name="Coordinator",
description="Orchestrates the research workflow",
responsibilities=[
"Break down the research goal into subtasks",
"Assign subtasks to specialised research agents",
"Collect and synthesise results",
"Manage the delivery of the final report"
],
allowed_tools={"assign_task", "read_results", "synthesise", "send_report"},
allowed_communications={"researcher_1", "researcher_2", "reviewer"}
),
"researcher": AgentRole(
name="Research Agent",
description="Conducts focused research on a specific topic",
responsibilities=[
"Search for information on the assigned topic",
"Extract relevant facts and data",
"Return a structured research summary"
],
allowed_tools={"web_search", "read_document", "extract_data", "summarise"},
allowed_communications={"coordinator"} # Only reports to coordinator
),
"reviewer": AgentRole(
name="Review Agent",
description="Reviews research output for quality and accuracy",
responsibilities=[
"Check that all required topics are covered",
"Verify accuracy of key claims",
"Score quality on a 0-10 scale",
"Approve or request revision"
],
allowed_tools={"web_search", "fact_check"},
allowed_communications={"coordinator"}
),
}
for role_id, role in roles.items():
print(f"{role.name}: {len(role.allowed_tools)} tools, "
f"talks to: {role.allowed_communications}")