aisdk-kotlin 0.3.0-alpha01 indexed Multifaceted AI tooling library delivering typed agent and tool contracts, streaming text and structured outputs, provider/gateway adapters, embeddings and media primitives, telemetry, mocks, and utilities.
Bring this to kpkg
This library is indexed from the KMP ecosystem and already resolves through kpkg.dev's Maven Central proxy. Maintainers can verify the namespace and publish future versions to kpkg for free hosting, real download stats, and signed-provenance pages.
Publishing coming soonMetadata
Owner torad-labs
Stars 0
Used by —
Health —
License Other
Latest 0.3.0-alpha01
Repository github.com/torad-labs/aisdk-kotlin
Updated 2026-06-14 Readme Changelog AI SDK Kotlin
Kotlin Multiplatform port of Vercel AI SDK v6 patterns and public feature areas.
This is a green-room Kotlin rewrite of the architectural contracts, not a TypeScript source translation and not an official Vercel package.
Targets
Common Kotlin API for shared agent code.
Android library publication.
iOS static framework publication for iosX64, iosArm64, and iosSimulatorArm64.
JVM artifact for backend and desktop services.
Install
Until the first release is published, use a source dependency or publishToMavenLocal:
./gradlew publishToMavenLocal
dependencies {
implementation("ai.torad:aisdk-kotlin:0.1.0-SNAPSHOT" )
}
Quick Start
What Is Included
Provider facades for the AI SDK v6 package ecosystem are folded into this root artifact for now. Future aisdk-provider-* artifacts can split publication boundaries without changing the common contracts.
Documentation
Build
Use JDK 21 to build the project. JVM and Android bytecode target JVM 17.
./gradlew jvmTest
./gradlew check publishToMavenLocal
Android publication requires an Android SDK with compile SDK 36 installed.
License
Apache-2.0. See LICENSE .
import ai.torad.aisdk.ToolLoopAgent
import ai.torad.aisdk.stepCountIs
import ai.torad.aisdk.tool
import ai.torad.aisdk.toolSetOf
import ai.torad.aisdk.providers.MockLanguageModel
import kotlinx.serialization.Serializable
import kotlinx.serialization.serializer
@Serializable
data class EmptyInput (val unused: String = "" )
val helloTool = tool<EmptyInput, String, Unit >(
name = "hello" ,
description = "Return a greeting." ,
inputSerializer = serializer(),
outputSerializer = serializer(),
) { "Hello from a tool." }
val agent = ToolLoopAgent<Unit , String>(
model = MockLanguageModel.textOnly("Welcome." ),
instructions = "Be brief." ,
tools = toolSetOf(helloTool),
stopWhen = stepCountIs(3 ),
)
Agent and ToolLoopAgent.
Typed tool() definitions, dynamicTool(), schemas, and ToolSet.
generateText, streamText, and cold Flow<StreamEvent> streaming.
Structured output through Output.obj, Output.array, Output.choice, and Output.json.
Deprecated v6 compatibility shims: generateObject and streamObject.
Embeddings, reranking, image generation, speech generation, transcription, and video generation model contracts.
Provider registry and customProvider routing.
Gateway facade with createGateway, gateway, gateway metadata APIs, gateway errors, provider-executed gateway tool descriptors, and a Ktor-backed KtorGatewayTransport.
OpenAI-compatible Ktor provider for chat, completions, embeddings, images, speech, and transcription through createOpenAICompatible.
Provider-utils parity helpers: schemas, IDs, JSON event stream parsing, headers, base64 byte helpers, media and URL validation utilities.
Text stream, UI message stream, and chat transport primitives for Kotlin hosts.
Telemetry helpers, global/local telemetry integrations, and a KMP tracer/span abstraction.
Compatibility helpers such as DefaultGeneratedFile, pruneMessages, experimental media aliases, and v6 public error types.
Lifecycle hooks, middleware, stop conditions, call/step preparation, and cancellation.
UI message aggregation types for Compose, SwiftUI, or server-rendered hosts.
Mock models for deterministic tests across every model family. Related libraries Surfaced from shared tags and platforms — no rankings paid for.
koog ★ 4.4k
JetBrains Framework designed for building AI agents with tool interaction, complex workflows, semantic search, and persistent memory. Offers modular architecture, real-time processing, and comprehensive tracing. Shared: openai, llm, ktor adk-kotlin ★ 119
google Code-first toolkit for building, evaluating, and deploying sophisticated AI agents; offers rich tool ecosystem, modular multi-agent orchestration, built-in development UI and cloud integrations. Shared: sdk, llm, agents kotlin-sdk ★ 80
agentclientprotocol Implements Agent Client Protocol for integrating AI agents, supporting client and agent capabilities, standardized AI interface, JSON-RPC handling, session management, and file operations. Includes examples and STDIO transport communication. Shared: sdk, ktor, agents tracy ★ 73
JetBrains Tracing, monitoring and evaluating AI features via a unified API that captures structured traces, follows OpenTelemetry Generative AI semantics, auto-instruments popular AI clients, and exports to observability backends. Shared: sdk, openai, llm KSafe ★ 301
ioannisa Effortlessly encrypts and persists data using hardware-backed security, offering one-code-path simplicity, seamless integration, and protection for sensitive information like OAuth tokens. Shared: kotlin-serialization, kotlin-flow, compose xef ★ 193
xebia-functional Integrates modern AI capabilities, including large language models and image generation, into applications. Offers core libraries for essential AI services and complementary library integrations, inspired by LangChain and Hugging Face projects. Shared: openai, llm, agents