Package com.tnsai.models.agent


package com.tnsai.models.agent
BDI (Belief-Desire-Intention) model classes for agent reasoning.

This package implements the BDI architecture, a well-established model for rational agents based on folk psychology. BDI agents reason about the world using three key mental attitudes:

BDI Mental States

 ┌─────────────────────────────────────────────────────────────┐
 │                    BDI Reasoning Cycle                       │
 ├─────────────────────────────────────────────────────────────┤
 │                                                              │
 │     BELIEFS ──────────► DESIRES ──────────► INTENTIONS      │
 │    (Knowledge)         (Goals)            (Commitments)      │
 │         │                  │                    │            │
 │         │                  │                    ▼            │
 │         │                  │               ┌────────┐        │
 │         │                  └──────────────►│  PLAN  │        │
 │         │                                  └────┬───┘        │
 │         │                                       │            │
 │         │                                       ▼            │
 │         │                                  ┌────────┐        │
 │         └─────────────────────────────────►│ ACTION │        │
 │                                            └────────┘        │
 └─────────────────────────────────────────────────────────────┘
 

Model Classes

ClassRoleExample
BeliefKnowledge about the world"user_language": "Turkish"
DesireGoals to achieve"Provide accurate information"
IntentionCommitted desires"Research the topic thoroughly"
PlanStrategy to fulfill intentions"1. Search, 2. Analyze, 3. Summarize"
CapabilitySkills the agent has"Web search", "Data analysis"
CommunicationCommunication styleFormal, Verbose
AgentIdentityAgent metadataname, description, version

Usage Example


 public class ResearchAgent extends Agent {
     @Override
     protected List<Belief> getBeliefs() {
         return List.of(
             new Belief("domain", "scientific research"),
             new Belief("sources", "academic databases, journals")
         );
     }

     @Override
     protected List<Desire> getDesires() {
         return List.of(
             new Desire("Provide well-researched answers", 10),
             new Desire("Cite sources accurately", 9)
         );
     }

     @Override
     protected List<Intention> getIntentions() {
         return List.of(
             new Intention("Always verify facts before responding")
         );
     }

     @Override
     protected List<Plan> getPlans() {
         return List.of(
             new Plan("Deep Research",
                 "Comprehensive investigation",
                 "1. Search multiple sources\n2. Cross-reference\n3. Synthesize")
         );
     }
 }
 

LLM Integration

BDI models contribute to the system prompt, providing context that guides the LLM's reasoning and responses.

See Also:
  • Class
    Description
    Represents a single identity trait or personality characteristic of an agent.
    Represents a single belief that an agent holds about the world.
    Strategy interface for handling conflicting beliefs.
    Represents a capability or skill that an agent possesses within the BDI architecture.
    Represents the communication style and persona of an agent.
    Represents a desire or goal that an agent wants to achieve.
    Strategy interface for resolving conflicts between desires with the same priority.
    Represents an error recovery scenario with strategy.
    Represents an intention - a committed task that the agent is actively working on.
    Represents a strategic plan or approach within the BDI architecture.