Kotlin SDK
Maven CentralLazysodium-based E2E encryption (ECDH + HKDF + AES-GCM) -- keys are derived automatically from your API key. Works on JVM, Android, and Kotlin/Native.
build.gradle.kts
dependencies {
implementation("com.hiloop:sdk:1.0.0")
} Quick start
Agent.kt
val client = HiloopClient(HiloopClientOptions(
apiKey = "hlp_xxx",
agentName = "my-bot",
))
val session = client.createSession(title = "Deploy v2.4.1?")
client.sendMessage(session.id, components = listOf(
ComponentNode("text", mapOf("content" to "12 features, 34 fixes. All tests passing.")),
ComponentNode("button_group", mapOf("buttons" to listOf(
mapOf("label" to "Approve", "action" to "approve", "variant" to "primary"),
mapOf("label" to "Reject", "action" to "reject", "variant" to "danger"),
))),
))
val result = client.awaitResponse(session.id)
println("Decision: ${result.response}") Examples
Preview
Approval flow
Gate dangerous actions behind human approval with rich context and action buttons.
Agent.kt
val client = HiloopClient(HiloopClientOptions(
apiKey = "hlp_xxx",
agentName = "deploy-bot",
))
val session = client.createSession(
title = "Deploy v2.4.1 to production?")
client.sendMessage(session.id, components = listOf(
ComponentNode("kv", mapOf("entries" to listOf(
mapOf("key" to "Service",
"value" to "api-gateway"),
mapOf("key" to "Version",
"value" to "2.4.1"),
mapOf("key" to "Changes",
"value" to "12 features, 34 fixes"),
))),
ComponentNode("button_group", mapOf(
"buttons" to listOf(
mapOf("label" to "Approve",
"action" to "approve",
"variant" to "primary"),
mapOf("label" to "Reject",
"action" to "reject",
"variant" to "danger"),
),
)),
))
val result = client.awaitResponse(session.id)
if (result.response == "approve") deploy() Preview
Card with diff
Present code reviews with diffs, stats, and action buttons in a single composable card.
Agent.kt
client.sendMessage(session.id, components = listOf(
ComponentNode("card", children = listOf(
ComponentNode("header", mapOf(
"title" to "PR #247: auth middleware")),
ComponentNode("diff", mapOf(
"filePath" to "src/auth.ts",
"hunks" to listOf(mapOf(
"header" to "@@ -12,3 +12,5 @@",
"lines" to listOf(
mapOf("type" to "context",
"content" to " val token = getToken()"),
mapOf("type" to "add",
"content" to " if (token == null) return unauthorized()"),
),
)),
)),
ComponentNode("button_group", mapOf(
"buttons" to listOf(
mapOf("label" to "Approve",
"value" to "approve"),
mapOf("label" to "Changes",
"value" to "changes"),
),
"responseRequired" to true,
)),
)),
)) Preview
Data report
Deliver structured reports with metrics and charts that humans can review at a glance.
Agent.kt
client.sendMessage(session.id, components = listOf(
ComponentNode("metric_grid", mapOf(
"metrics" to listOf(
mapOf("label" to "Revenue",
"value" to "$4.87M",
"change" to "+14%"),
mapOf("label" to "New MRR",
"value" to "$312K",
"change" to "+8%"),
mapOf("label" to "Churn",
"value" to "1.2%",
"change" to "-0.3%"),
),
)),
ComponentNode("chart", mapOf(
"type" to "bar",
"labels" to listOf("Jan", "Feb",
"Mar", "Apr"),
"datasets" to listOf(mapOf(
"label" to "Revenue",
"data" to listOf(320, 410, 380, 487),
)),
)),
)) E2E encryption
The Kotlin SDK uses Lazysodium for encryption. Keys are derived automatically from your API key -- all content is encrypted before leaving your process.
Kotlin
// Encryption is transparent -- just pass your API key
val client = HiloopClient(HiloopClientOptions(
apiKey = "hlp_xxx",
agentName = "deploy-bot",
))
// Content fields are encrypted automatically
val session = client.createSession(title = "Sensitive deployment review")
client.sendMessage(session.id, components = listOf(
ComponentNode("text", mapOf("content" to "Credentials rotated for prod DB.")),
)) Error handling
Kotlin
try {
val session = client.createSession(title = "Deploy?")
} catch (e: HiloopError) {
println("API error ${e.statusCode}: ${e.message}")
}