Package com.tnsai.metadata
Class RoleSpecReader
java.lang.Object
com.tnsai.metadata.RoleSpecReader
Reads role metadata from TnsAI annotations.
This utility class extracts metadata from annotation-based role definitions, enabling external frameworks (SCOP, JADE, JASON, etc.) to integrate with TnsAI without TnsAI depending on them.
Usage Pattern
// In your framework's connector/plugin:
public class MyFrameworkRolePlugin extends MyFrameworkRole {
private final RoleSpec metadata;
public MyFrameworkRolePlugin() {
this.metadata = RoleSpecReader.read(this.getClass());
// Use metadata for system prompts, LLM config, etc.
}
public String getSystemPrompt() {
return metadata.generateSystemPrompt("MyEnvironment");
}
}
Supported Annotations
@RoleSpec- BDI model and Gaia responsibilities@Action- Method-level action definitions@Communication- Language, tone, format settings@Memory- Conversation and vector memory@Resilience- Retry and circuit breaker policies@Security- Access control and audit settings
- Author:
- TnsAI Team
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic RoleSpecReader.RoleSpecReads all metadata from a role class.
-
Method Details
-
read
Reads all metadata from a role class.- Parameters:
roleClass- the class to read annotations from- Returns:
- role metadata
-