Skip to main content
The Android Assistant SDK puts a governed agent inside your own app: a streaming client to Metabind’s Agent Proxy, an MCP client for your project’s tools, and rendering of Interactive Tool results as native Jetpack Compose — not web views — through BindJS. Use the drop-in MetabindAssistantView for a complete chat surface, or build your own with the lower-level APIs.

SDK on GitHub

metabind-android — the Android SDK. The Assistant SDK is the :metabindai module.

Demo app

samples/assistant-demo — a complete Compose chat app built on MetabindAssistantView.

Requirements

Installation

Add the GitHub Packages repository

The Metabind Android libraries and their BindJS dependency are published only to GitHub Packages, which requires authentication even for public packages. Create a GitHub personal access token (classic) with the read:packages scope. Repository access alone doesn’t grant package access. Provide your GitHub username and the token to Gradle, either as environment variables:
Or in ~/.gradle/gradle.properties:
Then add the repository to your settings.gradle.kts:

Add the dependency

Add the Assistant SDK dependency, which pulls in the MCP client (ai.metabind:mcpappshost-android) and the BindJS renderer (ai.metabind:bindjs-android) transitively:

Set the project’s LLM provider

The Agent Proxy runs your agent on the model provider set on your project, with your own model key stored in Metabind. It refuses chat requests for a project that has no provider and key, so set them once per project before the app’s first conversation:
  • In Metabind Studio: open your project, click the gear icon at the top right (Project Settings), and choose Agent. Click Setup Agent, choose a Provider and Model, enter the provider’s API Key, and click Setup Agent.
  • With the Metabind CLI: run metabind agent set in the bound project, and pipe the key in so it stays out of your shell history:
    --provider takes anthropic, openai, or google (Gemini). metabind agent models lists the models for each.
Metabind encrypts the key server-side and never returns it in API responses. See LLM provider configuration. On the same Agent page, write the agent’s System Prompt: its voice, rules, and goals. The proxy sends it to the model on every turn, after your server instructions. See System prompt.

What you configure

  • A Metabind API key, sent as a Bearer token to both the Agent Proxy and the MCP server.
  • Your project’s orgId and projectId: the internal IDs, not the slugs, because the Agent Proxy accepts only IDs. The SDK derives your project’s MCP server URL from these. To look them up, see Find your organization and project IDs.
  • Optionally, the agentHost and mcpHost constructor parameters, which default to https://agent.metabind.ai and https://mcp.metabind.ai.

Drop in the chat surface

The SDK ships MetabindAssistantView, a complete chat UI:
MetabindAssistantView handles message bubbles, streaming indicators, tool rendering, input, and auto-scrolling. It follows your app’s Material3 theme.
Retain the MetabindAssistant instance at an appropriate scope — inside a ViewModel, for example — and call close() when you discard it.

MetabindAssistant

MetabindAssistant manages the conversation. For custom UIs, observe its state directly:

ChatMessage

Stream a conversation turn

MetabindAgentProvider calls the Agent Proxy — which holds the LLM key and runs the tool loop server-side — and streams results back as a Flow<LLMStreamEvent>:
The Android SDK is Agent-proxy only — there’s no bring-your-own-key Anthropic provider. See LLM provider configuration for how the proxy works.

Discover and fetch tool UIs

Use MCPAppsClient to list your project’s tools and fetch the UI resource for a tool that renders one:
MCPAppsClient also exposes callTool(name, arguments) for invoking tools.

Native rendering of tool output

If you use MetabindAssistantView, tool rendering is automatic. For custom UIs, render each tool call with MetabindToolView, the same renderer MetabindAssistantView uses. It takes a ToolUIContent, which has two variants:
  • ToolUIContent.BindJS — rendered as Compose through bindjs-android
  • ToolUIContent.Html — rendered in a WebView
toolUIContent is keyed by tool call ID, the same ID as the TOOL message the call produced. See MetabindToolView.kt for the optional parameters.

Build a custom chat UI

If MetabindAssistantView doesn’t fit your design, build your own around MetabindAssistant. Observe assistant.messages, call assistant.send(text), and render each TOOL message’s UI by passing assistant.toolUIContent[message.id] to MetabindToolView. The finance demo is a complete custom UI built this way, and Custom host UI has a short example. The MetabindAssistantView source shows the drop-in surface built on the same APIs.

Next steps

Demo app

The reference Compose chat app, end to end.

LLM provider configuration

How the Agent Proxy holds keys and runs the tool loop.

BindJS reference

The component language the tool UIs are written in.

iOS SDK

The iOS equivalent.