An Android OS layer where an AI agent is a first-class citizen.
Built in Rust · Powered by Claude · Integrated via MCP
Agent OS is an experimental Agent-First Mobile Operating System — a layer on top of Android (AOSP) where an autonomous AI agent can:
- Read and write files
- Execute shell commands
- Interact with installed apps via the Model Context Protocol (MCP)
- Run code, make commits, open PRs
- Delegate heavy tasks (build, deploy, tests) to a cloud backend on EKS
Think Claude Code, but running on your phone — with the agent as the OS nucleus instead of a desktop CLI.
┌─────────────────────────────────────────────────────┐
│ ANDROID DEVICE │
│ │
│ ┌─────────────────────────────────────────────┐ │
│ │ Compose UI (Kotlin) │ │
│ │ ChatScreen · ConfirmationCard · Settings │ │
│ └──────────────┬──────────────────────────────┘ │
│ │ UniFFI (auto-generated bindings) │
│ ┌──────────────▼──────────────────────────────┐ │
│ │ Agent Core (Rust) │ │
│ │ │ │
│ │ observe → plan → act → verify → repeat │ │
│ │ │ │
│ │ ┌──────────┐ ┌───────────┐ ┌──────────┐ │ │
│ │ │ Agent │ │ Pluggable│ │ Policy │ │ │
│ │ │ Loop │ │ LLM │ │ Engine │ │ │
│ │ └────┬─────┘ │ Anthropic │ │(capabilit│ │ │
│ │ │ │ OpenAI │ │ ies) │ │ │
│ │ ┌────▼──────┐ │ Ollama │ └──────────┘ │ │
│ │ │ Tools │ │ Mock │ │ │
│ │ │ fs·shell │ └───────────┘ │ │
│ │ │ git·http │ │ │
│ │ └─────┬─────┘ │ │
│ │ │ MCP Protocol │ │
│ │ ┌─────▼──────────────────────────────┐ │ │
│ │ │ MCP Registry │ │ │
│ │ │ (routes tool calls to servers) │ │ │
│ └──┴────────────────────────────────────┴───┘ │
└──────────────────────┬──────────────────────────────┘
│ HTTPS
┌──────────────────────▼──────────────────────────────┐
│ CLOUD BACKEND (Go · EKS) │
│ │
│ REST API → Executor → K8s ephemeral pods │
│ MCP Proxy → cloud MCP servers (git, GitHub, fs) │
└─────────────────────────────────────────────────────┘
| Layer | Technology |
|---|---|
| Agent core | Rust (memory-safe, zero-cost FFI, runs on ARM) |
| Android bridge | UniFFI (auto-generates Kotlin/Swift bindings) |
| Android UI | Jetpack Compose (Kotlin) |
| App integration | MCP — Model Context Protocol |
| LLM (default) | Anthropic Claude (pluggable via trait) |
| Cloud backend | Go on AWS EKS |
| Cloud execution | Ephemeral Kubernetes pods per task |
| TLS | rustls (no OpenSSL dependency — works on Android) |
mobile-agent-os/
├── crates/
│ ├── agent-core/ # Agent loop, state, memory — platform-agnostic
│ ├── llm-provider/ # LLMProvider trait + Anthropic, OpenAI, Ollama, Mock
│ ├── mcp-client/ # MCP registry — routes tool calls to servers
│ ├── mcp-server/ # SDK for apps to expose MCP servers
│ ├── tools/ # Built-in tools: filesystem, shell, git, http
│ ├── policy/ # Capability-based permission engine
│ ├── android-bridge/ # UniFFI exports → Kotlin bindings
│ └── uniffi-bindgen/ # Binding generator binary
│
├── android/ # Android app (Kotlin + Compose)
│ └── app/src/main/
│ ├── java/com/agentmobile/
│ │ ├── MainActivity.kt
│ │ ├── MainViewModel.kt
│ │ ├── AgentService.kt # Privileged foreground service
│ │ ├── RustBridge.kt # UniFFI bridge
│ │ └── mcp/MCPBridge.kt # Intent → MCP adapter
│ └── java/uniffi/ # Auto-generated (do not edit)
│
├── backend/ # Go server (EKS)
│ ├── cmd/server/ # HTTP API entrypoint
│ ├── internal/agent/ # Job executor
│ ├── internal/mcp/ # MCP proxy for cloud tools
│ └── pkg/k8s/ # Kubernetes pod runner
│
├── mcp-servers/
│ ├── filesystem-server/ # Rust MCP server (read/write/list)
│ ├── git-server/ # Rust MCP server (git ops)
│ └── cloud-server/ # Go MCP server (exec, clone, PR, test)
│
├── scripts/
│ ├── setup-windows.sh # One-time setup (installs Rust, NDK PATH)
│ ├── build-android.sh # Compile .so + generate Kotlin bindings
│ ├── run-emulator.sh # Full pipeline: build → install → launch
│ └── build-backend.sh # Go binaries + Docker images
│
├── config/
│ └── capabilities.yaml # Policy definitions (risk levels, allowlists)
├── docs/
│ └── architecture.md # Detailed architecture diagrams
└── Makefile # Convenience targets
The agent never depends on a specific LLM — it uses the LLMProvider trait:
#[async_trait]
pub trait LLMProvider: Send + Sync {
async fn complete(&self, messages: &[Message]) -> Result<Response>;
fn provider_name(&self) -> &str;
fn model_id(&self) -> &str;
}Switch provider via env var — no code change needed:
AGENT_LLM=anthropic ANTHROPIC_API_KEY=sk-ant-... # default
AGENT_LLM=openai OPENAI_API_KEY=sk-...
AGENT_LLM=ollama OLLAMA_BASE_URL=http://localhost:11434
AGENT_LLM=mock # no API key — for testingEvery app that declares an MCP socket in its AndroidManifest becomes a tool provider:
<meta-data
android:name="com.agentmobile.MCP_SOCKET"
android:value="/data/data/com.example.notes/files/mcp.sock" />The agent can then call notes.create_note, notes.search etc. natively.
Apps without MCP support are wrapped via Android Intents (MCPBridge.kt).
Instead of Android's coarse permissions, Agent OS uses fine-grained capabilities:
# config/capabilities.yaml
tools:
shell.exec:
capability: shell_exec
risk: high
confirm: true # always asks before running
filesystem.read:
capability: filesystem_read
risk: low
confirm: false
git.push:
capability: git_remote
risk: high
confirm: true- Windows 10/11 with Git Bash
- Android Studio with NDK installed
- An Anthropic API key (or use
AGENT_LLM=mockfor testing)
git clone https://github.com/YOUR_USERNAME/mobile-agent-os
cd mobile-agent-os
# Install Rust + Android targets + configure NDK PATH
./scripts/setup-windows.sh
source ~/.bashrc# Build Rust .so → generate Kotlin bindings → build APK → launch
make run-emulator
# With your API key
make run-emulator API_KEY=sk-ant-...
# After UI-only changes (skip Rust recompile)
make run-emulator-fastmake run-backend # Go server on :8080
make run-mcp-fs # Filesystem MCP server
make run-mcp-cloud # Cloud MCP server- Android APK build + emulator launch (in progress)
- Voice input (
"refactor this method") - Visual diff viewer (GitHub mobile-style)
- Persistent memory across sessions
- AOSP system service (agent as privileged daemon)
- iOS/Swift support via UniFFI (same Rust core)
- Offline mode via Ollama on-device
- MCP server SDK for third-party apps
- Memory safety — no crashes or undefined behavior in the agent loop
- Zero-cost FFI — direct bindings to Android JNI via UniFFI, no overhead
- ARM performance — compiles lean and fast on mobile SoCs
- No OpenSSL — uses
rustls, which cross-compiles cleanly to Android
MIT