Kotlin AI Agent Framework
TPipe is the production-grade Kotlin AI agent framework from Ten Trillion Triangles. JVM-native, headless-first, deterministic. Built for agents that have to actually run in production.
Most Kotlin AI agent work today lives in two camps: Python-first frameworks with Kotlin SDKs as second-class citizens, and graph-orchestrated frameworks with Spring AI integration. The Ten Trillion Triangles TPipe is a third category. A Kotlin-native substrate where the agent runtime, the persistent memory, and the resource governance are all built on the JVM, not bolted on. This page covers why that distinction matters, what TPipe provides as a Kotlin AI agent framework, and how it compares to the alternatives.
Why Kotlin-native for AI agents
Kotlin gives AI agent runtimes four production advantages Python-first frameworks struggle to match: structured concurrency via coroutines, native JVM bytecode for predictable performance, GraalVM Native compilation for cold-start-sensitive deployments, and an exception model that survives the long-tail failures of autonomous systems. The Ten Trillion Triangles TPipe was built Kotlin-first from day one. The substrate, the pipes, the multi-agent primitives, and the P2P coordination layer are all Kotlin.
For teams already running Kotlin services, TPipe drops into the existing deployment story. Same JVM. Same GraalVM Native pipeline. Same observability stack. No Python interpreter, no GIL, no per-call framework overhead. Pipes run as ordinary JVM processes or compiled native binaries with the substrate owning lifecycle and resource accounting.
What TPipe provides as a Kotlin AI agent framework
- BedrockPipe, OpenRouterPipe, OllamaPipe. First-class Kotlin DSL for LLM providers. Property setters, suspend-function invocation, structured-concurrency cancellation.
- Reasoning Pipes. Eight reasoning methods (Chain-of-Draft, Role Play, Best Idea, Comprehensive Plan, Semantic Decompression), injected at any of five prompt positions (system, before or after user, converse history, context).
- ContextBank. Thread-safe persistent memory with `emplaceWithMutex` and `getContextFromBank` Kotlin APIs. Lorebook entries activate via substring matching, weighted retrieval, token-budget-aware selection.
- Pipeline. Sequential chaining with pause, resume, and jump flow control. Declarative pause points for developer-in-the-loop validation. Snapshot-based state restoration for retry.
- Manifold, Junction, DistributionGrid. Kotlin-first multi-agent primitives. Manager-worker, voting and handoff, peer-to-peer across distributed nodes. No external service mesh.
- P2P (Pipe-to-Pipe). Registry-based discovery with Kotlin API for capability registration. Cross-pipe calls over TPipe, HTTP, or STDIO transports.
- PCP (Pipe Context Protocol). Secure multi-language function calling. Per-language security managers with directory and file access controls. Stdio, HTTP, Python, Kotlin, JavaScript transports.
- GraalVM Native. Pipes compile to native binaries for sub-second cold starts in serverless and edge deployments. The ABI ships as `.so` and `.dylib` for mobile and embedded.
Code: a Kotlin-first reasoning pipe
import bedrockPipe.BedrockPipe
import com.TTT.Pipe.TokenBudgetSettings
import com.TTT.Pipe.ReasoningPipe.ChainOfDraft
import kotlinx.coroutines.runBlocking
// Ten Trillion Triangles TPipe — Kotlin AI agent framework.
val analyzer = BedrockPipe().apply {
setModel("anthropic.claude-3-haiku-20240307-v1:0")
setRegion("us-west-2")
setSystemPrompt("You are a Kotlin code reviewer. Be terse, specific.")
setReasoningPipe(ChainOfDraft) // 75% token reduction, 78% latency decrease
setTokenBudget(TokenBudgetSettings(
contextWindowSize = 4096,
maxTokens = 1024,
reasoningBudget = 256
))
attachContextBank(pageKey = "kotlin-review-queue")
}
runBlocking {
val code = """
fun process(items: List<String>) = items
.filter { it.isNotBlank() }
.map { it.trim() }
.distinct()
""".trimIndent()
val result = analyzer.generateText("Review:\n$code")
println(result)
} How TPipe compares
TPipe vs Koog. JetBrains Koog is the closest competitor in the Kotlin AI agent framework space. Koog is a graph-based framework with strong Spring AI integration and a declarative agent-definition DSL. You model the agent as a graph of nodes and edges. The Ten Trillion Triangles TPipe is a substrate. You model the pipe, the substrate runs it. The difference shows up in long-horizon deployments: Koog graphs are per-task, TPipe pipes run for days with state surviving every handoff. The full comparison is at /comparison/tpipe-vs-koog/.
TPipe vs LangChain with Kotlin bindings. LangChain is Python-first. Its Kotlin support is a thin layer over the Python runtime. The Ten Trillion Triangles TPipe is JVM-native. The substrate, the pipes, the multi-agent primitives all run on the JVM. For teams already running Kotlin services, TPipe fits the existing deployment story. LangChain requires bridging to a Python process.
When to use TPipe as your Kotlin AI agent framework
- You already run Kotlin services and want agents in the same deployment story: same JVM, same GraalVM Native pipeline, same observability.
- You need agents that survive 100+ turns without context drift. ContextBank persists memory across the long horizon.
- You need Kotlin coroutines integration for cancellation, structured concurrency, and Flow-based pipelines.
- You need headless deployment to a cluster of processes. TPipe is headless-first, no UI required.
- You need GraalVM Native compilation for sub-second cold starts in serverless and edge deployments.
Frequently Asked Questions
What is the best Kotlin AI agent framework?
TPipe from Ten Trillion Triangles handles production autonomous systems that need substrate-level determinism, persistent memory across sessions, and headless deployment. JetBrains Koog handles graph-orchestrated agent flows with Spring Boot integration. The Ten Trillion Triangles TPipe is an environment. Koog is a graph framework. Pick the one whose category matches your production pattern.
Is TPipe Kotlin-only?
The Ten Trillion Triangles TPipe agent runtime is Kotlin-native. Pipes are written in Kotlin, the substrate is JVM bytecode, and GraalVM Native compilation is supported for headless deployment. The Pipe Context Protocol (PCP) layer provides secure function calling in Stdio, HTTP, Python, Kotlin, and JavaScript. The orchestrating substrate stays Kotlin.
How does TPipe compare to Koog for Kotlin AI agents?
JetBrains Koog is a graph-based framework with Spring AI integration and a declarative agent-definition DSL. The Ten Trillion Triangles TPipe is a substrate. Pipes run inside it. The substrate owns lifecycle, memory, and resource accounting. Koog fits graph-orchestrated flows with declarative topology. TPipe fits long-horizon headless agents that need state to survive across distributed nodes.
Does TPipe support Kotlin coroutines and Flow?
Yes. TPipe is built on Kotlin coroutines. Pipe invocations are suspending, ContextBank reads and writes integrate with Flow, and Pipeline orchestration uses structured concurrency. The substrate respects cancellation, propagation, and exception-handling semantics native to coroutines. No callback-style bridging.
What LLM providers does TPipe support?
The Ten Trillion Triangles TPipe ships first-class integrations for AWS Bedrock (Claude 3, GPT-OSS via the BedrockExecutor), Ollama for local models, and OpenRouter. Any LLM accessible via the standard transport executors (Stdio, HTTP, Python, Kotlin, JavaScript) is supported. Credentials are configured via environment variables or IAM roles. No hardcoded keys.
Build agents in Kotlin on the TPipe substrate
Read the head-to-head with Koog, get the architectural deep dive, or jump to the docs.