Class Intention

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

public final class Intention extends Object
Represents an intention - a committed task that the agent is actively working on.

In the BDI (Belief-Desire-Intention) architecture, intentions represent the agent's current commitments. Unlike desires (which are goals), intentions are tasks that the agent has decided to pursue with a specific approach.

BDI Architecture Context

  • Belief - What the agent knows about the world
  • Desire - What the agent wants to achieve
  • Intentions (this class) - What the agent is committed to doing

Intention vs Desire

AspectDesireIntention
NatureGoal/ObjectiveCommitted Task
StatusWished forBeing executed
ApproachNot specifiedHas defined approach
Example"Be helpful""Answer the user's question about Java"

Usage Examples


 // Simple intention
 Intention task = new Intention(
     "Summarize the uploaded document",
     "Extract key points and present in bullet form"
 );

 // Intention without explicit approach
 Intention search = new Intention(
     "Find information about quantum computing",
     null  // approach will be empty string
 );

 // In an Agent (typically set dynamically)
 @Override
 protected List<Intention> getIntentions() {
     return List.of(
         new Intention(
             "Complete the code review",
             "Check for security issues, then performance, then style"
         )
     );
 }
 

Dynamic Intentions

Intentions often change based on the current task. Consider updating them dynamically or using agent state:


 public class DynamicAgent extends Agent {
     private final List<Intention> currentIntentions = new ArrayList<>();

     public void setCurrentTask(String task, String approach) {
         currentIntentions.clear();
         currentIntentions.add(new Intention(task, approach));
     }

     @Override
     protected List<Intention> getIntentions() {
         return List.copyOf(currentIntentions);
     }
 }
 

This class is immutable and thread-safe.

Author:
TnsAI Team
See Also:
  • Belief
  • Desire
  • invalid reference
    com.tnsai.agents.Agent#getIntentions()
  • Constructor Details

    • Intention

      public Intention(String taskDescription, String approach)