Package com.tnsai.models.role


package com.tnsai.models.role
Gaia methodology model classes for role-based agent design.

This package implements the Gaia methodology for multi-agent system design, developed by Wooldridge, Jennings, and Kinny. Gaia treats agents as organizational entities that fulfill specific Roles within a system.

Gaia Role Model

 ┌─────────────────────────────────────────────────────────────┐
 │                     Role Schema                              │
 ├─────────────────────────────────────────────────────────────┤
 │                                                              │
 │  ┌─────────────────────────────────────────────────────┐    │
 │  │               RoleIdentity                           │    │
 │  │  • name: Unique identifier                          │    │
 │  │  • goal: Primary objective                          │    │
 │  │  • domain: Area of expertise                        │    │
 │  └─────────────────────────────────────────────────────┘    │
 │                                                              │
 │  ┌─────────────────────────────────────────────────────┐    │
 │  │              Responsibilities                        │    │
 │  │                                                      │    │
 │  │  CoreDuty (Liveness)     SafetyProperty (Safety)    │    │
 │  │  ────────────────────    ─────────────────────────   │    │
 │  │  "Must eventually do"    "Must never/always do"     │    │
 │  │  • Collect data          • MUST_NEVER expose PII    │    │
 │  │  • Generate reports      • MUST_ALWAYS validate     │    │
 │  └─────────────────────────────────────────────────────┘    │
 │                                                              │
 └─────────────────────────────────────────────────────────────┘
 

Model Classes

ClassPurposeGaia Concept
RoleIdentityName, goal, domainRole Schema header
invalid reference
CoreDuty
Required tasksLiveness property
invalid reference
SafetyProperty
ConstraintsSafety property
invalid reference
Responsibilities
Duty + Safety collectionResponsibilities schema
invalid reference
Responsibility
Common interfaceAbstract responsibility

Liveness vs Safety

In formal verification terms:

  • Liveness (CoreDuty): Something good eventually happens
    Example: "The agent must eventually respond to queries"
  • Safety (SafetyProperty): Something bad never happens
    Example: "The agent must never expose credentials"

Usage Example


 // Define role identity
 RoleIdentity identity = new RoleIdentity(
     "SecureAPIHandler",
     "Process API requests securely",
     "API Security"
 );

 // Define responsibilities
 Responsibilities responsibilities = Responsibilities.builder()
     .addDuty(new CoreDuty("Request Validation", "Validate all incoming requests"))
     .addDuty(new CoreDuty("Response Generation", "Generate appropriate responses"))
     .addSafety(new SafetyProperty(
         SafetyType.MUST_NEVER,
         "expose internal error details",
         "Prevents information disclosure"))
     .addSafety(new SafetyProperty(
         SafetyType.MUST_ALWAYS,
         "log authentication attempts",
         "Security audit requirement"))
     .build();
 

LLM Integration

Role models are converted to system prompt instructions that establish the agent's identity and behavioral constraints for the LLM.

See Also:
  • RoleIdentity
  • invalid reference
    CoreDuty
  • invalid reference
    SafetyProperty
  • invalid reference
    Responsibilities
  • Role