Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.synheart.ai/llms.txt

Use this file to discover all available pages before exploring further.

Overview

syni-kotlin is the Android consumer SDK for Syni. Same agent surface as the Flutter sibling and the Swift sibling, idiomatic for Kotlin (suspend calls, Flow<SyniChatEvent> streaming, StateFlow<SyniInstallState> for the install lifecycle).

Platform support

  • Android 8.0+ (minSdk 26)
  • Kotlin 2.0+ · Java 17 toolchain · AGP 9.0+
  • Native runtime ships in-AAR for arm64-v8a, armeabi-v7a, x86_64, x86

Installation

// build.gradle.kts
dependencies {
    implementation("ai.synheart:syni-sdk:0.0.2")
}
No CLI step needed on Android — Gradle pulls everything including the native libsyni_ffi.so per ABI.

Basic usage

import ai.synheart.syni.SyniAgent
import ai.synheart.syni.SyniModels
import ai.synheart.syni.SyniSpecPersona

val agent = SyniAgent(context = application)

// Load a persona by id from bundled spec assets.
val persona = SyniSpecPersona.load(context, "focus.coach.v1")

// First-run install: download + verify the model, load the engine,
// bind the persona. Emits lifecycle events on agent.installState.
agent.install(
    persona = persona,
    model = SyniModels.qwen25_15bInstructQ4,
)

// Single-turn chat.
val response = agent.chat("How can I focus right now?")
println(response.displayText)

Streaming

chatStream returns a Flow<SyniChatEvent> — token-level Delta events followed by exactly one Final carrying the structured response.
agent.chatStream("hello").collect { event ->
    when (event) {
        is SyniChatEvent.Delta -> print(event.delta)
        is SyniChatEvent.Final -> println("\n[${event.response.displayText.length} chars]")
    }
}

Hybrid local / cloud

val agent = SyniAgent(
    context = application,
    cloudConfig = SyniCloudConfig(
        baseUrl = "https://api.synheart.ai",
        authToken = { "<bearer-token>" },
        tenantId = "<tenant>",
        userId = "<user>",
    ),
)

agent.chat(
    message = "how was my recent session?",
    mode = SyniExecutionMode.CLOUD_FIRST, // try cloud, fall back to local
)
SyniExecutionMode values: LOCAL_FIRST (default), CLOUD_FIRST, LOCAL_ONLY, CLOUD_ONLY.

Install lifecycle

Wire installState into your UI to surface progress:
agent.installState.collect { state ->
    when (state) {
        SyniInstallState.NotInstalled -> showInstallPrompt()
        is SyniInstallState.Installing -> showProgress(state.stage, state.progress)
        is SyniInstallState.Installed -> showReady()
        is SyniInstallState.Failed -> showError(state.reason)
    }
}
Stages: DOWNLOADING_MODELVERIFYING_MODELLOADING_ENGINEBINDING_PERSONA.

Where this fits

syni-kotlin is the agent layer — inference, install lifecycle, persona binding, chat orchestration. It does NOT own:
  • HSI signal collection (the synheart-core SDK does), or
  • the four-authority gate (consent + capability + activation + session; also a host concern).
Synheart-ecosystem apps typically depend on synheart-core and use SyniModule, which wraps this SDK with those layers. Standalone use of syni-kotlin is fully supported when you don’t need the wider Synheart contract.

Models

Out-of-the-box GGUF models exposed under SyniModels:
  • qwen25_15bInstructQ4 (default, ~1.5 GB)
  • qwen2_05bInstructQ4 (~500 MB)
  • gemma3_1bInstructQ4
Pinned SHA-256 per model; verified at install time. Bring your own GGUF via a custom SyniModelSpec.

API reference

SurfaceNotes
SyniAgentConstructed with context + optional installer / cloudConfig. Exposes installState / currentState / isInstalled / hasCloud.
SyniAgent.install / restoreInstallIfReady / uninstall / disposesuspend; emit install-state transitions.
SyniAgent.chat / chatStreamsuspend / Flow<SyniChatEvent>.
SyniInstallStateSealed class: NotInstalled, Installing(stage, progress), Installed(...), Failed(reason, cause?).
SyniChatResponsedisplayText, message, suggestions, kind (chat / coach / suggestions / unknown).
SyniSpecPersonaload(context, personaId) — bundled persona JSON.
SyniModelCatalogList local + cloud model options; bundled defaults under SyniModelCatalog.bundled.
SyniCloudConfigbaseUrl, authToken: () -> String?, tenantId, userId.
SyniExecutionModeLOCAL_FIRST, CLOUD_FIRST, LOCAL_ONLY, CLOUD_ONLY.