Package com.tnsai.roles
Class ConfigurableRole
java.lang.Object
com.tnsai.roles.Role
com.tnsai.roles.ConfigurableRole
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 Summary
Modifier and TypeMethodDescriptionTemplate method: Define the role's identity.Programmatic input-guardrail config for this role's actions (TNS-561) — the builder-path counterpart of a class-level@InputGuardrail.Programmatic output-guardrail config for this role's actions (TNS-561) — the builder-path counterpart of a class-level@OutputGuardrail.Programmatic resilience policy for this role's actions (TNS-567) — the builder-path counterpart of a class-level@Resilience.Methods inherited from class com.tnsai.roles.Role
create, getAction, getActionCount, getActions, getDomain, getGoal, getLLM, getMinimalPrompt, getName, getSpec, getSystemPrompt, hasAction, hasLLM, identity, setLLM, toString
-
Method Details
-
getIdentity
Description copied from class:RoleTemplate method: Define the role's identity. Subclasses MUST override this method to return a RoleIdentity.- Specified by:
getIdentityin classRole- Returns:
- role identity (name, goal, domain)
-
getResilienceConfig
Description copied from class:RoleProgrammatic resilience policy for this role's actions (TNS-567) — the builder-path counterpart of a class-level@Resilience. Default isResilienceConfig.NONE;ConfigurableRoleoverrides it with theRoleBuilder.resilience(...)value.ActionExecutorconsults this when no@Resilienceannotation is present.- Overrides:
getResilienceConfigin classRole- Returns:
- the role's resilience config, never null
-
getInputGuardrailConfig
Description copied from class:RoleProgrammatic input-guardrail config for this role's actions (TNS-561) — the builder-path counterpart of a class-level@InputGuardrail. Defaultnull(no builder guardrail);ConfigurableRoleoverrides it with theRoleBuilder.inputGuardrail(...)value.InputGuardrailEnforcerconsults this (precedence: method annotation > this > class annotation).- Overrides:
getInputGuardrailConfigin classRole- Returns:
- the role's input-guardrail config, or
nullif none set via builder
-
getOutputGuardrailConfig
Description copied from class:RoleProgrammatic output-guardrail config for this role's actions (TNS-561) — the builder-path counterpart of a class-level@OutputGuardrail. Defaultnull(no builder guardrail);ConfigurableRoleoverrides it with theRoleBuilder.outputGuardrail(...)value.OutputGuardrailEnforcerconsults this (precedence: method annotation > this > class annotation).- Overrides:
getOutputGuardrailConfigin classRole- Returns:
- the role's output-guardrail config, or
nullif none set via builder
-