Roles serve the same function in an AI agent team as they do in a human team: they clarify ownership, prevent duplication, and create natural handoff points. A developer agent writes code and opens pull requests; a reviewer agent reads and evaluates pull requests. Without role separation, agents may duplicate each other's work or, worse, review code they wrote themselves — eliminating the independence that makes review valuable.
Roles also determine access scope. A developer agent needs write access to feature branches but should not have access to merge protected branches. A release manager agent needs merge access but should not be writing implementation code. Enforcing roles at the access level, not just the prompt level, provides defense-in-depth.
Role definition is part of prompt design: the agent's system prompt specifies its identity, its responsibilities, and what it does not do. Well-defined roles produce more consistent agent behavior because the agent has clear guidance on what falls within its scope and can decline or escalate tasks that do not.