Package com.tnsai


package com.tnsai
TnsAI Java SDK - A multi-agent framework with BDI architecture and Gaia methodology.

TnsAI provides a comprehensive framework for building intelligent multi-agent systems in Java. It combines two established agent-oriented methodologies:

Core Concepts

  • BDI Architecture: Agents reason using Beliefs (knowledge), Desires (goals), and Intentions (commitments). See com.tnsai.models.agent.
  • Gaia Methodology: System design through Roles, Responsibilities, and organizational structure. See com.tnsai.models.role.

Package Structure

PackageDescription
com.tnsai.agentsBase Agent class and lifecycle management
com.tnsai.rolesRole definitions and capabilities
com.tnsai.actionsAction execution and executors
com.tnsai.llmLLM interfaces and provider implementations
com.tnsai.memoryMemory management (InMemory, File-based)
com.tnsai.modelsData models (BDI, Gaia, Chat)
com.tnsai.protocolsAgent communication protocols
com.tnsai.stateState persistence and checkpointing
invalid reference
com.tnsai.quality.observability
OpenTelemetry integration

Quick Start


 import com.tnsai.agents.Agent;
 import com.tnsai.actions.ActionExecutor;
 import com.tnsai.accountability.AuthorityScope;
 import com.tnsai.identity.AgentPrincipal;
 import com.tnsai.llm.LLMClient;
 import com.tnsai.roles.Role;
 import java.util.List;
 import java.time.Duration;

 // Supply a configured LLM client, a role, and an issued principal.
 public class MyAgent extends Agent {
     private final Role role;

     public MyAgent(LLMClient llmClient, Role role,
             AgentPrincipal principal, AuthorityScope scope) {
         super("my-agent", llmClient, null, wired(principal, scope));
         this.role = role;
     }

     private static ActionExecutor wired(AgentPrincipal principal, AuthorityScope scope) {
         ActionExecutor executor = new ActionExecutor();
         executor.setPrincipal(principal);
         executor.setDefaultScope(scope);
         return executor;
     }

     @Override
     protected List<Role> getRoles() {
         return List.of(role);
     }
 }

 // Use the supplied application role and identity.
 Agent agent = new MyAgent(llmClient, role, principal,
     AuthorityScope.unrestricted(Duration.ofHours(1)));
 String response = agent.chat("Hello, how can you help me?");
 

Features

  • Multiple LLM provider support (OpenAI, Anthropic, Gemini, Azure, Ollama, etc.)
  • Built-in retry logic with exponential backoff
  • Tool/Function calling support
  • Memory persistence (InMemory, File-based)
  • Agent communication protocols (Direct, Broadcast, PubSub)
  • OpenTelemetry observability
  • State checkpointing and recovery
See Also: