Class RoleIdentity

java.lang.Object
com.tnsai.models.role.RoleIdentity

@Immutable public final class RoleIdentity extends Object
Represents the identity of a role in the Gaia methodology.

In the Gaia methodology for multi-agent system design, a RoleIdentity defines the core characteristics of a role that an agent can play. Gaia emphasizes organizational structure, treating agents as actors fulfilling specific roles within a system.

Gaia Methodology Context

Gaia (developed by Wooldridge, Jennings, and Kinny) provides a structured approach to agent-oriented analysis and design. Key concepts include:

  • Roles: Abstract descriptions of expected functionality (this class)
  • Responsibilities: Tasks the role must perform — expressed as the role's actions rather than a dedicated type
  • Safety Properties: Invariants that must be maintained — see ActionSpec.mustNever() and ActionSpec.mustAlways()
  • Liveness Properties: Goals that must eventually be achieved

RoleIdentity Components

FieldPurposeExample
nameUnique identifier for the role"DataAnalyst"
goalPrimary objective of the role"Extract insights from data"
domainArea of expertise/responsibility"Business Intelligence"

Usage Example


 // Create a role identity
 RoleIdentity analyst = new RoleIdentity(
     "DataAnalyst",
     "Analyze datasets and generate actionable insights",
     "Business Intelligence"
 );

 // In a Role definition
 public class AnalystRole extends Role {
     @Override
     protected RoleIdentity getIdentity() {
         return new RoleIdentity(
             "Market Researcher",
             "Research market trends and competitor activities",
             "Market Intelligence"
         );
     }
 }

 // Generate prompt section for LLM
 String prompt = analyst.generatePromptSection();
 // Output:
 // # Role: DataAnalyst
 //
 // **Goal:** Analyze datasets and generate actionable insights
 // **Domain:** Business Intelligence
 

LLM Integration

The generatePromptSection() method produces Markdown-formatted instructions that are included in the system prompt to give the LLM context about its role and objectives.

Thread Safety

This class is immutable and therefore thread-safe.

See Also:
  • Constructor Details

  • Method Details

    • generatePromptSection

      public String generatePromptSection()
      Generates a prompt section for LLM.