Skip to main content
Alpha Release. The Chatbase Android SDK is currently in alpha (v0.0.1-alpha03). APIs may change in future releases.
Conversation methods apply exclusively to conversations created through the mobile SDKs (Android and iOS). Conversations generated through the widget, the API, or external integrations cannot be accessed using the SDK. A user identified on both platforms sees their Android and iOS SDK conversations together.

What is the Chatbase Android SDK?

The Chatbase Android SDK is a Kotlin-first library that lets you integrate Chatbase agents into your Android app. It provides:
  • Real-time streaming with two levels of abstraction
  • Client-side tools that let the agent invoke local functions on the device
  • User identity with JWT-based authentication and automatic device ID tracking
  • Conversation management with cursor-based pagination
  • Structured error handling with typed exceptions
Requirements:

Installation

The SDK declares the INTERNET permission in its own manifest. It is merged automatically — you do not need to add it to your app’s manifest.

Quick Start

1

Get your Agent ID

  1. Go to the Chatbase Dashboard
  2. Select your agent
  3. Go to SettingsGeneral
  4. Copy the Agent ID
2

Enable the Android SDK channel

In the dashboard, go to DeployAndroid SDK and enable the channel for your agent.
If the Android SDK channel is not enabled, every SDK request fails with a 404 AGENT_NOT_FOUND error — even when the agent ID is correct.
3

Create a client

context can be any Android Context (Activity, Application, etc.). It is only used during creation to generate the device ID.
4

Send your first message

5

Clean up

Chatbase

object ChatbasePackage: com.chatbase.sdk The singleton factory for creating SDK clients.

create

Create a client with default settings.
Context
required
Any Android Context. Used only during creation to generate the device ID.
String
required
The Chatbase agent ID to connect to.

create (with configuration)

Create a client with custom configuration via a DSL builder.

ChatbaseConfig

data class ChatbaseConfigPackage: com.chatbase.sdk
For streaming responses, the SDK uses a separate 5-minute read timeout regardless of the readTimeoutMs setting. This ensures long-running streams are not interrupted prematurely.

Rate Limits

The Chatbase API enforces a rate limit of 1,000 requests per 10 seconds per device, applied server-side. When the limit is exceeded, the SDK throws an ApiException with isRateLimited == true. See Error Handling for how to handle this.

Next Steps

Streaming

Real-time streaming with callbacks and Kotlin Flow

Client-Side Tools

Register local tool handlers the agent can invoke

Conversations

Manage conversations, history, and pagination

Error Handling

Exception hierarchy and error handling patterns