Class ConfigurableRole

java.lang.Object
com.tnsai.roles.Role
com.tnsai.roles.ConfigurableRole

public final class ConfigurableRole extends Role
A fully configurable Role implementation created via RoleBuilder.

This class is not intended to be subclassed. Use RoleBuilder to create instances with custom configurations.

For roles with action-bound safety constraints (mustNever / mustAlways), define a Role subclass with @ActionSpec-annotated methods.

Author:
TnsAI Team
See Also:
  • Method Details

    • getIdentity

      public RoleIdentity getIdentity()
      Description copied from class: Role
      Template method: Define the role's identity. Subclasses MUST override this method to return a RoleIdentity.
      Specified by:
      getIdentity in class Role
      Returns:
      role identity (name, goal, domain)
    • getResilienceConfig

      public ResilienceConfig getResilienceConfig()
      Description copied from class: Role
      Programmatic resilience policy for this role's actions (TNS-567) — the builder-path counterpart of a class-level @Resilience. Default is ResilienceConfig.NONE; ConfigurableRole overrides it with the RoleBuilder.resilience(...) value. ActionExecutor consults this when no @Resilience annotation is present.
      Overrides:
      getResilienceConfig in class Role
      Returns:
      the role's resilience config, never null
    • getInputGuardrailConfig

      public InputGuardrailConfig getInputGuardrailConfig()
      Description copied from class: Role
      Programmatic input-guardrail config for this role's actions (TNS-561) — the builder-path counterpart of a class-level @InputGuardrail. Default null (no builder guardrail); ConfigurableRole overrides it with the RoleBuilder.inputGuardrail(...) value. InputGuardrailEnforcer consults this (precedence: method annotation > this > class annotation).
      Overrides:
      getInputGuardrailConfig in class Role
      Returns:
      the role's input-guardrail config, or null if none set via builder
    • getOutputGuardrailConfig

      public OutputGuardrailConfig getOutputGuardrailConfig()
      Description copied from class: Role
      Programmatic output-guardrail config for this role's actions (TNS-561) — the builder-path counterpart of a class-level @OutputGuardrail. Default null (no builder guardrail); ConfigurableRole overrides it with the RoleBuilder.outputGuardrail(...) value. OutputGuardrailEnforcer consults this (precedence: method annotation > this > class annotation).
      Overrides:
      getOutputGuardrailConfig in class Role
      Returns:
      the role's output-guardrail config, or null if none set via builder