Team Strategies
Teams coordinate multiple agents through execution strategies. Each strategy defines how team members interact and process messages.
Sequential Strategy
Executes team members in defined order, passing message history between members.
apiVersion: ark.mckinsey.com/v1alpha1
kind: Team
metadata:
name: sequential-team
spec:
strategy: sequential
members:
- name: agent1
type: agent
- name: agent2
type: agent
Implementation: runtime/internal/genai/team.go:53
- Processes members one by one in array order
- Each member receives complete message history from previous members
- Execution stops on first error or termination
Round-Robin Strategy
Cycles through team members repeatedly until maxTurns limit or team termination.
apiVersion: ark.mckinsey.com/v1alpha1
kind: Team
metadata:
name: roundrobin-team
spec:
strategy: round-robin
maxTurns: 3
members:
- name: agent1
type: agent
- name: agent2
type: agent
Implementation: runtime/internal/genai/team.go:67
- Continuously cycles through all members
- Requires
maxTurns
to prevent infinite loops - Each turn processes all members in sequence
- Maintains turn counter and message history across cycles
- Use terminate tool to end execution early
Selector Strategy
AI model chooses next participant based on conversation context.
apiVersion: ark.mckinsey.com/v1alpha1
kind: Team
metadata:
name: selector-team
spec:
strategy: selector
maxTurns: 10
selector:
model: gpt-4
selectorPrompt: |
Choose the best participant for the next response.
Available: {{.Participants}}
History: {{.History}}
members:
- name: researcher
type: agent
- name: writer
type: agent
Implementation: runtime/internal/genai/team_selector.go:66
- Uses AI model to select next participant
- Template-based prompts with conversation history
- Fallback to first member if selection fails
- Prevents consecutive execution by same member
- Use terminate tool to end execution early
Selector Template Variables
{{.Participants}}
: Comma-separated member names{{.Roles}}
: Member names with descriptions{{.History}}
: Formatted conversation history
Graph Strategy
Directed workflow execution following defined transitions.
apiVersion: ark.mckinsey.com/v1alpha1
kind: Team
metadata:
name: graph-team
spec:
strategy: graph
maxTurns: 5
members:
- name: researcher
type: agent
- name: analyzer
type: agent
- name: writer
type: agent
graph:
edges:
- from: researcher
to: analyzer
- from: analyzer
to: writer
Implementation: runtime/internal/genai/team_graph.go:10
- Follows directed graph edges for member transitions
- Starts with first member in members array
- Execution stops when no outgoing edge exists or team termination
- Requires
maxTurns
to prevent infinite cycles - Use terminate tool to end execution early
Team Composition
Nested Teams
Teams can contain other teams as members:
spec:
members:
- name: sub-team
type: team
- name: agent1
type: agent
Member Types
agent
: Individual AI agentteam
: Nested team with its own strategy
Configuration Options
Common Settings
maxTurns
: Maximum execution cycles (required for round-robin, selector, graph)description
: Team description used in selector templatesmembers
: Array of TeamMember objects
Strategy-Specific Settings
- Selector:
selector.model
,selector.selectorPrompt
- Graph:
graph.edges
array withfrom
/to
references
Error Handling
All strategies support:
- Graceful termination via
TerminateTeam
error - Message history preservation on errors
- Turn tracking and limits
- Event recording for observability
Early Termination
Agents can use the terminate tool to end team execution early:
apiVersion: ark.mckinsey.com/v1alpha1
kind: Agent
metadata:
name: coordinator
spec:
prompt: "You coordinate the team. Use terminate tool when task is complete."
tools:
- name: terminate
type: built-in
The terminate tool stops team execution and returns current results without processing remaining members or turns.
Sample Files
- Basic sequential:
samples/team.yaml
- Graph workflow:
samples/team-graph.yaml
- GitHub integration:
samples/teams/github-team.yaml
- Selector strategy:
samples/selector-strategy-test.yaml