Latest Release

Production-Grade AI for JVM Backends.

Clean interfaces. Structured data. Native observability. The library built for production-grade Java and Kotlin backends.

@AiService
interface ReviewAnalyzer {
    @Operation("Analyze the sentiment of this review and extract key topics.")
    suspend fun analyze(text: String): Analysis
}

data class Analysis(
    val sentiment: Sentiment,
    val topics: List<String>,
    val requiresFollowup: Boolean
)

Define your contract, Tramai handles the rest: prompt construction, model routing, and type-safe parsing.

Choose Your Path

Tramai is modular. Start where you are and grow as needed.

28

Modules

10+

Providers

25+

Guides

Java 21+

JVM Ready

Providers: OpenAI, Anthropic, Gemini, DeepSeek, Ollama, Bedrock, Azure OpenAI, and more

AI as a 4th Software Layer

TramAI adds @AiService as a first-class architectural layer alongside your controllers, services, and repositories. Same rigor. Same injection model. Same testability.

@Controller@Service@AiService@Repository

How Tramai Compares

Honest comparison vs LangChain4j and Spring AI. No marketing — just facts.

FeatureTramaiLangChain4jSpring AI
Type Safety Typed @AiService interfaces, data class return typesPrompt templates, string-based chainsString-in/String-out or ChatClient
Structured Output Automatic JSON schema from data classes, parse-and-retryManual schema definitionStructuredOutputConverter
Testing tramai-testing module, deterministic mock providers, no networkMock providers availableMock models available
Observability Native OpenTelemetry spans/metrics for every AI callOpenTelemetry via callbacksMicrometer integration
Framework Lock-in Framework-agnostic core, thin adaptersSpring-optional but Java-firstSpring-specific
Deployment Standalone or Spring Boot, Native Image readyStandalone or Spring BootSpring Boot only
Learning Curve Low — define an interface, annotate, callModerate — chains, prompts, memoryLow if you know Spring