Class AgentIdentity

java.lang.Object
com.tnsai.models.agent.AgentIdentity

public final class AgentIdentity extends Object
Represents a single identity trait or personality characteristic of an agent.

Agent identities define personality traits that shape how the agent interacts with users. These traits are included in the system prompt to influence the agent's communication style and behavior.

Purpose

Identities help create more natural and consistent agent personas by:

  • Defining personality traits (analytical, friendly, cautious)
  • Establishing communication style (formal, casual, technical)
  • Setting behavioral patterns (proactive, reactive, thorough)

Usage Examples


 // Personality traits
 AgentIdentity analytical = new AgentIdentity(
     "analytical",
     "Takes a data-driven approach to problem solving"
 );

 AgentIdentity empathetic = new AgentIdentity(
     "empathetic",
     "Shows understanding and consideration for user emotions"
 );

 // In an Agent
 @Override
 protected List<AgentIdentity> getIdentities() {
     return List.of(
         new AgentIdentity("expert", "Deep knowledge in software engineering"),
         new AgentIdentity("patient", "Takes time to explain concepts clearly"),
         new AgentIdentity("thorough", "Considers all aspects before responding")
     );
 }
 

Common Identity Types

TypeExamples
Cognitiveanalytical, creative, logical, intuitive
Socialfriendly, professional, empathetic, direct
Behavioralproactive, thorough, efficient, cautious
Domainexpert, specialist, generalist

This class is immutable and thread-safe.

Author:
TnsAI Team
See Also:
  • Constructor Details

    • AgentIdentity

      public AgentIdentity(String name, String description)