Skip to content
QwryAI
Documentation
Pages

Android SDK

Installation & Quickstart

Add the QwryAI Android SDK to your app and send your agent its first message

Prerequisites

RequirementMinimum
Android7.0 (API 24)
Build toolsAndroid Studio Ladybug (2024.2.1) and JDK 11
Kotlin coroutinesIncluded with the SDK (kotlinx-coroutines-android 1.9.0)
Jetpack ComposeNot required: the SDK works with any UI toolkit

Installation

Kotlin
// build.gradle.kts (app module)
dependencies {
    implementation("com.qwryai:qwryai-sdk:0.1.0")
}

Quick start

  1. Open the Android SDK channel

    In your agent, open Channels and select Manage on the Android SDK card.

    Channels › Android SDK › Manage.
  2. Copy your agent ID

    On the Setup tab, select Copy on the Agent ID card. The same tab links to the SDK source and a complete example app, and its Install and Quick start cards hold the code below with your agent ID already filled in.

  3. Switch on Visibility

    Open the Overview tab and turn on Visibility. The same tab sets the model and instructions this channel answers with.

    Overview › Visibility.
  1. Choose the channel's actions

    The Actions tab controls which of your agent's actions can run in the Android SDK. Turn on any Run client-side code action your app handles; see Client-Side Tools.

    Actions: which actions run in the app.
  2. Create a client
    Kotlin
    import com.qwryai.sdk.Qwry
    
    val client = Qwry.create(context, "YOUR_AGENT_ID")

    context can be any Android Context, such as an Activity or your Application. The SDK keeps only its application context, to store this install's device ID and the signed-in user. Create one client and keep it, for example in your Application class.

  3. Send your first message
    Kotlin
    lifecycleScope.launch {
        val response = client.send("Hello! How can you help me?") {
            onTextDelta = { delta ->
                // Runs on a background thread for each piece of text
                print(delta)
            }
        }
    
        // The whole answer, once it is complete
        println(response.message.text)
        println("Conversation: ${response.conversationId}")
    }

    Every call is a suspend function that's safe to start from the main thread. The next send continues the same conversation; call client.newConversation() to start another.

Next steps

Explore the documentation