Interface Team

All Superinterfaces:
com.tnsai.agents.groups.AgentGroup
All Known Implementing Classes:
DefaultTeam

public interface Team extends com.tnsai.agents.groups.AgentGroup
A mission-oriented group of agents working toward a common goal.

Team extends AgentGroup with mission tracking, role assignments, and coordinated execution patterns. Teams are formed for specific tasks and can be disbanded after completion.

Key Features

  • Mission: Defined goal the team works toward
  • Roles: Specialized roles assigned to members
  • Formations: Execution patterns (parallel, sequential, hierarchical)
  • Progress Tracking: Monitor mission completion

Usage Example


 Team team = Team.builder()
     .name("Research Team")
     .mission("Analyze customer feedback")
     .timeout(Duration.ofMinutes(30))
     .formation(TeamFormation.PARALLEL)
     .member(analyst, TeamRole.LEAD)
     .member(researcher1, TeamRole.MEMBER)
     .member(researcher2, TeamRole.MEMBER)
     .build();

 team.start();
 TeamResult result = team.execute("Generate insights from Q4 feedback");
 team.disband();
 
See Also:
  • Method Details

    • getMission

      String getMission()
      Returns the mission description.
      Returns:
      mission description
    • getTimeout

      Duration getTimeout()
      Returns the mission timeout.
      Returns:
      timeout duration
    • getFormation

      TeamFormation getFormation()
      Returns the team formation pattern.
      Returns:
      formation
    • getMissionTracker

      MissionTracker getMissionTracker()
      Returns the mission tracker for progress monitoring.
      Returns:
      mission tracker
    • assignRole

      void assignRole(String agentId, TeamRole role)
      Assigns a role to a team member.
      Parameters:
      agentId - agent ID
      role - role to assign
      Throws:
      IllegalArgumentException - if agent is not a member
    • getRole

      Optional<TeamRole> getRole(String agentId)
      Gets the role of a team member.
      Parameters:
      agentId - agent ID
      Returns:
      role, or empty if not a member
    • getMembersWithRole

      List<com.tnsai.agents.Agent> getMembersWithRole(TeamRole role)
      Gets all members with a specific role.
      Parameters:
      role - role to find
      Returns:
      members with that role
    • getLead

      default Optional<com.tnsai.agents.Agent> getLead()
      Gets the team lead if one is assigned.
      Returns:
      team lead
    • execute

      TeamResult execute(String task)
      Executes a task using the team's formation pattern.
      Parameters:
      task - task to execute
      Returns:
      execution result
    • execute

      TeamResult execute(String task, Map<String,Object> context)
      Executes a task with custom context.
      Parameters:
      task - task to execute
      context - additional context
      Returns:
      execution result
    • executeAsync

      CompletableFuture<TeamResult> executeAsync(String task)
      Executes a task asynchronously.
      Parameters:
      task - task to execute
      Returns:
      future with result
    • executeAsync

      CompletableFuture<TeamResult> executeAsync(String task, Map<String,Object> context)
      Executes a task asynchronously with context.
      Parameters:
      task - task to execute
      context - additional context
      Returns:
      future with result
    • disband

      void disband()
      Disbands the team after mission completion. All members are removed and the team is dissolved.
    • isMissionComplete

      boolean isMissionComplete()
      Checks if the team has completed its mission.
      Returns:
      true if mission complete
    • isDisbanded

      boolean isDisbanded()
      Checks if the team is disbanded.
      Returns:
      true if disbanded
    • builder

      static TeamBuilder builder()
      Creates a new Team builder.
      Returns:
      builder
    • assemble

      static Optional<Team> assemble(String mission, List<com.tnsai.agents.Agent> agents, List<TeamRole> requiredRoles)
      Assembles a team from agents with required roles.
      Parameters:
      mission - mission description
      agents - available agents
      requiredRoles - required roles
      Returns:
      assembled team, or empty if requirements not met