On-Device AI Agent — Android

Local LLM inference.
Zero cloud. Zero API.

Aria Prime runs quantized language models entirely on your Android device — via a custom JNI bridge to llama.cpp with OpenCL GPU acceleration. Your data stays on your phone. No server, no key, no account.

Explore on GitHub All TBTechs Projects
Aria Prime — on-device AI agent
1,063
AgentLoop lines
13
Compose screens
0
Cloud calls
5
Core subsystems
Architecture

Built from the ground up.
No wrappers. No shortcuts.

Every layer is purpose-built. The agent loop drives a real read-decide-act-observe cycle with live OS integration — not a chatbot with a fancy UI on top.

01

AgentLoop — 1,063 lines

The central orchestration engine drives a continuous read → decide → act → observe cycle. Circuit breakers prevent runaway actions, an event router dispatches signals between subsystems, and a health monitor tracks the state of every component in real time.

02

llama.cpp via JNI / NDK

A custom C++ JNI bridge calls llama.cpp directly from the JVM, running quantized GGUF models on the device GPU via OpenCL. The native layer handles memory allocation, model context, token sampling, and crash recovery — bypassing the JVM for all math-critical paths.

03

SAM2 Visual Segmentation Engine

A SAM2 model gives the agent spatial awareness of the screen — identifying UI regions, boundaries, and interactive zones by visual segmentation rather than relying solely on the accessibility view hierarchy.

04

AccessibilityService Screen Context

Android's AccessibilityService provides deep real-time screen context — the agent sees what is visible, what is focusable, and what text is on screen, without root or special system permissions.

05

Gesture Execution Engine

The agent executes real Android gestures — taps, swipes, long-presses, scrolls — via AccessibilityService gesture injection. It physically interacts with apps at the OS level, not through simulated events.

06

Reinforcement Learning Policy Network

A policy network shapes agent decision-making across sessions — improving action selection quality over time based on observed outcomes, building a local behavioral model that adapts to how you use your device.

Stack

13 screens. Native C++. No compromises.

Kotlin and Jetpack Compose on Android. C++ via NDK for inference and crash-critical paths. Every component purpose-built for on-device operation.

Kotlin
Application layer
Jetpack Compose
13 screens, dark UI
llama.cpp
LLM inference engine
JNI / NDK
Native bridge
OpenCL GPU
On-device acceleration
GGUF quantization
Compressed models
SAM2
Visual segmentation
AccessibilityService
Screen context
Gesture injection
OS-level interaction
RL policy network
Adaptive decisions
Native C++
Math + crash handling
Android
Target platform

Read the source

The AgentLoop, the JNI bridge, the RL policy — every layer is open source. Clone it, read it, build on it.