Package com.tnsai.models.role
Class RoleIdentity
java.lang.Object
com.tnsai.models.role.RoleIdentity
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()andActionSpec.mustAlways() - Liveness Properties: Goals that must eventually be achieved
RoleIdentity Components
| Field | Purpose | Example |
|---|---|---|
| name | Unique identifier for the role | "DataAnalyst" |
| goal | Primary objective of the role | "Extract insights from data" |
| domain | Area 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGenerates a prompt section for LLM.
-
Constructor Details
-
RoleIdentity
-
-
Method Details
-
generatePromptSection
Generates a prompt section for LLM.
-