Package com.tnsai.spi
package com.tnsai.spi
Service Provider Interface (SPI) package for TnsAI.
This package contains SPI interfaces that enable pluggable implementations for various components. Using Java's ServiceLoader mechanism, implementations can be discovered at runtime without explicit dependencies in the core module.
Available SPIs
CheckpointerProvider- State persistence backendsCheckpointerFactory- Factory for creating checkpointersResilienceStrategy- Resilience patterns (retry, circuit breaker)MessageBroker- Agent-to-agent messagingCognitiveModel- Cognitive architectures (BDI, Reactive)ToolRegistry- Tool registration and discoveryFeatureFlag- Gradual rollout (env / own store)
Implementing an SPI
- Create a class implementing the SPI interface
- Register in
META-INF/services/[interface-name] - Add the JAR to classpath
Example
// 1. Implement the interface
public class MyCheckpointerProvider implements CheckpointerProvider {
@Override
public String name() { return "mystore"; }
@Override
public boolean isAvailable() { return true; }
@Override
public Checkpointer create(Map<String, Object> config) {
return new MyCheckpointer(config);
}
}
// 2. Register in META-INF/services/com.tnsai.spi.CheckpointerProvider
// com.mycompany.MyCheckpointerProvider
// 3. Use via factory
Checkpointer cp = CheckpointerFactory.getInstance()
.create("mystore", Map.of("url", "..."));
-
ClassDescriptionFactory for creating Checkpointer instances using SPI discovery.Information about a provider.Service Provider Interface for Checkpointer implementations.Abstraction for agent cognitive architectures.Represents an action to be executed.Builder for BDI cognitive model.Represents a belief in the cognitive model.Snapshot of cognitive state for persistence.Represents a goal/desire in the cognitive model.Represents an intention/plan in the cognitive model.SPI for gradual feature rollout (TAN-3392).Locator for the process-wide
FeatureFlag(TAN-3392).Evaluation context forFeatureFlag.isEnabled(String, FlagContext).Opt-in marker for components whose backing service can be reached over the network or another out-of-process boundary, and that can answer a lightweight reachability probe in bounded time.Outcome of a reachability probe.SPI for adapting an MCP server URL into aHealthcheckableprobe.Abstraction for agent-to-agent message passing.Message container for inter-agent communication.Strategy interface for resilience patterns.Builder for creating composite resilience strategies.Classloader-scoped cache for Java SPI providers.Opt-in marker SPI for components that honourAgentBuilder.tenantId(...)— i.e. they keep one tenant's data observably separate from another's.Registry for managing agent tools.Parameter definition for a tool.Definition of a tool available to agents.Builder for ToolRegistryEntry.Type of tool.