Kotlin SDK
Official Kotlin SDK for MemoryKit. Android, JVM, and server-side.
Every method is suspend fun. Native Kotlin async.
SSE responses as Flow<SSEEvent> — collect, transform, combine.
Android API 21+, JVM 8+, server-side Kotlin.
Installation
Includes kotlinx-coroutines, kotlinx-serialization-json, okhttp, and okhttp-sse — no extra dependencies needed.
Quick start
Configuration options
The client implements Closeable. Use .use {} or call mk.close() when done:
Memories
Create and manage
Upload files
File upload is not yet available in the Kotlin SDK. Use the REST API directly with your preferred HTTP client:
Supported formats: PDF, DOCX, XLSX, PPTX, TXT, CSV, Markdown, HTML, and JSON. Max 100 MB.
Batch ingest
Up to 100 memories in a single request.
Search
Hybrid search
Combines vector similarity, full-text search, and reranking.
RAG query
Coming Soon — memories.query() is not available in the current SDK release. Use memories.search() for retrieval. LLM-powered query with answer generation will be available in a future release.
Streaming
Coming Soon — memories.stream() is not available in the current SDK release. Use memories.search() for retrieval. Streaming responses will be available in a future release.
Chats
Coming Soon — Chat methods (chats.create(), chats.sendMessage(), chats.streamMessage(), chats.get()) are not available in the current SDK release. Conversational RAG with chat sessions will be available in a future release.
Users
Webhooks
Error handling
All errors extend MemoryKitException with typed subclasses:
Retryable errors (429, 5xx) are automatically retried with exponential backoff up to maxRetries times. You don't need to implement retry logic yourself.
Android usage
Never embed API keys in your APK. Use BuildConfig fields from local.properties or a backend proxy. See Authentication for best practices.